using JHReport.DAL; using System; using System.Collections.Generic; using System.Linq; using System.Web; using Warehouse.Models.mesModel; namespace Warehouse.DAL.Report { public class AddLocationDal { static DbUtility dbhelp = new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer); public string AddStock(dynamic Stand) { using (var context = new mesModel()) { try { string sql = ""; sql = @"select * from [wh].[dbo].[tstock] where name = '" + Stand + "'"; var ress = context.DynamicListFromSql(sql, null); if (ress != null && ress.Count() != 0) { return "fail"; } else { // dbhelp.ExecuteDataTable(sql, null); return "success"; } } catch (Exception ex) { return "错误:" + ex.Message; } } } //static DbUtility dbhelp= new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer); public void insert_sql1(string sql) { dbhelp.ExecuteDataTable(sql, null); } public string AddLocation(dynamic Stand,dynamic Location) { using (var context = new mesModel()) { try { string sql = ""; sql = @"select * from [wh].[dbo].[tstoragelocation] where locationname = '" + Location[0] + "' and stockid=' " + Stand[0] + "'"; var ress = context.DynamicListFromSql(sql, null); if (ress != null && ress.Count() != 0) { return "fail"; } else { return "success"; } } catch (Exception ex) { return "错误:" + ex.Message; } //string sql = @"select * from [wh].[dbo].[tstock] where name="+Stand[0]+""; } } //static DbUtility dbhelp = new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer); public void insert_sql2(string sql) { dbhelp.ExecuteDataTable(sql, null); } } }