public AddCostumeColorForm(CostumeColor color = null, OperationEnum action = OperationEnum.Add) { InitializeComponent(); this.color = color; this.action = action; Initialize(); }
private void skinTextBoxID_Leave(object sender, EventArgs e) { CostumeColor listItem = GlobalCache.CostumeColorList?.Find(t => t.ID == skinTextBoxID.Text); if (listItem != null) { GlobalMessageBox.Show("编号已存在!"); skinTextBoxID.Text = string.Empty; skinTextBoxID.Focus(); } }
private void colorComboBox1_SelectionChangeCommitted(object sender, EventArgs e) { SkinComboBox combobox = sender as SkinComboBox; if (combobox.SelectedItem != null) { CostumeColor color = (CostumeColor)combobox.SelectedItem; if (color.ID != null) { AddColorToListView(color.Name); } } }
internal static void UpdateCostumeColor(CostumeColor item) { if (item == null) { return; } CostumeColor oldBrand = CommonGlobalCache.costumeColorList?.Find(b => b.ID == item.ID); if (oldBrand != null) { CommonGlobalCache.costumeColorList?.Remove(oldBrand); } CommonGlobalCache.costumeColorList?.Add(item); CommonGlobalCache.costumeColorList?.Sort(); }
private void skinLabelAdd_Click(object sender, EventArgs e) { try { // if (GlobalUtil.EngineUnconnectioned(this)) { return; } List <CostumeColor> list = (List <CostumeColor>) this.skinComboBox_Color.DataSource; AddCostumeColorComboBoxForm addForm = new AddCostumeColorComboBoxForm(); if (addForm.ShowDialog(this) == DialogResult.OK) { if (list == null) { list = new List <CostumeColor>(); } CostumeColor item = addForm.Result; CostumeColor listItem = list.Find(t => t.Name == item.Name || t.ID == item.ID); if (listItem == null) { InteractResult result = GlobalCache.CostumeColorList_OnChange(item); switch (result.ExeResult) { case ExeResult.Success: skinComboBox_Color.DataSource = null; list.Add(item); skinComboBox_Color.DisplayMember = "Name"; skinComboBox_Color.ValueMember = "ID"; skinComboBox_Color.DataSource = list; skinComboBox_Color.SelectedIndex = list.IndexOf(item); break; case ExeResult.Error: break; default: break; } } else { skinComboBox_Color.SelectedItem = listItem; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { } }
private void BuildPara() { string costumeID = string.IsNullOrEmpty(this.CostumeCurrentShopTextBox1.SkinTxt.Text.Trim()) ? null : this.CostumeCurrentShopTextBox1.SkinTxt.Text.Trim(); bool isOnlyShowHaveNegative = this.skinckbNoZeroStore.Checked; string curBrandStr = ValidateUtil.CheckEmptyValue(this.skinComboBox_Brand.SelectedValue); int curBrandID = 0; if (curBrandStr == null) { curBrandID = 0; } curBrandID = Convert.ToInt32(curBrandStr); string curPfCustomerID = ""; if (skinComboBoxSupplier.SelectedValue != null) { curPfCustomerID = ValidateUtil.CheckEmptyValue(skinComboBoxSupplier.SelectedValue); } else { if (skinComboBoxSupplier.Text != "" && skinComboBoxSupplier.Text != "所有") { GlobalMessageBox.Show("请输入正确的客户信息后再进行查询!"); this.skinComboBoxSupplier.Focus(); return; } } CostumeColor color = this.skinComboBox_Color.SelectedItem as CostumeColor; int year = (int)(this.skinComboBox_Year.SelectedValue); this.pagePara = new GetPfCustomerStorePagePara() { CostumeID = costumeID, BrandID = curBrandID, PfCustomerID = curPfCustomerID, PageIndex = 0, PageSize = int.MaxValue,// this.dataGridViewPagingSumCtrl.PageSize, ClassID = skinComboBoxBigClass.SelectedValue.ClassID, ColorName = color?.Name == CommonGlobalUtil.COMBOBOX_ALL ? null : color?.Name, Season = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue), SupplierID = ValidateUtil.CheckEmptyValue(supllierComboBox1.SelectedValue), Year = year, IsShowColor = skinCheckBoxShowColor.Checked, IsOnlyShowNotZero = isOnlyShowHaveNegative, }; }
public static InteractResult CostumeColorList_OnChange(CostumeColor item) { InteractResult result = GlobalCache.ServerProxy.InsertCostumeColor(item); switch (result.ExeResult) { case ExeResult.Success: GlobalCache.costumeColorList = GlobalCache.ServerProxy.GetCostumeColor(); break; case ExeResult.Error: break; default: break; } return(result); }
private void BaseButtonAdd_Click(object sender, EventArgs e) { List <CostumeColor> list = DataGridViewUtil.BindingListToList <CostumeColor>(dataGridView1.DataSource); AddCostumeColorForm AddBrand = new AddCostumeColorForm(); try { if (AddBrand.ShowDialog(this) == DialogResult.OK) { if (list == null) { list = new List <CostumeColor>(); } CostumeColor item = AddBrand.Result; list.Add(item); InteractResult result = GlobalCache.ServerProxy.InsertCostumeColor(item); if (GlobalUtil.EngineUnconnectioned(this)) { return; } switch (result.ExeResult) { case ExeResult.Success: RefreshPage(); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void DoExport() { try { List <CostumeColor> list = DataGridViewUtil.BindingListToList <CostumeColor>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { if (item.Name == "Column1" || item.Name == "Column3" || item.Name == "Column4") { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } List <CostumeColor> ExportList = new List <CostumeColor>(); foreach (CostumeColor cItem in list) { CostumeColor curBrand = new CostumeColor(); curBrand.Name = cItem.Name; curBrand.ID = cItem.ID; curBrand.FirstCharSpell = cItem.FirstCharSpell; ExportList.Add(curBrand); } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(ExportList), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void Edit(CostumeColor item) { List <CostumeColor> list = DataGridViewUtil.BindingListToList <CostumeColor>(dataGridView1.DataSource); AddCostumeColorForm AddBrand = new AddCostumeColorForm(item, OperationEnum.Edit); AddBrand.Text = "修改颜色"; try { if (AddBrand.ShowDialog(this) == DialogResult.OK) { item = AddBrand.Result; InteractResult result = GlobalCache.ServerProxy.UpdateCostumeColor(item); if (GlobalUtil.EngineUnconnectioned(this)) { return; } switch (result.ExeResult) { case ExeResult.Success: GlobalCache.UpdateCostumeColor(item); GlobalCache.LoadCostumeInfos(); baseButton1_Click(null, null); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
internal static InteractResult CostumeColor_OnInsert(CostumeColor item) { InteractResult result = GlobalCache.ServerProxy.InsertCostumeColor(item); switch (result.ExeResult) { case ExeResult.Success: if (GlobalCache.costumeColorList == null) { GlobalCache.costumeColorList = new List <CostumeColor>(); } GlobalCache.costumeColorList?.Add(item); break; case ExeResult.Error: break; default: break; } return(result); }
internal static InteractResult CostumeColor_OnRemove(string id) { InteractResult result = ServerProxy.DeleteCostumeColor(id); switch (result.ExeResult) { case ExeResult.Success: CostumeColor c = costumeColorList.Find(t => t.ID == id); if (c != null) { costumeColorList.Remove(c); } break; case ExeResult.Error: break; default: break; } return(result); }
private void BuildPara() { string costumeID = string.IsNullOrEmpty(this.CostumeCurrentShopTextBox1.SkinTxt.Text.Trim()) ? null : this.CostumeCurrentShopTextBox1.SkinTxt.Text.Trim(); bool isOnlyShowHaveNegative = this.skinCheckBox1.Checked; int year = (int)(this.skinComboBox_Year.SelectedValue); CostumeColor color = this.skinComboBox_Color.SelectedItem as CostumeColor; string BrandStr = ValidateUtil.CheckEmptyValue(this.skinComboBox_Brand.SelectedValue); int curBrandID = 0; if (BrandStr == null) { curBrandID = 0; } curBrandID = Convert.ToInt32(BrandStr); this.pagePara = new CostumeStoreListPagePara() { CostumeID = costumeID, ShopID = shopID, IsShowAllShop = (shopID == null), ClassID = skinComboBoxBigClass.SelectedValue.ClassID, // SubSmallClass= skinComboBoxBigClass.SelectedValue?.SubSmallClass, BrandID = curBrandID, Season = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue), SupplierID = ValidateUtil.CheckEmptyValue(skinComboBoxSupplier.SelectedValue), Year = year, PageIndex = 0, CostumeStoreType = (CostumeStoreType)this.skinComboBox_storeType.SelectedValue, PageSize = int.MaxValue,// this.dataGridViewPagingSumCtrl.PageSize, IsOnlyShowHaveNegative = isOnlyShowHaveNegative, IsOnlyShowNotZero = skinCheckBox2.Checked, IsSingleModel = false, IsChooseColor = skinCheckBoxShowColor.Checked, GetOtherShop = skinCheckBoxOtherShop.Checked, ColorName = color?.Name == CommonGlobalUtil.COMBOBOX_ALL ? null : color?.Name, Date = new Date(dateTimePicker_Start.Value), }; }
private void BaseButton1_Click(object sender, EventArgs e) { String id = this.skinTextBoxID.SkinTxt.Text.Trim(); String name = this.skinTextBoxName.SkinTxt.Text.Trim(); if (String.IsNullOrEmpty(id) || !ValidateUtil.CheckMoney(id)) { this.skinTextBoxID.Focus(); return; } else if (String.IsNullOrEmpty(name)) { this.skinTextBoxName.Focus(); return; } this.result = new CostumeColor() { ID = id, Name = name, FirstCharSpell = DisplayUtil.GetPYString(name) // SupplyDiscount = Decimal.ToByte(numericUpDownSupplyDiscount.Value) }; this.DialogResult = DialogResult.OK; }
/// <summary> /// 修改颜色 /// </summary> /// <param name="para"></param> /// <returns></returns> public UpdateResult UpdateCostumeColor(CostumeColor para) { byte[] response = this.engine.CustomizeOutter.Query(ManageInformationTypes.UpdateCostumeColor, SerializeHelper.ResultToSerialize(para)); return((UpdateResult)SerializeHelper.ByteArrayToInt(response)); }
private void BaseButtonSave_Click(object sender, EventArgs e) { try { item = GetEntity(); if (!Validate(item)) { return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (this.CurItem != null) { //线上商城原属性不替换 item.EmShowOnline = CurItem.EmShowOnline; item.EmOnlinePrice = CurItem.EmOnlinePrice; item.EmTitle = CurItem.EmTitle; item.EmThumbnail = CurItem.EmThumbnail == null ? string.Empty : CurItem.EmThumbnail; item.CreateTime = CurItem.CreateTime; item.SizeNames = CurItem.SizeNames; CostumeColor color = this.colorComboBox1.SelectedItem; List <string> colorList = CurItem.ColorList; if (colorList != null) { if (curStore.ColorName != color.Name) { colorList.Remove(curStore.ColorName); colorList.Add(color.Name); } } item.Colors = CommonGlobalUtil.GetColorFromGridView(colorList); short F = 0, XS = 0, S = 0, M = 0, L = 0, XL = 0, XL2 = 0, XL3 = 0, XL4 = 0, XL5 = 0, XL6 = 0; if (this.dataGridView2 != null && this.dataGridView2.Rows.Count > 0) { PfCustomerStore curStoreItem = this.dataGridView2.Rows[0].DataBoundItem as PfCustomerStore; if (curStoreItem != null) { F = curStoreItem.F; XS = curStoreItem.XS; S = curStoreItem.S; M = curStoreItem.M; L = curStoreItem.L; XL = curStoreItem.XL; XL2 = curStoreItem.XL2; XL3 = curStoreItem.XL3; XL4 = curStoreItem.XL4; XL5 = curStoreItem.XL5; XL6 = curStoreItem.XL6; customerID = curStoreItem.PfCustomerID; } } UpdateStartStoreCostumePara updateStorePara = new UpdateStartStoreCostumePara() { BrandID = item.BrandID, ClassID = item.ClassID, CostPrice = item.CostPrice, ID = item.ID, Name = item.Name, Price = item.Price, Remarks = item.Remarks, SalePrice = item.SalePrice, Season = item.Season, SizeGroupName = item.SizeGroupName, SizeNames = item.SizeNames, SupplierID = item.SupplierID, Year = item.Year, OldColorName = curStore.ColorName, NewColorName = color.Name, F = F, XS = XS, S = S, L = L, M = M, XL = XL, XL2 = XL2, XL3 = XL3, XL4 = XL4, XL5 = XL5, XL6 = XL6, //ShopID = curStore.PfCustomerID, IsPf = true, PfCustomerID = this.customerID, // PfCustomerID= Colors = item.Colors, }; InteractResult result = GlobalCache.ServerProxy.UpdateStartStoreCostume(updateStorePara); // InteractResult result = GlobalCache.ServerProxy.UpdateCostume(item); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("保存成功!"); // GlobalCache.CostumeList_OnChange(item); CurItem = item; this.Hide(); this.Close(); this.DialogResult = DialogResult.OK; break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } else { PfCustomerStore costumeStore = dataGridView2.Rows[0].DataBoundItem as PfCustomerStore; PfCustomerStore item = new PfCustomerStore(); ReflectionHelper.CopyProperty(costumeStore, item); item.CostumeID = skinTextBox_ID.Text; item.CostumeName = skinTextBox_Name.Text; item.Year = (int)(this.skinComboBox_Year.SelectedValue); item.Price = numericUpDown_Price.Value; // item.SalePrice = item.CostPrice = numericUpDownCostPrice.Value; item.ClassID = skinComboBoxBigClass.SelectedValue.ClassID; item.ClassCode = GetClassCode(item.ClassID); //线上商城原属性不替换 // item.BigClass = this.skinComboBoxBigClass.SelectedValue?.BigClass; // item.SmallClass = this.skinComboBoxBigClass.SelectedValue?.SmallClass; // item.SubSmallClass = this.skinComboBoxBigClass.SelectedValue?.SubSmallClass; if (this.skinComboBox_Brand.SelectedItem != null) { item.BrandID = this.skinComboBox_Brand.SelectedItem.AutoID; item.BrandName = this.skinComboBox_Brand.SelectedItem.Name; } item.Season = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue); item.SupplierID = skinComboBox_SupplierID.SelectedItem?.ID; item.SupplierName = skinComboBox_SupplierID.SelectedItem?.Name; item.ColorName = this.colorComboBox1.SelectedItem?.Name; item.CostumeColorID = this.colorComboBox1.SelectedItem.ID; // item.CostumeColorName = this.colorComboBox1.SelectedItem?.Name; List <CostumeStoreExcel> costumeStoreExcels = new List <CostumeStoreExcel>(); //item.SizeGroupName= selectSizeGroup.SelectedSizeNames if (selectSizeGroup != null && selectSizeGroup.SizeGroup != null) { item.SizeGroupName = selectSizeGroup.SizeGroup.SizeGroupName; item.SizeGroupShowName = selectSizeGroup.SizeGroup.ShowName; // item.SizeNames = selectSizeGroup.SelectedSizeNames; } PfCustomer pfCustomer = PfCustomerCache.GetPfCustomer(customerID); item.SalePrice = this.numericTextBoxSalePrice.Value; CostumeStoreExcel curCostumeStoreExcel = GetCostumeStoreExcel(item); curCostumeStoreExcel.CostumeColorName = item.ColorName; curCostumeStoreExcel.PfPrice = pfCustomer.PfDiscount * item.Price / 100; costumeStoreExcels.Add(curCostumeStoreExcel); CreatePfCostumeStore store = new CreatePfCostumeStore() { PfCustomerID = customerID, // Date = new CJBasic.Date(), CostumeStoreExcels = costumeStoreExcels, IsImport = true }; InteractResult result = GlobalCache.ServerProxy.InsertPfCostumeStores(store); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("新增成功!"); ResetAll(); this.Close(); SaveClick?.Invoke(item); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { List <CostumeColor> list = DataGridViewUtil.BindingListToList <CostumeColor>(dataGridView1.DataSource); CostumeColor item = (CostumeColor)list[e.RowIndex]; switch (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) { case "编辑": if (item.ID == "000") { GlobalMessageBox.Show("均色不能修改!"); return; } Edit(item); break; case "删除": if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (item.ID == "000") { GlobalMessageBox.Show("均色不能删除!"); return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } this.dataGridView1.DataSource = null; InteractResult result = GlobalCache.CostumeColor_OnRemove(item.ID); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: this.dataGridView1.DataSource = null; list.Remove(item); this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list); break; } this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list); break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void DoImport() { try { List <CostumeColor> emptyStore = new List <CostumeColor>(); List <CostumeColor> stores = new List <CostumeColor>(); List <CostumeColor> repeatItems = new List <CostumeColor>(); DataTable dt = NPOIHelper.FormatToDatatable(path, 0); for (int i = 1; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; int index = 0; CostumeColor store = new CostumeColor(); try { if (!CommonGlobalUtil.ImportValidate(row, 2)) { store.AutoCode = (i + 2); store.Name = CommonGlobalUtil.ConvertToString(row[index++]); store.ID = CommonGlobalUtil.ConvertToString(row[index++]); store.FirstCharSpell = DisplayUtil.GetPYString(store.Name); if (String.IsNullOrEmpty(store.Name)) { //必填项为空 emptyStore.Add(store); continue; } else { //判断是否重复款号/颜色 if (stores.Find(t => t.Name == store.Name) != null) { repeatItems.Add(store); continue; } stores.Add(store); } } } catch (Exception ex) { } } if (emptyStore.Count > 0) { String str = string.Empty; foreach (var item in emptyStore) { str += "第" + item.AutoCode + "行\r\n"; } ShowError("必填项没有填写,请补充完整!\r\n" + str); return; } if (repeatItems.Count > 0) { String str = string.Empty; foreach (var item in repeatItems) { str += "第" + item.AutoCode + "行" + "\r\n"; } ShowError("名称重复,系统已过滤,详见错误报告!\r\n" + str); // return; } if (stores != null && stores.Count > 0) { } else { ShowMessage("没有数据可以导入,请检查列表信息!"); return; } path = null; //檢查結果 InteractResult result = GlobalCache.ServerProxy.ImportCostumeColors(stores); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: RefreshPage(); ShowMessage("导入成功!"); break; default: break; } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void BaseButtonSaveAccount_Click(object sender, EventArgs e) { try { if (pfCustomer == null) { GlobalMessageBox.Show("款号不能为空!"); skinTextBoxID.Focus(); return; } else if (String.IsNullOrEmpty(skinTextBoxID.Text)) { GlobalMessageBox.Show("款号不能为空!"); skinTextBoxID.Focus(); return; } else if (skinTextBoxID.Text.Contains("#")) { GlobalMessageBox.Show("款号不能使用“#”!"); skinTextBoxID.Focus(); return; } else if (String.IsNullOrEmpty(skinTextBox_Name.Text)) { GlobalMessageBox.Show("商品名称不能为空!"); skinTextBox_Name.Focus(); return; } CostumeColor color = colorComboBox1.SelectedItem as CostumeColor; if (String.IsNullOrEmpty(color?.Name)) { GlobalMessageBox.Show("颜色不能为空!"); colorComboBox1.Focus(); return; } PfCustomerStore detail = addValue[0]; detail.ColorName = ValidateUtil.CheckEmptyValue(color?.Name); detail.CostumeID = skinTextBoxID.Text; detail.CostumeName = skinTextBox_Name.Text; detail.PfCustomerID = pfCustomer.ID; detail.PfCustomerName = pfCustomer.Name; detail.PfPrice = this.textBoxAmount.Value; //Shop shop = (Shop)skinComboBoxShopID.SelectedItem; //detail.ShopID = shop.ID; //detail.ShopName = shop.Name; //判断是否存在相同款号颜色,如果有则提示是否累加,确定就累加原来的,否的话则取消 if (curInboundDetailList.Exists(t => t.PfCustomerID == detail.PfCustomerID && t.CostumeID == detail.CostumeID && t.ColorName == detail.ColorName)) { PfCustomerStore existDetail = curInboundDetailList.Find(t => t.PfCustomerID == detail.PfCustomerID && t.CostumeID == detail.CostumeID && t.ColorName == detail.ColorName); dataGridViewPagingSumCtrl.ScrollToRowIndex(curInboundDetailList.IndexOf(existDetail)); if (GlobalMessageBox.Show("库存信息已存在,是否进行累加?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } existDetail.XS += detail.XS; existDetail.S += detail.S; existDetail.M += detail.M; existDetail.L += detail.L; existDetail.XL += detail.XL; existDetail.XL2 += detail.XL2; existDetail.XL3 += detail.XL3; existDetail.XL4 += detail.XL4; existDetail.XL5 += detail.XL5; existDetail.XL6 += detail.XL6; existDetail.F += detail.F; existDetail.PfPrice = detail.PfPrice; } else { curInboundDetailList.Add(detail); } ResetAll(); this.BindingInboundDetailSource(); HighlightCostume(detail); } catch (Exception ee) { GlobalUtil.ShowError(ee); } }
private void BaseButton1_Click(object sender, EventArgs e) { try { string name = skinTextBoxName.Text; string id = skinTextBoxID.Text; List <CostumeColor> costumeColor = GlobalCache.CostumeColorList; if (string.IsNullOrEmpty(id)) { GlobalMessageBox.Show("色号不能为空!"); this.skinTextBoxID.Focus(); return; } else if (string.IsNullOrEmpty(name)) { GlobalMessageBox.Show("名称不能为空!"); this.skinTextBoxName.Focus(); return; } else { if (this.color != null) { //编辑的时候,判断是否有重复ID。排除自己 List <CostumeColor> colorChecked = costumeColor.FindAll(t => t.ID == id); if (colorChecked != null && colorChecked.Count > 1) { GlobalMessageBox.Show("该色号已存在!"); this.skinTextBoxID.Focus(); return; } } else { CostumeColor colorChecked = costumeColor.Find(t => t.ID == id); if (colorChecked != null) { GlobalMessageBox.Show("该色号已存在!"); this.skinTextBoxID.Focus(); return; } } if (this.color != null) { //编辑的时候,判断是否有重复ID。排除自己 List <CostumeColor> colorChecked = costumeColor.FindAll(t => t.Name == name); if (colorChecked != null && colorChecked.Count > 1) { GlobalMessageBox.Show("名称已存在!"); this.skinTextBoxName.Focus(); return; } } else { CostumeColor colorChecked = costumeColor.Find(t => t.Name == name); if (colorChecked != null) { GlobalMessageBox.Show("名称已存在!"); this.skinTextBoxName.Focus(); return; } } } if (action == OperationEnum.Edit) { color.ID = id; color.Name = name; color.FirstCharSpell = DisplayUtil.GetPYString(name); } else { this.color = new CostumeColor() { ID = id, Name = name, FirstCharSpell = DisplayUtil.GetPYString(name), }; } this.DialogResult = DialogResult.OK; } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }