/// <summary> /// 添加或修改合约交割月份 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { List <int> addID = new List <int>(); List <int> delID = new List <int>(); foreach (Control t in this.panelControl1.Controls) { if (t is DevExpress.XtraEditors.CheckEdit) { DevExpress.XtraEditors.CheckEdit checkEdit = (DevExpress.XtraEditors.CheckEdit)t; object obj = checkEdit.Tag; if (obj == null) { continue; } CheckTag ct = (CheckTag)checkEdit.Tag; int BreedClassID = m_BreedClassID; // if (checkEdit.Checked == true && ct.InitIsChecked == false) //对选中的复选框与数据库数据进行比对 if (checkEdit.Checked == true) { //执行添加 int monthid = ct.ID; QH_AgreementDeliveryMonth QHAgreementDeliveryMonth = FuturesManageCommon.GetQHAgreementDeliveryBreedClassID(BreedClassID, monthid); if (QHAgreementDeliveryMonth == null) { addID.Add(monthid); } } //if (checkEdit.Checked == false && ct.InitIsChecked == true) //对未选中的复选框与数据库数据进行比对 if (checkEdit.Checked == false) { //执行删除 int monthid = ct.ID; QH_AgreementDeliveryMonth QHAgreementDeliveryMonth = FuturesManageCommon.GetQHAgreementDeliveryBreedClassID(BreedClassID, monthid); if (QHAgreementDeliveryMonth != null) { delID.Add(monthid); } } } } //调用添加删除方法 m_Result = FuturesManageCommon.UpdateQHAgreementDeliveryMonth(addID, delID, m_BreedClassID); if (m_Result) { if (addID.Count > 0) //根据添加标识ID,显示不同提示信息并返回添加标识ID { ShowMessageBox.ShowInformation("添加成功!"); //AddFuturesTradeRulesUI addFuturesTradeRulesUi=new AddFuturesTradeRulesUI(); // addFuturesTradeRulesUi.MonthID = addID[0]; //m_MonthID = addID[0]; this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } //添加一种新的交易规则时,自动添加此品种的代码 FuturesManageCommon.QHCommdityCodeInit(m_BreedClassID); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-5871"; string errMsg = "添加或修改合约交割月份失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }