private void deleteTemplate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)//删除 { if (gridView1.FocusedRowHandle >= 0) { string logisticCode = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "LogisticCompanyTemplateCode").ToString(); if (ReturnType.Success == LogisticCompanyTemplateItemService.RemoveLogisticCompanyTemplateItems(logisticCode)) { if (ReturnType.Success == LogisticCompanyTemplateService.RemoveLogisticCompanyTemplate(logisticCode)) { List <LogisticCompanyTemplate> listItem = LogisticCompanyTemplateService.GetAllLogisticCompanyTemplate(); gridControl1.DataSource = listItem; gridView1.BestFitColumns(); ClearPreviewBox(); XtraMessageBox.Show("模版删除成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { XtraMessageBox.Show("模板删除出错!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { XtraMessageBox.Show("模板标签出错!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
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 initLogisticCompany()//设置物流公司 { lc.Clear(); pictureBox2.Controls.Clear(); LogisticCompanyTemplate modifyTemplate = LogisticCompanyTemplateService.GetLogisticTemplate(templateCode); List <LogisticCompany> logCompany = LogisticCompanyService.GetAllLogisticCompany(); mtCompany.Properties.DataSource = logCompany; mtCompany.Properties.DisplayMember = "name"; mtCompany.Text = modifyTemplate.LogisticCompanyName; mtCompany.Properties.ValueMember = "code"; mtCompany.EditValue = modifyTemplate.LogisticCompanyCode; templateName = modifyTemplate.LogisticCompanyName; mtName.Text = modifyTemplate.LogisticCompanyName.ToString(); mtCover.SelectedIndexChanged -= new EventHandler(mtCover_SelectedIndexChanged); string coverArea = modifyTemplate.CoverAreaList; string[] x = coverArea.Split(','); foreach (string y in x) { int count = 0; foreach (CheckedListBoxItem c in mtCover.Items) { if (count >= 2) { if (y == c.Value.ToString()) { c.CheckState = CheckState.Checked; break; } } count++; } } mtCover.SelectedIndexChanged += new EventHandler(mtCover_SelectedIndexChanged); MemoryStream ms = new MemoryStream(modifyTemplate.PreviewImage); pictureBox2.Image = Image.FromStream(ms); lcti = LogisticCompanyTemplateItemService.GetLogisticTemplateItems(modifyTemplate.LogisticCompanyCode); //模版标签 foreach (LogisticCompanyTemplateItem l in lcti) { LabelControl lctemp = new LabelControl(); lctemp.Text = l.ItemName; lctemp.Location = new Point(l.ItemX, l.ItemY); lctemp.MouseDown += new MouseEventHandler(control_MouseDown); lctemp.MouseMove += new MouseEventHandler(control_MouseMove); pictureBox2.Controls.Add(lctemp); lc.Add(lctemp); } }
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++; } }
private void PreviewTemplate() { if (gridView1.FocusedRowHandle >= 0) { string logisticCode = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "LogisticCompanyTemplateCode").ToString(); LogisticCompanyTemplate lct = LogisticCompanyTemplateService.GetLogisticTemplate(logisticCode); List <LogisticCompanyTemplateItem> logTempItem = LogisticCompanyTemplateItemService.GetLogisticTemplateItems(lct.LogisticCompanyCode); MemoryStream ms = new MemoryStream(lct.PreviewImage); pictureBox1.Image = Image.FromStream(ms); pictureBox1.Controls.Clear(); foreach (LogisticCompanyTemplateItem l in logTempItem) { LabelControl lctemp = new LabelControl(); lctemp.Text = l.ItemName; lctemp.Location = new Point(l.ItemX, l.ItemY); pictureBox1.Controls.Add(lctemp); } } }