public ReturnType AddLogisticCompanyTemplateItem(LogisticCompanyTemplateItem logisticcompanytemplateitem) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { alading.AddToLogisticCompanyTemplateItem(logisticcompanytemplateitem); if (alading.SaveChanges() == 1) { return(ReturnType.Success); } else { return(ReturnType.PropertyExisted); } } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
private void simpleButton2_Click(object sender, EventArgs e) //新建标签 { if (mtItem.Text != string.Empty) { LabelControl lctemp = new LabelControl(); lc.Add(lctemp); int index = lc.Count - 1; lc[index].Text = mtItem.Text; lc[index].BringToFront(); lc[index].Visible = true; this.pictureBox2.Controls.Add(lctemp); lc[index].MouseDown += new MouseEventHandler(control_MouseDown); lc[index].MouseMove += new MouseEventHandler(control_MouseMove); lc[index].Location = new Point(this.pictureBox2.Width / 2, this.pictureBox2.Height / 2); LogisticCompanyTemplateItem temp = new LogisticCompanyTemplateItem(); temp.LogisticCompanyItemCode = System.Guid.NewGuid().ToString(); temp.LogisticCompanyTemplateCode = templateCode; temp.ItemName = mtItem.Text; temp.ItemValue = mtItem.Text; temp.ItemX = pictureBox2.Width / 2; temp.ItemY = pictureBox2.Height / 2; LogisticCompanyTemplateItemService.AddLogisticCompanyTemplateItem(temp); lcti.Clear(); lcti = LogisticCompanyTemplateItemService.GetLogisticTemplateItems(templateCode); mtItem.Text = string.Empty; } }
private void NewTemplateItems(string TemplateCode) { foreach (LabelControl x in lc) { LogisticCompanyTemplateItem lctItem = new LogisticCompanyTemplateItem(); lctItem.ItemName = x.Text; lctItem.ItemValue = x.Text; lctItem.LogisticCompanyItemCode = System.Guid.NewGuid().ToString(); lctItem.LogisticCompanyTemplateCode = TemplateCode; lctItem.ItemX = x.Location.X; lctItem.ItemY = x.Location.Y; LogisticCompanyTemplateItemService.AddLogisticCompanyTemplateItem(lctItem); } }
private void UpdateTemplateItems(string TemplateCode)//更新模板标签 { int count = 0; foreach (LabelControl x in lc) { LogisticCompanyTemplateItem lctItem = new LogisticCompanyTemplateItem(); lctItem.LogisticCompanyItemID = lcti[count].LogisticCompanyItemID; lctItem.ItemName = x.Text; lctItem.ItemValue = x.Text; lctItem.LogisticCompanyItemCode = lcti[count].LogisticCompanyItemCode; lctItem.LogisticCompanyTemplateCode = TemplateCode; lctItem.ItemX = x.Location.X; lctItem.ItemY = x.Location.Y; LogisticCompanyTemplateItemService.UpdateLogisticCompanyTemplateItem(lctItem); count++; } }
public ReturnType UpdateLogisticCompanyTemplateItem(LogisticCompanyTemplateItem logisticcompanytemplateitem) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { /*LogisticCompanyTemplateItem result = alading.LogisticCompanyTemplateItem.Where(p => p.LogisticCompanyTemplateItemID == logisticcompanytemplateitem.LogisticCompanyTemplateItemID).FirstOrDefault();*/ LogisticCompanyTemplateItem result = alading.LogisticCompanyTemplateItem.Where(p => p.LogisticCompanyItemCode == logisticcompanytemplateitem.LogisticCompanyItemCode).FirstOrDefault(); if (result == null) { return(ReturnType.NotExisted); } #region Using Attach() Function Update,Default USE; alading.Attach(result); alading.ApplyPropertyChanges("LogisticCompanyTemplateItem", logisticcompanytemplateitem); #endregion if (alading.SaveChanges() == 1) { return(ReturnType.Success); } else { return(ReturnType.OthersError); } } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
public ReturnType UpdateLogisticCompanyTemplateItem(string logisticcompanytemplateitemCode, LogisticCompanyTemplateItem logisticcompanytemplateitem) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { ///*var result = alading.LogisticCompanyTemplateItem.Where(p => p.LogisticCompanyTemplateItemID == logisticcompanytemplateitemID).ToList();*/ //var result = alading.LogisticCompanyTemplateItem.Where(p => p.LogisticCompanyTemplateItemCode == logisticcompanytemplateitemCode).ToList(); //if (result.Count == 0) //{ // return ReturnType.NotExisted; //} //LogisticCompanyTemplateItem ob = result.First(); //ob.LogisticCompanyItemCode = logisticcompanytemplateitem.LogisticCompanyItemCode; //ob.LogisticCompanyTemplateCode = logisticcompanytemplateitem.LogisticCompanyTemplateCode; //ob.ItemName = logisticcompanytemplateitem.ItemName; //ob.ItemValue = logisticcompanytemplateitem.ItemValue; //ob.ItemX = logisticcompanytemplateitem.ItemX; //ob.ItemY = logisticcompanytemplateitem.ItemY; //if (alading.SaveChanges() == 1) //{ // return ReturnType.Success; //} //else //{ // return ReturnType.OthersError; //} return(ReturnType.SaveFailed); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (System.Exception ex) { return(ReturnType.OthersError); } }
public static ReturnType UpdateLogisticCompanyTemplateItem(string logisticcompanytemplateitemCode, LogisticCompanyTemplateItem logisticcompanytemplateitem) { return(DataProviderClass.Instance().UpdateLogisticCompanyTemplateItem(logisticcompanytemplateitemCode, logisticcompanytemplateitem)); }
public static ReturnType AddLogisticCompanyTemplateItem(LogisticCompanyTemplateItem logisticcompanytemplateitem) { return(DataProviderClass.Instance().AddLogisticCompanyTemplateItem(logisticcompanytemplateitem)); }