public static DataSet GetStoreBaseInformation(StoreBaseInformation storeBase) { SqlParameter[] paras = { new SqlParameter("@storeNo", storeBase.StoreNo), new SqlParameter("@storeRegion", storeBase.StoreRegion), new SqlParameter("@storeType", storeBase.StoreType), new SqlParameter("@printerType", storeBase.PrinterType), new SqlParameter("@tonerType", storeBase.TonerType), new SqlParameter("@laptopCount", storeBase.LaptopCount) }; return(SqlHelper.ExecuteDataSet("GetStoreBaseInformation", paras)); }
// 同时会增加门店详细信息表的相关信息 public static void InsertStoreBaseInformation(StoreBaseInformation storeBase) { SqlParameter[] paras = { new SqlParameter("@storeNo", storeBase.StoreNo), new SqlParameter("@storeRegion", storeBase.StoreRegion), new SqlParameter("@storeType", storeBase.StoreType), new SqlParameter("@emailAddress", storeBase.EmailAddress), new SqlParameter("@printerType", storeBase.PrinterType), new SqlParameter("@tonerType", storeBase.TonerType), new SqlParameter("@laptopCount", storeBase.LaptopCount) }; SqlHelper.ExecuteNonQuery("InsertStoreBaseInformation", paras); }
// 需要VPN或者ERP数据库连接 private static void InsertStoreBaseInformationTemp() { DataSet ds = SqlHelper.GetOpeningStores(); List <StoreBaseInformation> list = new List <StoreBaseInformation>(); int count = ds.Tables[0].Rows.Count; for (int i = 0; i < count; i++) { StoreBaseInformation storeBase = new StoreBaseInformation(); storeBase.StoreNo = ds.Tables[0].Rows[i]["StoreNo"].ToString(); storeBase.StoreRegion = ds.Tables[0].Rows[i]["Region"].ToString(); storeBase.StoreType = ds.Tables[0].Rows[i]["StoreType"].ToString(); storeBase.EmailAddress = storeBase.StoreRegion == "HK" ? storeBase.StoreNo + "*****@*****.**" : storeBase.StoreNo + "*****@*****.**"; storeBase.PrinterType = ""; storeBase.TonerType = ""; storeBase.LaptopCount = "2"; list.Add(storeBase); } string[] clist = { "storeNo", "storeRegion", "storeType", "emailAddress", "printerType", "tonerType", "laptopCount" }; DataTable dt = new DataTable(); foreach (string colname in clist) { dt.Columns.Add(colname); } int rowcount = list.Count; for (int i = 0; i < rowcount; i++) { DataRow row = dt.NewRow(); row["storeNo"] = list[i].StoreNo; row["storeRegion"] = list[i].StoreRegion; row["storeType"] = list[i].StoreType; row["emailAddress"] = list[i].EmailAddress; row["printerType"] = list[i].PrinterType; row["tonerType"] = list[i].TonerType; row["laptopCount"] = list[i].LaptopCount; dt.Rows.Add(row); } TruncateStoreBaseInformationTemp(); SqlHelper.CommonBulkInsert(dt, "StoreBaseInformationTemp"); }