/// <summary> /// 确定按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (m_EditType == 1) { #region 添加操作 try { if ( FuturesManageCommon.ExistsSIFBail( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex) && FuturesManageCommon.ExistsSIFPosition( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的持仓限制和保证金已存在!"); return; } QH_SIFBail qH_SIFBail = new QH_SIFBail(); QH_SIFPosition qH_SIFPosition = new QH_SIFPosition(); if (!string.IsNullOrEmpty(this.txtUnilateralPositions.Text)) { if (InputTest.intTest(this.txtUnilateralPositions.Text)) { qH_SIFPosition.UnilateralPositions = Convert.ToInt32(this.txtUnilateralPositions.Text); } else { ShowMessageBox.ShowInformation("请输入数字且第一位数不能为0!"); return; } } else { //qH_SIFPosition.UnilateralPositions = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("请填单边持仓量!"); return; } if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { qH_SIFBail.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { qH_SIFBail.BreedClassID = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.txtBailScale.Text)) { if (InputTest.DecimalTest(this.txtBailScale.Text)) { qH_SIFBail.BailScale = Convert.ToDecimal(this.txtBailScale.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("请填写保证金!"); return; } if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { qH_SIFPosition.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { qH_SIFPosition.BreedClassID = AppGlobalVariable.INIT_INT; } m_Result = FuturesManageCommon.AddQHSIFPositionAndQHSIFBail(qH_SIFPosition, qH_SIFBail); if (m_Result) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QueryQHSIFPositionAndBail(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-6481"; string errMsg = "添加股指期货持仓限制和品种_股指期货_保证金失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } else if (m_EditType == 2) { #region 修改操作 try { this.cmbBreedClassID.Enabled = false; QH_SIFBail qH_SIFBail = new QH_SIFBail(); QH_SIFPosition qH_SIFPosition = new QH_SIFPosition(); if (m_BreedClassID == AppGlobalVariable.INIT_INT) { ShowMessageBox.ShowInformation("请选择更新数据!"); return; } //qH_FutureCosts.BreedClassID = m_BreedClassID; qH_SIFBail.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; qH_SIFPosition.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; if (!string.IsNullOrEmpty(this.txtUnilateralPositions.Text)) { if (InputTest.intTest(this.txtUnilateralPositions.Text)) { qH_SIFPosition.UnilateralPositions = Convert.ToInt32(this.txtUnilateralPositions.Text); } else { ShowMessageBox.ShowInformation("请输入数字且第一位数不能为0!"); return; } } else { // qH_SIFPosition.UnilateralPositions = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("请填单边持仓量!"); return; } if (!string.IsNullOrEmpty(this.txtBailScale.Text)) { if (InputTest.DecimalTest(this.txtBailScale.Text)) { qH_SIFBail.BailScale = Convert.ToDecimal(this.txtBailScale.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_SIFBail.BailScale = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("请填写保证金!"); return; } m_Result = FuturesManageCommon.UpdateQHSIFPositionAndQHSIFBail(qH_SIFPosition, qH_SIFBail); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.ClearAll(); } else { ShowMessageBox.ShowInformation("修改失败!"); } this.QueryQHSIFPositionAndBail(); } catch (Exception ex) { string errCode = "GL-6482"; string errMsg = "修改股指期货持仓限制和品种_股指期货_保证金失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } }