//UPDATE Customer public JsonResult UpdateStore(store store) { if (ModelState.IsValid) { store st = _context.Stores.Where(c => c.Id == store.Id).SingleOrDefault(); st.Name = store.Name; st.Address = store.Address; _context.SaveChanges(); return(new JsonResult { Data = "Sucess", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } else { //Console.Write(e.Data + "Exception Occured"); var modelErrors = new List <string>(); foreach (var modelState in ModelState.Values) { foreach (var modelError in modelState.Errors) { modelErrors.Add(modelError.ErrorMessage); } } return(new JsonResult { Data = modelErrors, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
private void BtupdateCustomer_Click(object sender, EventArgs e) { var query2 = store.employee.FirstOrDefault(m => m.EmployeeName == MandobNametextBox1.Text); var check = store.SalesRepresentatives.FirstOrDefault(s => s.Employee_Id == query2.ID); if (check != null) { store = new store(); p_id = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString()); var query = store.SalesRepresentatives.FirstOrDefault(p => p.ID == p_id); var q = store.employee.FirstOrDefault(m => m.ID == query.Employee_Id); q.EmployeeName = MandobNametextBox1.Text.ToString(); q.Address = CustomerAddressTxt.Text.ToString(); q.Phone = CustomerPhoneTxt.Text.ToString(); store.SaveChanges(); bindGridView(); CustomerAddressTxt.Text = ""; CustomerPhoneTxt.Text = ""; MandobNametextBox1.Text = ""; } else { MessageBox.Show("هذا المندوب موجود بالفعل"); MandobNametextBox1.Text = ""; } }
/// <summary> /// 增加打印店 /// </summary> /// <returns></returns> public string addPrintStore() { store store = new store(); store.s_id = Request["s_id"]; store.sk_tel = Request["sk_tel"].ToString(); store.s_name = Request["s_name"].ToString(); store.s_school = Request["s_school"].ToString(); store.s_location = Request["s_location"].ToString(); store.s_machine = Convert.ToInt16(Request["s_machine"].ToString()); store.s_computer = Convert.ToInt16(Request["s_computer"].ToString()); store.s_worker = Convert.ToInt16(Request["s_worker"].ToString()); store.s_worktime = Request["s_worktime"].ToString(); store.s_runstate = Convert.ToInt16(Request["s_runstate"].ToString()); store.s_breifinfo = Request["s_breifinfo"].ToString(); store.s_sculpture = scul_extent; //图片头像,的扩展 store.s_photo = spho_extent; //图片实拍,的扩展 string or_id = bs.addPrintStore(store); if (or_id != "0" && or_id != "1" && or_id != "2") { changelocation(or_id); } //添加成功则改变图片位置 return(or_id); }
private void TXT_customerSearch_TextChanged(object sender, EventArgs e) { store = new store(); var query = (from s in store.SalesRepresentatives from m in store.employee where (s.Employee_Id == m.ID && s.status == false && m.EmployeeName.Contains(TXT_customerSearch.Text)) select new { s, m } ).ToList(); if (query.Count != 0) { DGV_Customer.RowCount = query.Count; int i = 0; foreach (var item in query) { DGV_Customer.Rows[i].Cells[0].Value = item.s.ID.ToString(); DGV_Customer.Rows[i].Cells[1].Value = item.m.EmployeeName.ToString(); DGV_Customer.Rows[i].Cells[2].Value = item.m.Phone.ToString(); DGV_Customer.Rows[i].Cells[3].Value = item.m.Address; i++; } } else { DGV_Customer.Rows.Clear(); } }
public void bindGridView() { bt_addCustomer.Show(); BtupdateCustomer.Hide(); DGV_Customer.Rows.Clear(); store = new store(); var query = (from s in store.SalesRepresentatives from m in store.employee where (s.Employee_Id == m.ID && s.status == false) select new { m, s } ).ToList(); if (query.Count != 0) { DGV_Customer.RowCount = query.Count; int i = 0; foreach (var item in query) { DGV_Customer.Rows[i].Cells[0].Value = item.s.ID.ToString(); DGV_Customer.Rows[i].Cells[1].Value = item.m.EmployeeName.ToString(); DGV_Customer.Rows[i].Cells[2].Value = item.m.Phone.ToString(); DGV_Customer.Rows[i].Cells[3].Value = item.m.Address; i++; } } DGV_Customer.Refresh(); DGV_Customer.Update(); }
private void textBox1_TextChanged(object sender, EventArgs e) { // text changed store = new store(); var query = store.employee.Where(p => p.Status == false && p.EmployeeName.Contains(textBox1.Text)).ToList(); if (query.Count != 0) { DGV_EmployeeHome.RowCount = query.Count; int i = 0; foreach (var item in query) { DGV_EmployeeHome.Rows[i].Cells[4].Value = item.ID.ToString(); DGV_EmployeeHome.Rows[i].Cells[3].Value = item.EmployeeName.ToString(); DGV_EmployeeHome.Rows[i].Cells[1].Value = item.Salary.ToString(); DGV_EmployeeHome.Rows[i].Cells[2].Value = item.Phone.ToString(); DGV_EmployeeHome.Rows[i].Cells[0].Value = item.Address; i++; } } else { DGV_EmployeeHome.Rows.Clear(); } }
public async Task StoreAsync() { IUserMessage responce = await ReplyAsync("Getting store..."); string data = Program.ShopRequest("dev_account_username", "dev_account_password"); if (data == "nullerror") { await responce.DeleteAsync(); await ReplyAsync("Invalid credentials"); } else { store storeobj = JsonConvert.DeserializeObject <store>(data); string json = GetRequest("https://valorant-api.com/v1/bundles/" + storeobj.FeaturedBundle.Bundle.DataAssetID); BundleRoot bundle = JsonConvert.DeserializeObject <BundleRoot>(json); if (!File.Exists(bundle.data.uuid + ".png")) { using (var client = new WebClient()) { client.DownloadFile(new Uri(bundle.data.displayIcon), bundle.data.uuid + ".png"); } } TimeSpan t = TimeSpan.FromSeconds(storeobj.FeaturedBundle.BundleRemainingDurationInSeconds); string timeLeft = string.Format("{0:D2} days, {1:D2} hours, {2:D2} minutes, and {3:D2} seconds.", t.Days, t.Hours, t.Minutes, t.Seconds); await responce.DeleteAsync(); await ReplyAsync("Right now, the " + bundle.data.displayName + " bundle is in the shop. The bundle will be in the shop for " + timeLeft); await responce.Channel.SendFileAsync(bundle.data.uuid + ".png"); } }
// GET: StoresMain/Details/5 public ActionResult Details(int id) { store storee = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:54964/api/StoresApi"); //HTTP GET var responseTask = client.GetAsync("StoresApi?id=" + id.ToString()); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <store>(); readTask.Wait(); storee = readTask.Result; } else //web api sent error response { //log response status here.. ModelState.AddModelError(string.Empty, "Server error. Please contact administrator."); } } return(View(storee)); }
private static dicDataDeployments CreateDicDataDeployments() { dicDataDeployments ddds = new dicDataDeployments(); ddds.version = Data.version; ddds.ListdicDataDeployment = new List <dicDataDeployment>(); dicDataDeployment ddd = new dicDataDeployment(); ddd.descriptionFile = Constants.descriptionFile; ddd.archiveFile = Data.PathToZip; ddd.activationTimeStamp = DateTime.UtcNow.ToLocalTime().ToString(); ddd.localDownloadTimeStamp = DateTime.UtcNow.ToLocalTime().ToString(); ddd.centralDownloadTimeStamp = DateTime.UtcNow.ToLocalTime().ToString(); ddd.destinations = new List <destination>(); destination dest = new destination(); dest.source = "destinations"; dest.name = Data.PathToZip; dest.stores = new List <store>(); dest.systemGroups = new List <string>(); store objStore = new store(); objStore.name = Data.storeDetails; dest.stores.Add(objStore); ddd.destinations.Add(dest); ddds.ListdicDataDeployment.Add(ddd); return(ddds); }
private void BtupdateCustomer_Click(object sender, EventArgs e) { if (CustomerNameTxt.Text == null || CustomerAddressTxt.Text == null || CustomerPhoneTxt.Text == null || CustomerTypecomboBox.SelectedItem == null) { MessageBox.Show("يجب ان تدخل كل البيانات"); } else { store = new store(); p_id = int.Parse(DGV_Customer.SelectedRows[0].Cells[0].Value.ToString()); var query = store.customers.FirstOrDefault(p => p.ID == p_id); query.Name = CustomerNameTxt.Text.ToString(); query.addrees = CustomerAddressTxt.Text.ToString(); query.Phone = CustomerPhoneTxt.Text.ToString(); query.type = CustomerTypecomboBox.SelectedItem.ToString(); store.SaveChanges(); MessageBox.Show("تم التعديل بنجاح"); CustomerNameTxt.Text = ""; CustomerAddressTxt.Text = ""; CustomerPhoneTxt.Text = ""; bindGridView(); } }
private void TXT_customerSearch_TextChanged(object sender, EventArgs e) { store = new store(); var query = store.customers.Where(p => p.Status == false && p.Name.Contains(TXT_customerSearch.Text)).ToList(); if (query.Count != 0) { DGV_Customer.RowCount = query.Count; int i = 0; foreach (var item in query) { DGV_Customer.Rows[i].Cells[0].Value = item.ID.ToString(); DGV_Customer.Rows[i].Cells[1].Value = item.Name.ToString(); DGV_Customer.Rows[i].Cells[2].Value = item.Phone.ToString(); // DGV_Customer.Rows[i].Cells[3].Value = item.a.ToString(); DGV_Customer.Rows[i].Cells[3].Value = item.addrees; i++; } } else { DGV_Customer.Rows.Clear(); } }
public ApiMessage <string> Save(instore model) { var api = new ApiMessage <string>(); model.UnitName = model.UnitID; model.ID = Guid.NewGuid().ToString(); using (var scope = new PetaPoco.Transaction(_db)) { var sModel = _db.FirstOrDefault <store>("where ProductID=@ProductID AND UnitID=@UnitID", model); if (sModel == null) { sModel = new store(); sModel.Amount = model.Amount; sModel.ProductID = model.ProductID; sModel.ProductName = model.ProductName; sModel.UnitID = model.UnitID; sModel.UnitName = model.UnitID; sModel.UpdateDate = DateTime.Now; sModel.CreateDate = DateTime.Now; sModel.ID = Guid.NewGuid().ToString(); sModel.OutAmount = 0; sModel.OutAmount = 0; _db.Insert(sModel); } else { sModel.Amount = sModel.Amount + model.Amount; _db.Update(sModel); } _db.Insert(model); scope.Complete(); } return(api); }
public IHttpActionResult Poststore(StoreDto storeDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } store store = new store(); store.id = storeDto.id; store.name = storeDto.name; store.location = storeDto.location; store.status_id = storeDto.status.id; db.stores.Add(store); try { db.SaveChanges(); } catch (DbUpdateException) { if (storeExists(store.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = store.id }, store)); }
public ActionResult Create([Bind(Include = "Id,Picture,Name,Location,Description,Likes,Dislikes,Visitors_Frequency,Profit_Yearly,Number_of_stores,Added_by,Created_Date,Modified_Date,Pic_Courtesy_of")] store store) { if (store.Picture == null) { store.Picture = "https://upload.wikimedia.org/wikipedia/commons/e/e3/Wako1000.jpg"; } if (store.Pic_Courtesy_of == null) { store.Pic_Courtesy_of = "Source not known"; } DateTime dateNow = DateTime.UtcNow; store.Created_Date = dateNow; store.Modified_Date = dateNow; int?currentLikes = 0; store.Likes = currentLikes; store.Dislikes = currentLikes; if (ModelState.IsValid) { db.stores.Add(store); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(store)); }
/// <summary> /// 编辑打印店信息,打印店名称不能修改且唯一 /// </summary> /// <returns></returns> public int SaveChange() { store store = new store(); store.s_id = Request["s_id"]; store.sk_tel = Request["sk_tel"].ToString(); store.s_name = Request["s_name"].ToString(); store.s_school = Request["s_school"].ToString(); store.s_location = Request["s_location"].ToString(); store.s_machine = Convert.ToInt16(Request["s_machine"].ToString()); store.s_computer = Convert.ToInt16(Request["s_computer"].ToString()); store.s_worker = Convert.ToInt16(Request["s_worker"].ToString()); store.s_worktime = Request["s_worktime"].ToString(); store.s_runstate = Convert.ToInt16(Request["s_runstate"].ToString()); store.s_breifinfo = Request["s_breifinfo"].ToString(); store.s_carry = Convert.ToBoolean(Request["s_carry"]); store.s_carryterm = Convert.ToInt32(Request["s_carryterm"]); store.s_carryadd = Convert.ToInt32(Request["s_carryadd"]); if (scul_extent != "") { store.s_sculpture = scul_extent; } //图片头像,的扩展 if (spho_extent != "") { store.s_photo = spho_extent; } //图片实拍,的扩展 changelocation(store.s_id); //改变图片位置 return(bs.editshop(store)); }
public int editshop(store shop) { string sql = ""; if (shop.s_sculpture != null && shop.s_photo != null) { sql = "update store set sk_tel='" + shop.sk_tel + "',s_worker='" + shop.s_worker + "',s_school='" + shop.s_school + "'," + "s_location='" + shop.s_location + "',s_machine='" + shop.s_machine + "',s_breifinfo='" + shop.s_breifinfo + "'" + ",s_computer='" + shop.s_computer + "',s_worktime='" + shop.s_worktime + "',s_runstate='" + shop.s_runstate + "' ," + "s_carry=" + shop.s_carry + ",s_carryterm=" + shop.s_carryterm + ",s_carryadd=" + shop.s_carryadd + ",s_sculpture='" + shop.s_id + shop.s_sculpture + "',s_photo='" + shop.s_id + shop.s_photo + "' where s_id='" + shop.s_id + "' "; } else if (shop.s_sculpture == null && shop.s_photo != null) { sql = "update store set sk_tel='" + shop.sk_tel + "',s_worker='" + shop.s_worker + "',s_school='" + shop.s_school + "'," + "s_location='" + shop.s_location + "',s_machine='" + shop.s_machine + "',s_breifinfo='" + shop.s_breifinfo + "'" + ",s_computer='" + shop.s_computer + "',s_worktime='" + shop.s_worktime + "',s_runstate='" + shop.s_runstate + "' ," + "s_carry=" + shop.s_carry + ",s_carryterm=" + shop.s_carryterm + ",s_carryadd=" + shop.s_carryadd + ",s_photo='" + shop.s_id + shop.s_photo + "' where s_id='" + shop.s_id + "' "; } else if (shop.s_sculpture != null && shop.s_photo == null) { sql = "update store set sk_tel='" + shop.sk_tel + "',s_worker='" + shop.s_worker + "',s_school='" + shop.s_school + "'," + "s_location='" + shop.s_location + "',s_machine='" + shop.s_machine + "',s_breifinfo='" + shop.s_breifinfo + "'" + ",s_computer='" + shop.s_computer + "',s_worktime='" + shop.s_worktime + "',s_runstate='" + shop.s_runstate + "' ," + "s_carry=" + shop.s_carry + ",s_carryterm=" + shop.s_carryterm + ",s_carryadd=" + shop.s_carryadd + ",s_sculpture='" + shop.s_id + shop.s_sculpture + "' where s_id='" + shop.s_id + "' "; } else { sql = "update store set sk_tel='" + shop.sk_tel + "',s_worker='" + shop.s_worker + "',s_school='" + shop.s_school + "'," + "s_location='" + shop.s_location + "',s_machine='" + shop.s_machine + "',s_breifinfo='" + shop.s_breifinfo + "'" + ",s_computer='" + shop.s_computer + "',s_worktime='" + shop.s_worktime + "',s_runstate='" + shop.s_runstate + "' ," + "s_carry=" + shop.s_carry + ",s_carryterm=" + shop.s_carryterm + ",s_carryadd=" + shop.s_carryadd + " where s_id='" + shop.s_id + "' "; } return(mysqlDBhelper.dochangesql(sql)); }
public void bindGridView() { // Btn_SaveEmp.Show(); UpdateBtnEmployee.Hide(); DGV_EmployeeHome.DataSource = null; DGV_EmployeeHome.Refresh(); store = new store(); var query = store.employee.Where(p => p.Status == false).ToList(); DGV_EmployeeHome.RowCount = query.Count; if (query.Count != 0) { DGV_EmployeeHome.RowCount = query.Count; int i = 0; foreach (var item in query) { DGV_EmployeeHome.Rows[i].Cells[4].Value = item.ID.ToString(); DGV_EmployeeHome.Rows[i].Cells[3].Value = item.EmployeeName.ToString(); DGV_EmployeeHome.Rows[i].Cells[1].Value = item.Salary.ToString(); DGV_EmployeeHome.Rows[i].Cells[2].Value = item.Phone.ToString(); DGV_EmployeeHome.Rows[i].Cells[0].Value = item.Address; i++; } } }
static void Main(string[] args) { string text = System.IO.File.ReadAllText(@"C:\Users\Marishka\Desktop\товары.txt"); string[] hollow = text.Split(new char[] { '\r', '\t', '\n' }); List <string> arr = new List <string>(); for (int i = 0; i < hollow.Length; i++) { if (hollow[i] != "") { arr.Add(hollow[i]); } } store[] goods = new store[5]; int count = 0; for (int i = 0; i < goods.Length; i++) { goods[i].name = arr[count]; count++; goods[i].kolichestvo = Convert.ToInt32(arr[count]); count++; goods[i].price = Convert.ToInt32(arr[count]); count++; goods[i].fabricate = arr[count]; count++; goods[i].date = Convert.ToDateTime(arr[count]); count++; } for (int i = 0; i < goods.Length; i++) { if (goods[i].kolichestvo >= 5) { Console.WriteLine(goods[i].name + "\t" + goods[i].kolichestvo + "\t" + goods[i].price + "\t" + goods[i].fabricate + "\t" + goods[i].date); } } DateTime max = DateTime.MinValue; count = 0; for (int i = 0; i < goods.Length; i++) { if (goods[i].date > max) { max = goods[i].date; count = i; } } Console.WriteLine(); Console.WriteLine("Мах дата: {0}", goods[count].name + "\t" + goods[count].kolichestvo + "\t" + goods[count].price + "\t" + goods[count].fabricate + "\t" + goods[count].date); Console.ReadKey(); }
private void button1_Click(object sender, EventArgs e) { if (textBox6.Text != "") { if (textBox13.Text != "") { if (textBox4.Text != "") { int storeStock = Convert.ToInt32(textBox11.Text); int dispStock = Convert.ToInt32(textBox12.Text); int quantity = Convert.ToInt32(textBox13.Text); store st = new store(); st.receiveStock(storeStock, dispStock, quantity, textBox6.Text, textBox4.Text, username); loadMedicines(); textBox5.Text = ""; clearData(); } else { MessageBox.Show("Please enter Bill No.!!"); } } else { MessageBox.Show("Please enter the amount of Stock Purchased!!"); } } else { MessageBox.Show("Please Select a Medicine!!"); } }
//CREATE customer public JsonResult CreateStore(store store) { if (ModelState.IsValid) { _context.Stores.Add(store); _context.SaveChanges(); return(new JsonResult { Data = "Sucess", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } else { //Console.Write(e.Data + "Exception Occured"); var modelErrors = new List <string>(); foreach (var modelState in ModelState.Values) { foreach (var modelError in modelState.Errors) { modelErrors.Add(modelError.ErrorMessage); } } return(new JsonResult { Data = modelErrors, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
// POST: odata/store public async Task <IHttpActionResult> Post(store store) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.store.Add(store); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (storeExists(store.IdStore)) { return(Conflict()); } else { throw; } } return(Created(store)); }
// GET: store/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } store store = await db.store.FindAsync(id); if (store == null) { return(HttpNotFound()); } if (store.Latitude != null) { ViewBag.Latitude = store.Latitude.ToString().Replace(",", "."); } if (store.Longitude != null) { ViewBag.Longitude = store.Longitude.ToString().Replace(",", "."); } GetStates(store); GetCompanies(store); GetCategories(store); return(View(store)); }
public IHttpActionResult Putstore(int id, store store) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != store.store_id) { return(BadRequest()); } db.Entry(store).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!storeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Poststore([FromBody] store store) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } else { storeRepository_.Save(store); //var result = _context.stores.Add(store); //await _context.SaveChangesAsync(); return(Ok(store)); } } catch (Exception exM) { Console.WriteLine(exM.Message); throw; } // _context.stores.Add(store); //await _context.SaveChangesAsync(); //return CreatedAtAction("Getstore", new { id = store.idS }, store); }
public StoreDto getStoreDto(String id) { store store = db.stores.Where(s => s.id == id).FirstOrDefault(); StoreDto storeDto = new StoreDto(store.id, store.name, store.location, statusRepository.getStatus(store.status_id)); return(storeDto); }
public async Task <IActionResult> Putstore([FromRoute] string id, [FromBody] store store) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != store.idS) { return(BadRequest()); } _context.Entry(store).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!storeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Create([Bind(Include = "stor_id,stor_name,stor_address,city,state,zip")] store store) { if (ModelState.IsValid) { var test = db.stores.Find(store.stor_id); //find if stor_id (prim key's) already exists if (test == null) { db.stores.Add(store); try { db.SaveChanges(); } catch (Exception e) { return(RedirectToAction("../Home/Error")); } } else { return(RedirectToAction("../Home/Error")); } return(RedirectToAction("Index")); } return(View(store)); }
void CreateManager(XmlNode StoreNode, store storeobj) { // Created New Manger from Manager Prefab GameObject NewManager = (GameObject)Instantiate(ManagerPrefab); // Update name of Manager to Store Name Text ManagerNameText = NewManager.transform.Find("ManagerNameText").GetComponent <Text>(); ManagerNameText.text = storeobj.StoreName; // Update Manager Cost from XML to Store Object storeobj.ManagerCost = float.Parse(StoreNode.InnerText); // Get Manager Button Component and link with UIStore Object Button ManagerButton = NewManager.transform.Find("UnlockManagerButton").GetComponent <Button>(); UIStore UIManager = storeobj.GetComponent <UIStore>(); UIManager.ManagerButton = ManagerButton; // Uppdate Text in Manager Button with Manager Cost Text ManagerButtonText = ManagerButton.transform.Find("UnlockManagerButtonText").GetComponent <Text>(); ManagerButtonText.text = "Unlock " + storeobj.ManagerCost.ToString("C2"); // Add listner to Manager Button ManagerButton.onClick.AddListener(storeobj.UnlockManager); NewManager.transform.SetParent(ManagerPanel.transform); }
/// <summary> /// 添加打印店,先检测是否存在,再在打印店表和,所有用户记录表中添加 /// </summary> /// <param name="shop"></param> /// <returns></returns> public int addPrintStore(store shop) { string sql0 = "select s_id from store where s_name='" + shop.s_name + "'";//查询打印店表中是否有 相同打印店名称 if (mysqlDBhelper.doselectsqlReturnNum(sql0) == 0) { string s_id = ""; int check = 0; do { s_id = productId(); string sql1 = "select s_name from store where s_id='" + s_id + "'"; check = mysqlDBhelper.doselectsqlReturnNum(sql1); } while (check != 0); //插入行细信息 string sql = "insert into store(s_id,sk_tel,s_name,s_worker,s_school,s_location,s_machine,s_breifinfo,s_sculpture,s_computer,s_worktime,s_runstate)" + "values('" + s_id + "','" + shop.sk_tel + "','" + shop.s_name + "','" + shop.s_worker + "','" + shop.s_school + "'," + "'" + shop.s_location + "','" + shop.s_machine + "','" + shop.s_breifinfo + "','" + shop.s_sculpture + "'" + ",'" + shop.s_computer + "','" + shop.s_worktime + "','" + shop.s_runstate + "')"; return(mysqlDBhelper.dochangesql(sql)); } else { return(-1); } }
private void InsertCategoriesFromStore(List <string> categories, store store) { IQueryable <storeCategory> sc; foreach (var category in db.storeCategory.Where(scs => scs.IdStore == store.IdStore)) { category.DeletionDatetime = DateTime.Now; } // TERMINAR LA INSERCIÓN. foreach (var category in categories) { if (category.Contains("C-")) { //is a category int id = Convert.ToInt32(category.Split(new char[] { 'C', '-' })[2]); sc = db.storeCategory.Where(scs => scs.IdCategory == id && scs.IdStore == store.IdStore); if (sc.Count() == 0) { db.storeCategory.Add(new storeCategory() { IdStore = store.IdStore, IdCategory = Convert.ToInt32(id) }); } else { sc.FirstOrDefault().DeletionDatetime = null; } } else { //is a subcategory int id = Convert.ToInt32(category.Split(new char[] { 'S', '-' })[2]); sc = db.storeCategory.Where(scs => scs.IdCategory == id && scs.IdStore == store.IdStore); if (sc.Count() == 0) { db.storeCategory.Add(new storeCategory() { IdStore = store.IdStore, IdSubCategory = Convert.ToInt32(id) }); } else { sc.FirstOrDefault().DeletionDatetime = null; } } } try { db.SaveChanges(); } catch (Exception e) { } }
/// <summary> /// 创建新的 store 对象。 /// </summary> /// <param name="store_id">store_id 的初始值。</param> /// <param name="store_code">store_code 的初始值。</param> /// <param name="store_name">store_name 的初始值。</param> public static store Createstore(int store_id, string store_code, string store_name) { store store = new store(); store.store_id = store_id; store.store_code = store_code; store.store_name = store_name; return store; }
/// <summary> /// 架构中不存在 store 的注释。 /// </summary> public void AddTostore(store store) { base.AddObject("store", store); }