/// <summary> /// 检验有效申报取值上,下限的输入 /// </summary> /// <param name="strMess">提示信息</param> /// <returns></returns> private XH_ValidDeclareValue VeriyXHValidDeclareValue(ref string strMess) { strMess = string.Empty; try { XH_ValidDeclareValue xHValidDeclareVEntity = new XH_ValidDeclareValue(); if (!string.IsNullOrEmpty(txtUpperLimit.Text)) { if (InputTest.DecimalTest(this.txtUpperLimit.Text)) { xHValidDeclareVEntity.UpperLimit = Convert.ToDecimal(txtUpperLimit.Text); } else { //ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); strMess = "格式不正确(只能包含数字和小数点)!"; } } else { //ShowMessageBox.ShowInformation("上限不能为空!"); strMess = "上限不能为空!"; } if (!string.IsNullOrEmpty(txtLowerLimit.Text)) { if (InputTest.DecimalTest(this.txtLowerLimit.Text)) { xHValidDeclareVEntity.LowerLimit = Convert.ToDecimal(txtLowerLimit.Text); } else { // ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); strMess += "格式不正确(只能包含数字和小数点)!"; } } else { //ShowMessageBox.ShowInformation("下限不能为空!"); strMess += "下限不能为空!"; } return(xHValidDeclareVEntity); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); return(null); } }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { QH_SIFBail bail = new QH_SIFBail(); if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { bail.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { ShowMessageBox.ShowInformation("请选择品种!"); this.cmbBreedClassID.Focus(); return; } if (InputTest.DecimalTest(this.txtMinScale.Text)) { bail.BailScale = Convert.ToDecimal(this.txtMinScale.Text); } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtMinScale.Focus(); return; } bool result = FuturesManageCommon.AddQHCFMinScaleValue(bail); if (result) { ShowMessageBox.ShowInformation("添加成功!"); FireSaved(this, new EventArgs()); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-6402"; string errMsg = "设置商品期货_最低保证金比例失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }
/// <summary> /// 添加/修改现货涨跌幅和有效申报 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { var xHSpotHighLowValue = new XH_SpotHighLowValue(); var xHSpotHighLowControlType = new XH_SpotHighLowControlType(); var xHValidDeclareType = new XH_ValidDeclareType(); var xHValidDeclareValue = new XH_ValidDeclareValue(); //涨跌幅类型和有效申报类型 if (!string.IsNullOrEmpty(cmbHighLowTypeID.Text) && !string.IsNullOrEmpty(cmbValidDeclareTypeID.Text)) { xHSpotHighLowControlType.HighLowTypeID = ((UComboItem)cmbHighLowTypeID.SelectedItem).ValueIndex; switch (cmbHighLowTypeID.SelectedIndex) { case 0: //股票 if (!string.IsNullOrEmpty(txtHighLowValue1.Text)) { if (InputTest.DecimalTest(this.txtHighLowValue1.Text)) { xHSpotHighLowValue.StValue = Convert.ToDecimal(txtHighLowValue1.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("ST股票不能为空!"); return; } if (!string.IsNullOrEmpty(txtHighLowValue2.Text)) { if (InputTest.DecimalTest(this.txtHighLowValue2.Text)) { xHSpotHighLowValue.NormalValue = Convert.ToDecimal(txtHighLowValue2.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("正常股票不能为空!"); return; } break; case 1: //权证 if (!string.IsNullOrEmpty(txtHighLowValue1.Text)) { if (InputTest.DecimalTest(this.txtHighLowValue1.Text)) { xHSpotHighLowValue.RightHighLowScale = Convert.ToDecimal(txtHighLowValue1.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("权证涨跌幅不能为空!"); return; } break; case 2: //基金 if (!string.IsNullOrEmpty(txtHighLowValue1.Text)) { if (InputTest.DecimalTest(this.txtHighLowValue1.Text)) { xHSpotHighLowValue.FundYestClosePriceScale = Convert.ToDecimal(txtHighLowValue1.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("基金涨跌幅不能为空!"); return; } break; case 3: //债券(无涨跌幅限制) xHSpotHighLowValue.StValue = AppGlobalVariable.INIT_DECIMAL; xHSpotHighLowValue.NormalValue = AppGlobalVariable.INIT_DECIMAL; xHSpotHighLowValue.RightHighLowScale = AppGlobalVariable.INIT_DECIMAL; xHSpotHighLowValue.FundYestClosePriceScale = AppGlobalVariable.INIT_DECIMAL; break; } //有效申报 switch (cmbValidDeclareTypeID.SelectedIndex) { case 0: //最近成交价的上下百分比 if (!string.IsNullOrEmpty(cmbValidDeclareTypeID.Text)) { xHValidDeclareType.ValidDeclareTypeID = ((UComboItem)cmbValidDeclareTypeID.SelectedItem).ValueIndex; } else { xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT; } string mess = string.Empty; xHValidDeclareValue = VeriyXHValidDeclareValue(ref mess); if (!string.IsNullOrEmpty(mess)) { ShowMessageBox.ShowInformation(mess); return; } break; case 1: //不高于即时揭示的最低卖出价格的百分比且不低于即时揭示 if (!string.IsNullOrEmpty(cmbValidDeclareTypeID.Text)) { xHValidDeclareType.ValidDeclareTypeID = ((UComboItem)cmbValidDeclareTypeID.SelectedItem).ValueIndex; } else { xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT; } mess = string.Empty; xHValidDeclareValue = VeriyXHValidDeclareValue(ref mess); if (!string.IsNullOrEmpty(mess)) { ShowMessageBox.ShowInformation(mess); return; } break; case 2: //3: if (!string.IsNullOrEmpty(cmbValidDeclareTypeID.Text)) { xHValidDeclareType.ValidDeclareTypeID = ((UComboItem)cmbValidDeclareTypeID.SelectedItem).ValueIndex; } else { xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT; } mess = string.Empty; xHValidDeclareValue = VeriyXHValidDeclareValue(ref mess); if (!string.IsNullOrEmpty(mess)) { ShowMessageBox.ShowInformation(mess); return; } if (!string.IsNullOrEmpty(txtNewDayUpperLimit.Text)) { if (InputTest.DecimalTest(this.txtNewDayUpperLimit.Text)) { xHValidDeclareValue.NewDayUpperLimit = Convert.ToDecimal(txtNewDayUpperLimit.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("上市首日上限不能为空!"); return; } if (!string.IsNullOrEmpty(txtNewDayLowerLimit.Text)) { if (InputTest.DecimalTest(this.txtNewDayLowerLimit.Text)) { xHValidDeclareValue.NewDayLowerLimit = Convert.ToDecimal(txtNewDayLowerLimit.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("上市首日下限不能为空!"); return; } break; } if (HighLowUIEditType == (int)UITypes.EditTypeEnum.AddUI) { XH_AboutSpotHighLowEntity xhAboutSpotHighLowEntity = SpotManageCommon.AddXHSpotHighLowAndValidDecl(xHSpotHighLowControlType, xHSpotHighLowValue, xHValidDeclareType, xHValidDeclareValue); if (xhAboutSpotHighLowEntity != null) { BreedClassHighLowID = (int)xhAboutSpotHighLowEntity.BreedClassHighLowID; BreedClassValidID = (int)xhAboutSpotHighLowEntity.BreedClassValidID; ShowMessageBox.ShowInformation("添加成功!"); ClearAll(); DialogResult = DialogResult.OK; Close(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else if (HighLowUIEditType == (int)UITypes.EditTypeEnum.UpdateUI) { if (m_BreedClassHighLowID != AppGlobalVariable.INIT_INT) { xHSpotHighLowControlType.BreedClassHighLowID = m_BreedClassHighLowID; xHSpotHighLowValue.BreedClassHighLowID = m_BreedClassHighLowID; xHValidDeclareType.BreedClassValidID = m_BreedClassValidID; xHValidDeclareValue.BreedClassValidID = m_BreedClassValidID; } bool _UpResult = SpotManageCommon.UpdateXHSpotHighLowAndValidDecl(xHSpotHighLowControlType, xHSpotHighLowValue, xHValidDeclareType, xHValidDeclareValue); if (_UpResult) { ShowMessageBox.ShowInformation("修改成功!"); DialogResult = DialogResult.OK; Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } else { xHSpotHighLowControlType.HighLowTypeID = AppGlobalVariable.INIT_INT; xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT; return; } } catch (Exception ex) { string errCode = "GL-5042"; string errMsg = " 添加现货涨跌幅失败!"; var exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); } }
/// <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.ExistsFutureCosts( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的交易费用已存在!"); return; } QH_FutureCosts qH_FutureCosts = new QH_FutureCosts(); if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { qH_FutureCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { qH_FutureCosts.BreedClassID = AppGlobalVariable.INIT_INT; } qH_FutureCosts.CurrencyTypeID = ((UComboItem)this.cmbCurrencyTypeID.SelectedItem).ValueIndex; qH_FutureCosts.CostType = ((UComboItem)this.cmbCostType.SelectedItem).ValueIndex; //if (this.cmbCostType.SelectedIndex == (int)GTA.VTS.Common.CommonObject.Types.FutrueCostType.TradeUnitCharge - 1) //{ // if (!string.IsNullOrEmpty(this.txtCost.Text)) // { // if (InputTest.DecimalTest(this.txtCost.Text)) // { // qH_FutureCosts.TradeUnitCharge = Convert.ToDecimal(this.txtCost.Text); // } // else // { // ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); // return; // } // } // else // { // //qH_FutureCosts.TradeUnitCharge = AppGlobalVariable.INIT_DECIMAL; // ShowMessageBox.ShowInformation("请填写手续费!"); // return; // } //} //else //{ if (!string.IsNullOrEmpty(this.txtCost.Text)) { if (InputTest.DecimalTest(this.txtCost.Text)) { qH_FutureCosts.TurnoverRateOfServiceCharge = Convert.ToDecimal(this.txtCost.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_FutureCosts.TurnoverRateOfServiceCharge = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("请填写手续费!"); return; } //} m_Result = FuturesManageCommon.AddQHFutureCosts(qH_FutureCosts); if (m_Result) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QueryQHFutureCosts(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-6201"; string errMsg = "添加品种_期货_交易费用失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } else if (m_EditType == 2) { #region 修改操作 try { QH_FutureCosts qH_FutureCosts = new QH_FutureCosts(); if (m_BreedClassID == AppGlobalVariable.INIT_INT) { ShowMessageBox.ShowInformation("请选择更新数据!"); return; } this.cmbBreedClassID.Enabled = false; qH_FutureCosts.BreedClassID = m_BreedClassID; qH_FutureCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; qH_FutureCosts.CurrencyTypeID = ((UComboItem)this.cmbCurrencyTypeID.SelectedItem).ValueIndex; qH_FutureCosts.CostType = ((UComboItem)this.cmbCostType.SelectedItem).ValueIndex; //if (this.cmbCostType.SelectedIndex == (int)GTA.VTS.Common.CommonObject.Types.FutrueCostType.TradeUnitCharge - 1) //{ // if (!string.IsNullOrEmpty(this.txtCost.Text)) // { // if (InputTest.DecimalTest(this.txtCost.Text)) // { // qH_FutureCosts.TradeUnitCharge = Convert.ToDecimal(this.txtCost.Text); // } // else // { // ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); // return; // } // } // else // { // //qH_FutureCosts.TradeUnitCharge = AppGlobalVariable.INIT_DECIMAL; // ShowMessageBox.ShowInformation("请填写手续费!"); // return; // } //} //else //{ if (!string.IsNullOrEmpty(this.txtCost.Text)) { if (InputTest.DecimalTest(this.txtCost.Text)) { qH_FutureCosts.TurnoverRateOfServiceCharge = Convert.ToDecimal(this.txtCost.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_FutureCosts.TurnoverRateOfServiceCharge = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("请填写手续费!"); return; } //} m_Result = FuturesManageCommon.UpdateQHFutureCosts(qH_FutureCosts); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.cmbBreedClassID.Enabled = true; this.ClearAll(); m_BreedClassID = AppGlobalVariable.INIT_INT; } else { ShowMessageBox.ShowInformation("修改失败!"); } this.QueryQHFutureCosts(); } catch (Exception ex) { string errCode = "GL-6202"; string errMsg = "更新品种_期货_交易费用失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } }
/// <summary> /// 添加或修改(商品)期货持仓限制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { QH_PositionLimitValue qH_PositionLimitValue = new QH_PositionLimitValue(); if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { qH_PositionLimitValue.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { ShowMessageBox.ShowInformation("请选择品种!"); this.cmbBreedClassID.Focus(); return; } if (!string.IsNullOrEmpty(this.txtStart.Text) && !string.IsNullOrEmpty(this.txtEnds.Text)) { if (InputTest.zeroStartIntTest(this.txtStart.Text) && InputTest.intTest(this.txtEnds.Text)) { if (Convert.ToInt32(this.txtStart.Text) < Convert.ToInt32(this.txtEnds.Text)) { qH_PositionLimitValue.Start = Convert.ToInt32(this.txtStart.Text); } else { ShowMessageBox.ShowInformation("起始值不能大于或等于结束值!"); this.txtStart.Focus(); return; } if (Convert.ToInt32(this.txtEnds.Text) > Convert.ToInt32(this.txtStart.Text)) { qH_PositionLimitValue.Ends = Convert.ToInt32(this.txtEnds.Text); } else { ShowMessageBox.ShowInformation("结束值不能小于或等于起始值!"); this.txtEnds.Focus(); return; } } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtStart.Focus(); this.txtEnds.Focus(); return; } } else { if (string.IsNullOrEmpty(this.txtStart.Text) && string.IsNullOrEmpty(this.txtEnds.Text)) { ShowMessageBox.ShowInformation("范围值不能为空!"); this.txtStart.Focus(); return; } if (!string.IsNullOrEmpty(this.txtStart.Text)) { if (InputTest.zeroStartIntTest(this.txtStart.Text)) { qH_PositionLimitValue.Start = Convert.ToInt32(this.txtStart.Text); } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtStart.Focus(); return; } } if (!string.IsNullOrEmpty(this.txtEnds.Text)) { if (InputTest.intTest(this.txtEnds.Text)) { qH_PositionLimitValue.Ends = Convert.ToInt32(this.txtEnds.Text); } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtEnds.Focus(); return; } } } if (!string.IsNullOrEmpty(this.txtPositionValue.Text)) { if (InputTest.DecimalTest(this.txtPositionValue.Text)) { qH_PositionLimitValue.PositionValue = Convert.ToDecimal(this.txtPositionValue.Text); } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtPositionValue.Focus(); return; } } else { ShowMessageBox.ShowInformation("请输入持仓!"); this.txtPositionValue.Focus(); return; } if (!string.IsNullOrEmpty(this.cmbDeliveryMonthTypeID.Text)) { qH_PositionLimitValue.DeliveryMonthType = ((UComboItem)this.cmbDeliveryMonthTypeID.SelectedItem).ValueIndex; } else { qH_PositionLimitValue.DeliveryMonthType = AppGlobalVariable.INIT_INT; } if (checkBox2.Checked) { qH_PositionLimitValue.LowerLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes; } else { qH_PositionLimitValue.LowerLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No; } if (checkBox3.Checked) { qH_PositionLimitValue.UpperLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes; } else { qH_PositionLimitValue.UpperLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No; } if (!string.IsNullOrEmpty(this.cmbPositionBailTypeID.Text)) { qH_PositionLimitValue.PositionBailTypeID = ((UComboItem)this.cmbPositionBailTypeID.SelectedItem).ValueIndex; } if (radioButton1.Checked) { qH_PositionLimitValue.PositionValueTypeID = (int)GTA.VTS.Common.CommonObject.Types.QHPositionValueType.Positions; } if (radioButton2.Checked) { qH_PositionLimitValue.PositionValueTypeID = (int)GTA.VTS.Common.CommonObject.Types.QHPositionValueType.Scales; } //if (!string.IsNullOrEmpty(this.cmbPositionValueTypeID.Text)) //{ // qH_PositionLimitValue.PositionValueTypeID = ((UComboItem)this.cmbPositionValueTypeID.SelectedItem).ValueIndex; //} //else //{ // qH_PositionLimitValue.PositionValueTypeID = AppGlobalVariable.INIT_INT; //} //if (!string.IsNullOrEmpty(this.cmbPositionLimitType.Text)) //{ // qH_PositionLimitValue.PositionLimitType = ((UComboItem)this.cmbPositionLimitType.SelectedItem).ValueIndex; //} if (checkBox1.Checked) { int minUnit; int.TryParse(txtMinUnit.Text, out minUnit); if (string.IsNullOrEmpty(txtMinUnit.Text) || minUnit == 0) { ShowMessageBox.ShowInformation("请输入最小交割单位!"); this.txtMinUnit.Focus(); return; } qH_PositionLimitValue.MinUnitLimit = Convert.ToInt32(txtMinUnit.Text); } else { qH_PositionLimitValue.MinUnitLimit = null; } if (EditType == (int)UITypes.EditTypeEnum.AddUI) { int result = FuturesManageCommon.AddQHPositionLimitValue(qH_PositionLimitValue); if (result != AppGlobalVariable.INIT_INT) { FireSaved(this, new EventArgs()); ShowMessageBox.ShowInformation("添加成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { if (m_PositionLimitValueID != AppGlobalVariable.INIT_INT) { qH_PositionLimitValue.PositionLimitValueID = m_PositionLimitValueID; } m_Result = FuturesManageCommon.UpdateQHPositionLimitValue(qH_PositionLimitValue); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-6422"; string errMsg = "添加或修改(商品)期货持仓限制失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }
/// <summary> /// 添加或修改现货交易规则 btnOK_Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { if (EditType == (int)UITypes.EditTypeEnum.AddUI) { if ( SpotManageCommon.ExistsSpotTradeRules( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的交易规则已存在!"); return; } } XH_SpotTradeRules xH_SpotTradeRules = new XH_SpotTradeRules(); if (XHSpotTradeRules != null) { ManagementCenter.Model.CommonClass.UtilityClass.CopyEntityToEntity(XHSpotTradeRules, xH_SpotTradeRules); } if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { xH_SpotTradeRules.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { xH_SpotTradeRules.BreedClassID = AppGlobalVariable.INIT_INT; } xH_SpotTradeRules.FundDeliveryInstitution = Convert.ToInt32(this.speFundDeliveryIns.EditValue); xH_SpotTradeRules.StockDeliveryInstitution = Convert.ToInt32(this.speStockDeliveryIns.EditValue); //if (!string.IsNullOrEmpty(this.cmbMinChangePriceVType.Text)) //{ xH_SpotTradeRules.ValueTypeMinChangePrice = (int)GTA.VTS.Common.CommonObject.Types.GetValueTypeEnum.Single; // ((UComboItem) this.cmbMinChangePriceVType.SelectedItem).ValueIndex; //} //else //{ // xH_SpotTradeRules.ValueTypeMinChangePrice = AppGlobalVariable.INIT_INT; //} if (!string.IsNullOrEmpty(this.txtMinChangePrice.Text)) { if (InputTest.DecimalTest(this.txtMinChangePrice.Text)) { xH_SpotTradeRules.MinChangePrice = Convert.ToDecimal(this.txtMinChangePrice.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //if ((int) CommonObject.Types.GetValueTypeEnum.Single == // ((UComboItem) this.cmbMinChangePriceVType.SelectedItem).ValueIndex) //{ // this.txtMinChangePrice.Enabled = true; ShowMessageBox.ShowInformation("最小变动价位不能为空!"); return; //} //this.txtMinChangePrice.Enabled = false; //xH_SpotTradeRules.MinChangePrice = 0; //最小变动价位=0时说明是范围值// AppGlobalVariable.INIT_INT; //money类型 } if (!string.IsNullOrEmpty(this.txtMaxLeaveQuantity.Text)) { if (InputTest.intTest(this.txtMaxLeaveQuantity.Text)) { xH_SpotTradeRules.MaxLeaveQuantity = Convert.ToInt32(this.txtMaxLeaveQuantity.Text); } else { ShowMessageBox.ShowInformation("请输入数字且第一位数不能为0!"); return; } } else { //xH_SpotTradeRules.MaxLeaveQuantity = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("每笔最大委托量不能为空!"); return; } //if (!string.IsNullOrEmpty(this.cmbMaxLeaveQuantityUnit.Text)) //根据20009.05.15界面修改确认结果 计价单位赋给每笔最大委托量单,每笔最大委托量单位在界面上不显示 if (!string.IsNullOrEmpty(this.cmbPriceUnit.Text)) { xH_SpotTradeRules.MaxLeaveQuantityUnit = ((UComboItem)this.cmbPriceUnit.SelectedItem).ValueIndex; } else { xH_SpotTradeRules.MaxLeaveQuantityUnit = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.cmbPriceUnit.Text)) { xH_SpotTradeRules.PriceUnit = ((UComboItem)this.cmbPriceUnit.SelectedItem).ValueIndex; } else { xH_SpotTradeRules.PriceUnit = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.cmbMarketUnitID.Text)) { xH_SpotTradeRules.MarketUnitID = ((UComboItem)this.cmbMarketUnitID.SelectedItem).ValueIndex; } else { xH_SpotTradeRules.MarketUnitID = AppGlobalVariable.INIT_INT; } //根据20009.05.15界面修改确认结果 最小交易单位倍数在界面上不显示。此值从最小交易单位管理界面中已存在 xH_SpotTradeRules.MinVolumeMultiples = 0; //判断品种涨跌幅ID或品种有效申报ID为空时提示添加品种涨跌幅和品种有效申报 if (m_BreedClassHighLowID != AppGlobalVariable.INIT_INT && m_BreedClassValidID != AppGlobalVariable.INIT_INT) { xH_SpotTradeRules.BreedClassHighLowID = m_BreedClassHighLowID; xH_SpotTradeRules.BreedClassValidID = m_BreedClassValidID; } else { if (EditType == (int)UITypes.EditTypeEnum.AddUI) { ShowMessageBox.ShowInformation("请添加涨跌幅!"); return; } } if (EditType == (int)UITypes.EditTypeEnum.AddUI) { m_Result = SpotManageCommon.AddXHSpotTradeRules(xH_SpotTradeRules); if (m_Result) { m_ValueType = Convert.ToInt32(xH_SpotTradeRules.ValueTypeMinChangePrice); m_BreedClassID = Convert.ToInt32(xH_SpotTradeRules.BreedClassID); ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); } else { if (m_BreedClassValidID != AppGlobalVariable.INIT_INT) { SpotManageCommon.DeleteValidDeclareValue(m_BreedClassValidID); } if (m_BreedClassHighLowID != AppGlobalVariable.INIT_INT) { SpotManageCommon.DeleteSpotHighLowValue(m_BreedClassHighLowID); } ShowMessageBox.ShowInformation("添加失败!"); } } else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { m_Result = SpotManageCommon.UpdateSpotTradeRules(xH_SpotTradeRules); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-5001"; string errMsg = "添加或修改现货交易规则失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }
/// <summary> /// 点击确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { int status = Status; if (status == 1) { #region 添加操作 try { if ( SpotManageCommon.ExistsXHSpotPosition( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的持仓比率已存在!"); return; } XH_SpotPosition xH_SpotPosition = new XH_SpotPosition(); if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { xH_SpotPosition.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { xH_SpotPosition.BreedClassID = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.txtRate.Text)) { if (InputTest.DecimalTest(this.txtRate.Text)) { xH_SpotPosition.Rate = Convert.ToDecimal(this.txtRate.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //xH_SpotPosition.Rate = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("持仓比率不能为空!"); return; } m_Result = SpotManageCommon.AddXHSpotPosition(xH_SpotPosition); if (m_Result) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QuerySpotPosition(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-5601"; string errMsg = "添加现货_交易商品品种_持仓限制失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion 添加操作 this.btnAdd.Enabled = true; this.btnModify.Enabled = true; this.btnDelete.Enabled = true; this.btnAdd.Text = "添加"; this.btnModify.Text = "修改"; Status = 0; } else if (status == 2) { #region 修改操作 try { XH_SpotPosition xH_SpotPosition = new XH_SpotPosition(); if (m_BreedClassID == AppGlobalVariable.INIT_INT) { ShowMessageBox.ShowInformation("请选择更新数据!"); return; } xH_SpotPosition.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; // xH_SpotPosition.Rate = Convert.ToDecimal(this.txtRate.Text); if (!string.IsNullOrEmpty(this.txtRate.Text)) { if (InputTest.DecimalTest(this.txtRate.Text)) { xH_SpotPosition.Rate = Convert.ToDecimal(this.txtRate.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //xH_SpotPosition.Rate = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("持仓比率不能为空!"); return; } m_Result = SpotManageCommon.UpdateXHSpotPosition(xH_SpotPosition); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.ClearAll(); } else { ShowMessageBox.ShowInformation("修改失败!"); } this.QuerySpotPosition(); } catch (Exception ex) { string errCode = "GL-5604"; string errMsg = "修改现货_交易商品品种_持仓限制失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion 修改操作 this.btnAdd.Enabled = true; this.btnModify.Enabled = true; this.btnDelete.Enabled = true; this.btnAdd.Text = "添加"; this.btnModify.Text = "修改"; Status = 0; } this.btnOK.Enabled = false; }
/// <summary> /// 添加或修改期货交易规则 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { try { if (EditType == (int)UITypes.EditTypeEnum.AddUI) { if ( FuturesManageCommon.ExistsFuturesTradeRules( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的交易规则已存在!"); return; } } QH_FuturesTradeRules qH_FuturesTradeRules = new QH_FuturesTradeRules(); if (QHFuturesTradeRules != null) { ManagementCenter.Model.CommonClass.UtilityClass.CopyEntityToEntity(QHFuturesTradeRules, qH_FuturesTradeRules); } if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { qH_FuturesTradeRules.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { qH_FuturesTradeRules.BreedClassID = AppGlobalVariable.INIT_INT; } qH_FuturesTradeRules.FundDeliveryInstitution = 0; //根据2010。04。26需求界面上不显示;默认T+0//Convert.ToInt32(this.speFundDeliveryIns.EditValue); qH_FuturesTradeRules.AgreementDeliveryInstitution = 0; //根据2010。04。26需求界面上不显示;默认T+0 // Convert.ToInt32(this.speAgreementDeliveryIns.EditValue); if (!string.IsNullOrEmpty(this.cmbHighLowStopScopeID.Text)) { qH_FuturesTradeRules.HighLowStopScopeID = ((UComboItem)this.cmbHighLowStopScopeID.SelectedItem).ValueIndex; } else { qH_FuturesTradeRules.HighLowStopScopeID = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.cmbMarketUnitID.Text)) { qH_FuturesTradeRules.MarketUnitID = ((UComboItem)this.cmbMarketUnitID.SelectedItem).ValueIndex; } else { qH_FuturesTradeRules.MarketUnitID = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.cmbPriceUnit.Text)) { qH_FuturesTradeRules.PriceUnit = ((UComboItem)this.cmbPriceUnit.SelectedItem).ValueIndex; } else { qH_FuturesTradeRules.PriceUnit = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.cmbUnitsID.Text)) { qH_FuturesTradeRules.UnitsID = ((UComboItem)this.cmbUnitsID.SelectedItem).ValueIndex; } else { qH_FuturesTradeRules.UnitsID = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.txtFutruesCode.Text)) { if ((InputTest.FetureTradeCodeTest(this.txtFutruesCode.Text)) && this.txtFutruesCode.Text.Length <= 2) { qH_FuturesTradeRules.FutruesCode = this.txtFutruesCode.Text; } else { ShowMessageBox.ShowInformation("代码简称需要大于或小于2位的大写字母!"); return; } } else { ShowMessageBox.ShowInformation("请填写代码简称!"); return; } if (!string.IsNullOrEmpty(this.txtUnitMultiple.Text)) { if (InputTest.DecimalTest(this.txtUnitMultiple.Text)) { qH_FuturesTradeRules.UnitMultiple = Convert.ToDecimal(this.txtUnitMultiple.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_FuturesTradeRules.UnitMultiple = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("转换比例不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtLeastChangePrice.Text)) { if (InputTest.DecimalTest(this.txtLeastChangePrice.Text)) { qH_FuturesTradeRules.LeastChangePrice = Convert.ToDecimal(this.txtLeastChangePrice.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("最小变动价位不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtHighLowStopScopeValue.Text)) { if (InputTest.DecimalTest(this.txtHighLowStopScopeValue.Text)) { qH_FuturesTradeRules.HighLowStopScopeValue = Convert.ToDecimal(this.txtHighLowStopScopeValue.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_FuturesTradeRules.HighLowStopScopeValue = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("涨跌幅不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtNewBreedFPHighLowStopV.Text)) { //qH_FuturesTradeRules.NewBreedFuturesPactHighLowStopValue = // Convert.ToDecimal(this.txtNewBreedFPHighLowStopV.Text); if (InputTest.DecimalTest(this.txtNewBreedFPHighLowStopV.Text)) { qH_FuturesTradeRules.NewBreedFuturesPactHighLowStopValue = Convert.ToDecimal(this.txtNewBreedFPHighLowStopV.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_FuturesTradeRules.NewBreedFuturesPactHighLowStopValue = AppGlobalVariable.INIT_DECIMAL; if (m_DiffFuturesType) { ShowMessageBox.ShowInformation("季月合约上市首日涨跌幅不能为空!"); return; } else { ShowMessageBox.ShowInformation("新品种合约上市当日涨跌幅不能为空!"); return; } } if (!string.IsNullOrEmpty(this.txtNewMonthFPactHighLowStopV.Text)) { //qH_FuturesTradeRules.NewMonthFuturesPactHighLowStopValue = // Convert.ToDecimal(this.txtNewMonthFPactHighLowStopV.Text); if (InputTest.DecimalTest(this.txtNewMonthFPactHighLowStopV.Text)) { qH_FuturesTradeRules.NewMonthFuturesPactHighLowStopValue = Convert.ToDecimal(this.txtNewMonthFPactHighLowStopV.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //qH_FuturesTradeRules.NewMonthFuturesPactHighLowStopValue = AppGlobalVariable.INIT_DECIMAL; if (m_DiffFuturesType) { ShowMessageBox.ShowInformation("合约最后交易日涨跌幅不能为空!"); return; } else { ShowMessageBox.ShowInformation("新月份合约上市当日涨跌幅不能为空!"); return; } } if (!string.IsNullOrEmpty(this.txtNewMonthFPactHighLowStopV.Text)) { //qH_FuturesTradeRules.NewMonthFuturesPactHighLowStopValue = // Convert.ToDecimal(this.txtNewMonthFPactHighLowStopV.Text); if (InputTest.DecimalTest(this.txtNewMonthFPactHighLowStopV.Text)) { qH_FuturesTradeRules.NewMonthFuturesPactHighLowStopValue = Convert.ToDecimal(this.txtNewMonthFPactHighLowStopV.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { if (!m_DiffFuturesType) { ShowMessageBox.ShowInformation("合约最后交易日涨跌幅不能为空!"); return; } } //判断交易规则委托量ID或最后交易日ID为空时提示添加交易规则委托量和最后交易日 if (m_ConsignQuantumID != AppGlobalVariable.INIT_INT) { qH_FuturesTradeRules.ConsignQuantumID = m_ConsignQuantumID; } else { if (EditType == (int)UITypes.EditTypeEnum.AddUI) { ShowMessageBox.ShowInformation("请添加交易规则委托量!"); } return; } if (m_LastTradingDayID != AppGlobalVariable.INIT_INT) { qH_FuturesTradeRules.LastTradingDayID = m_LastTradingDayID; } else { if (EditType == (int)UITypes.EditTypeEnum.AddUI) { ShowMessageBox.ShowInformation("请添加最后交易日!"); } return; } #region 交割月涨跌幅 add by 董鹏 2010-01-21 if (!string.IsNullOrEmpty(this.txtDeliveryMonthHighLowStopValue.Text)) { if (InputTest.DecimalTest(this.txtDeliveryMonthHighLowStopValue.Text)) { qH_FuturesTradeRules.DeliveryMonthHighLowStopValue = Convert.ToDecimal(this.txtDeliveryMonthHighLowStopValue.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } #endregion if (EditType == (int)UITypes.EditTypeEnum.AddUI) { m_Result = FuturesManageCommon.AddFuturesTradeRules(qH_FuturesTradeRules); if (m_Result) { m_BreedClassID = Convert.ToInt32(qH_FuturesTradeRules.BreedClassID); ShowMessageBox.ShowInformation("添加成功!"); this.btnAgreementDeliveryMonth.Enabled = true; ShowMessageBox.ShowInformation("请继续添加合约交割月份!"); this.ClearAll(); AddOrUpdateUIAgreementDeliveryMonth(); //if(m_MonthID!=AppGlobalVariable.INIT_INT) //{ // this.DialogResult = DialogResult.OK; // this.Close(); //} } else { // bool testResult = false; if (m_ConsignQuantumID != AppGlobalVariable.INIT_INT) { FuturesManageCommon.DeleteQHConsignQuantumAndSingle(m_ConsignQuantumID); } if (m_LastTradingDayID != AppGlobalVariable.INIT_INT) { FuturesManageCommon.DeleteQHLastTradingDay(m_LastTradingDayID); } ShowMessageBox.ShowInformation("添加失败!"); } } else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { m_Result = FuturesManageCommon.UpdateFuturesTradeRules(qH_FuturesTradeRules); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-5802"; string errMsg = "添加或修改期货交易规则失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }
/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (m_EditType == 1) { #region 添加操作 try { CM_CommodityFuse cM_CommodityFuse = new CM_CommodityFuse(); if (CommonParameterSetCommon.ExistsCommodityCode(this.cmbCommodityCode.Text)) { ShowMessageBox.ShowInformation("此代码的熔断已存在!"); return; } if (!string.IsNullOrEmpty(this.cmbCommodityCode.Text)) { cM_CommodityFuse.CommodityCode = this.cmbCommodityCode.SelectedItem.ToString(); } else { //cM_CommodityFuse.CommodityCode = AppGlobalVariable.INIT_STRING; ShowMessageBox.ShowInformation("请选择代码!"); return; } if (!string.IsNullOrEmpty(this.txTriggeringScale.Text)) { //cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text); if (InputTest.DecimalTest(this.txTriggeringScale.Text)) { cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text); } else { ShowMessageBox.ShowInformation("请输入数字或小数点!"); return; } } else { //cM_CommodityFuse.TriggeringScale = AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("触发比例不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtFuseTimeOfDay.Text)) { if (InputTest.intTest(this.txtFuseTimeOfDay.Text)) { cM_CommodityFuse.FuseTimeOfDay = Convert.ToInt32(this.txtFuseTimeOfDay.Text); } else { ShowMessageBox.ShowInformation("请输入整数!"); return; } } else { // cM_CommodityFuse.FuseTimeOfDay = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("熔断次数不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtTriggeringDuration.Text)) { //cM_CommodityFuse.TriggeringDuration = Convert.ToInt32(this.txtTriggeringDuration.Text); if (InputTest.intTest(this.txtTriggeringDuration.Text)) { cM_CommodityFuse.TriggeringDuration = Convert.ToInt32(this.txtTriggeringDuration.Text); } else { ShowMessageBox.ShowInformation("请输入整数!"); return; } } else { //cM_CommodityFuse.TriggeringDuration = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("触发持续时间限制不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtFuseDurationLimit.Text)) { if (InputTest.intTest(this.txtFuseDurationLimit.Text)) { cM_CommodityFuse.FuseDurationLimit = Convert.ToInt32(this.txtFuseDurationLimit.Text); } else { ShowMessageBox.ShowInformation("请输入整数!"); return; } } else { // cM_CommodityFuse.FuseDurationLimit = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("熔断持续时间限制不能为空!"); return; } m_Result = CommonParameterSetCommon.AddCMCommodityFuse(cM_CommodityFuse); if (m_Result) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QueryCMCommodityFuse(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-6801"; string errMsg = "添加可交易商品_熔断失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } else if (m_EditType == 2) { #region 修改操作 try { CM_CommodityFuse cM_CommodityFuse = new CM_CommodityFuse(); if (m_CommodityCode == AppGlobalVariable.INIT_STRING) { ShowMessageBox.ShowInformation("请选择更新数据!"); return; } cM_CommodityFuse.CommodityCode = this.cmbCommodityCode.SelectedItem.ToString(); //cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text); if (!string.IsNullOrEmpty(this.txTriggeringScale.Text)) { if (InputTest.DecimalTest(this.txTriggeringScale.Text)) { cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text); } else { ShowMessageBox.ShowInformation("请输入数字或小数点!"); return; } } else { ShowMessageBox.ShowInformation("触发比例不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtFuseTimeOfDay.Text)) { if (InputTest.intTest(this.txtFuseTimeOfDay.Text)) { cM_CommodityFuse.FuseTimeOfDay = Convert.ToInt32(this.txtFuseTimeOfDay.Text); } else { ShowMessageBox.ShowInformation("请输入整数!"); return; } } else { //cM_CommodityFuse.FuseTimeOfDay = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("熔断次数不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtTriggeringDuration.Text)) { if (InputTest.intTest(this.txtTriggeringDuration.Text)) { cM_CommodityFuse.TriggeringDuration = Convert.ToInt32(this.txtTriggeringDuration.Text); } else { ShowMessageBox.ShowInformation("请输入整数!"); return; } } else { //cM_CommodityFuse.TriggeringDuration = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("触发持续时间限制不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtFuseDurationLimit.Text)) { if (InputTest.intTest(this.txtFuseDurationLimit.Text)) { cM_CommodityFuse.FuseDurationLimit = Convert.ToInt32(this.txtFuseDurationLimit.Text); } else { ShowMessageBox.ShowInformation("请输入整数!"); return; } } else { //cM_CommodityFuse.FuseDurationLimit = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("熔断持续时间限制不能为空!"); return; } m_Result = CommonParameterSetCommon.UpdateCMCommodityFuse(cM_CommodityFuse); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.ClearAll(); } else { ShowMessageBox.ShowInformation("修改失败!"); } this.QueryCMCommodityFuse(); this.cmbCommodityCode.Enabled = true; } catch (Exception ex) { string errCode = "GL-6802"; string errMsg = "修改可交易商品_熔断失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } }
/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { //通过状态值来进行判断是进行那种操作 1:添加 2:修改 if (m_EditType == 1) { #region 添加操作 try { if ( HKManageCommon.ExistsHKSpotCosts( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的交易费用已存在!"); return; } HK_SpotCosts hK_SpotCosts = new HK_SpotCosts(); if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { hK_SpotCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { ShowMessageBox.ShowInformation("品种名称不能为空!"); return; } hK_SpotCosts.CurrencyTypeID = ((UComboItem)this.cmbCurrencyType.SelectedItem).ValueIndex; hK_SpotCosts.StampDutyTypeID = ((UComboItem)this.cmbStampDutyType.SelectedItem).ValueIndex; if (!string.IsNullOrEmpty(this.txtStampDuty.Text)) //印花税 { if (InputTest.DecimalTest(this.txtStampDuty.Text)) { hK_SpotCosts.StampDuty = Convert.ToDecimal(this.txtStampDuty.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //hK_SpotCosts.StampDuty = 0; // AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("印花税不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtStampDutyStartpoint.Text)) //印花税起点 { if (InputTest.DecimalTest(this.txtStampDutyStartpoint.Text)) { hK_SpotCosts.StampDutyStartingpoint = Convert.ToDecimal(this.txtStampDutyStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { hK_SpotCosts.StampDutyStartingpoint = 0; //默认为0 } if (!string.IsNullOrEmpty(this.txtCommision.Text)) //佣金 { if (InputTest.DecimalTest(this.txtCommision.Text)) { hK_SpotCosts.Commision = Convert.ToDecimal(this.txtCommision.Text); //null; } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //hK_SpotCosts.Commision = 0; // ShowMessageBox.ShowInformation("佣金不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtCommisionStartpoint.Text)) //佣金起点 { if (InputTest.DecimalTest(this.txtCommisionStartpoint.Text)) { hK_SpotCosts.CommisionStartingpoint = Convert.ToDecimal(this.txtCommisionStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { hK_SpotCosts.CommisionStartingpoint = 0; // //默认为0AppGlobalVariable.INIT_DECIMAL; } if (!string.IsNullOrEmpty(this.txtPoundageValue.Text)) //交易费 { if (InputTest.DecimalTest(this.txtPoundageValue.Text)) { hK_SpotCosts.PoundageValue = Convert.ToDecimal(this.txtPoundageValue.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("交易费不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtMonitoringFee.Text)) //监管费 { if (InputTest.DecimalTest(this.txtMonitoringFee.Text)) { hK_SpotCosts.MonitoringFee = Convert.ToDecimal(this.txtMonitoringFee.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("监管费不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtSystemToll.Text)) //交易系统使用费 { if (InputTest.DecimalTest(this.txtSystemToll.Text)) { hK_SpotCosts.SystemToll = Convert.ToDecimal(this.txtSystemToll.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("交易系统使用费不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtTransferToll.Text)) //过户费 { if (InputTest.DecimalTest(this.txtTransferToll.Text)) { hK_SpotCosts.TransferToll = Convert.ToDecimal(this.txtTransferToll.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { hK_SpotCosts.TransferToll = 0; //默认为0 } m_Result = HKManageCommon.AddHKSpotCosts(hK_SpotCosts); if (m_Result) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QueryHKCosts(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-7803"; string errMsg = "添加港股交易费用失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion 添加操作 } else if (m_EditType == 2) { #region 修改操作 try { HK_SpotCosts hK_SpotCosts = new HK_SpotCosts(); hK_SpotCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; //品种名称不能修改 hK_SpotCosts.CurrencyTypeID = ((UComboItem)this.cmbCurrencyType.SelectedItem).ValueIndex; hK_SpotCosts.StampDutyTypeID = ((UComboItem)this.cmbStampDutyType.SelectedItem).ValueIndex; if (!string.IsNullOrEmpty(this.txtStampDuty.Text)) //印花税 { if (InputTest.DecimalTest(this.txtStampDuty.Text)) { hK_SpotCosts.StampDuty = Convert.ToDecimal(this.txtStampDuty.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //hK_SpotCosts.StampDuty = 0; // AppGlobalVariable.INIT_DECIMAL; ShowMessageBox.ShowInformation("印花税不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtStampDutyStartpoint.Text)) //印花税起点 { if (InputTest.DecimalTest(this.txtStampDutyStartpoint.Text)) { hK_SpotCosts.StampDutyStartingpoint = Convert.ToDecimal(this.txtStampDutyStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { hK_SpotCosts.StampDutyStartingpoint = 0; //默认为0 } if (!string.IsNullOrEmpty(this.txtCommision.Text)) //佣金 { if (InputTest.DecimalTest(this.txtCommision.Text)) { hK_SpotCosts.Commision = Convert.ToDecimal(this.txtCommision.Text); //null; } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { //hK_SpotCosts.Commision = 0; // ShowMessageBox.ShowInformation("佣金不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtCommisionStartpoint.Text)) //佣金起点 { if (InputTest.DecimalTest(this.txtCommisionStartpoint.Text)) { hK_SpotCosts.CommisionStartingpoint = Convert.ToDecimal(this.txtCommisionStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { hK_SpotCosts.CommisionStartingpoint = 0; ////默认为0 AppGlobalVariable.INIT_DECIMAL; } if (!string.IsNullOrEmpty(this.txtPoundageValue.Text)) //交易费 { if (InputTest.DecimalTest(this.txtPoundageValue.Text)) { hK_SpotCosts.PoundageValue = Convert.ToDecimal(this.txtPoundageValue.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("交易费不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtMonitoringFee.Text)) //监管费 { if (InputTest.DecimalTest(this.txtMonitoringFee.Text)) { hK_SpotCosts.MonitoringFee = Convert.ToDecimal(this.txtMonitoringFee.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("监管费不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtSystemToll.Text)) //交易系统使用费 { if (InputTest.DecimalTest(this.txtSystemToll.Text)) { hK_SpotCosts.SystemToll = Convert.ToDecimal(this.txtSystemToll.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("交易系统使用费不能为空!"); return; } if (!string.IsNullOrEmpty(this.txtTransferToll.Text)) //过户费 { if (InputTest.DecimalTest(this.txtTransferToll.Text)) { hK_SpotCosts.TransferToll = Convert.ToDecimal(this.txtTransferToll.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { hK_SpotCosts.TransferToll = 0; //默认为0 } m_Result = HKManageCommon.UpdateHKSpotCosts(hK_SpotCosts); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.ClearAll(); this.QueryHKCosts(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } catch (Exception ex) { string errCode = "GL-7804"; string errMsg = "修改港股交易费用失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion 修改操作 } }
/// <summary> /// 添加或修改现货交易费用 /// 说明:根据需求,当以下值,分别是(印花税,印花税起点,佣金起点,过户费,过户费起点,结算费)用户没有填写时,默认值是0; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { if (EditType == (int)UITypes.EditTypeEnum.AddUI) { if ( SpotManageCommon.ExistsSpotCosts( ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)) { ShowMessageBox.ShowInformation("此品种的交易费用已存在!"); return; } } XH_SpotCosts xH_SpotCosts = new XH_SpotCosts(); if (XHSpotCosts != null) { ManagementCenter.Model.CommonClass.UtilityClass.CopyEntityToEntity(XHSpotCosts, xH_SpotCosts); } if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { xH_SpotCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { ShowMessageBox.ShowInformation("品种名称不能为空!"); return; } xH_SpotCosts.CurrencyTypeID = ((UComboItem)this.cmbCurrencyType.SelectedItem).ValueIndex; xH_SpotCosts.GetValueTypeID = (int)GTA.VTS.Common.CommonObject.Types.GetValueTypeEnum.Single; //根据需求指定默认值 //((UComboItem)this.cmbGetValueType.SelectedItem).ValueIndex; xH_SpotCosts.StampDutyTypeID = ((UComboItem)this.cmbStampDutyType.SelectedItem).ValueIndex; xH_SpotCosts.TransferTollTypeID = ((UComboItem)this.cmbTransferTollType.SelectedItem).ValueIndex; if (!string.IsNullOrEmpty(this.txtClearingFees.Text)) { if (InputTest.DecimalTest(this.txtClearingFees.Text)) { xH_SpotCosts.ClearingFees = Convert.ToDecimal(this.txtClearingFees.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.ClearingFees = 0; // AppGlobalVariable.INIT_DECIMAL; } if (!string.IsNullOrEmpty(this.txtCommision.Text)) { if (InputTest.DecimalTest(this.txtCommision.Text)) { xH_SpotCosts.Commision = Convert.ToDecimal(this.txtCommision.Text); //null; } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.Commision = 0; //?现货所有品种都有拥金 AppGlobalVariable.INIT_DECIMAL; } if (!string.IsNullOrEmpty(this.txtCommisionStartpoint.Text)) { if (InputTest.DecimalTest(this.txtCommisionStartpoint.Text)) { xH_SpotCosts.CommisionStartingpoint = Convert.ToDecimal(this.txtCommisionStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.CommisionStartingpoint = 0; // AppGlobalVariable.INIT_DECIMAL; } xH_SpotCosts.MonitoringFee = 0; //根据需求指定默认值 //Convert.ToDecimal(this.txtMonitoringFee.Text); xH_SpotCosts.PoundageSingleValue = 0; //根据需求改成默认值 //Convert.ToDecimal(this.txtPoundageSingleValue.Text); if (!string.IsNullOrEmpty(this.txtStampDuty.Text)) { if (InputTest.DecimalTest(this.txtStampDuty.Text)) { xH_SpotCosts.StampDuty = Convert.ToDecimal(this.txtStampDuty.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.StampDuty = 0; // AppGlobalVariable.INIT_DECIMAL; } if (!string.IsNullOrEmpty(this.txtStampDutyStartpoint.Text)) { if (InputTest.DecimalTest(this.txtStampDutyStartpoint.Text)) { xH_SpotCosts.StampDutyStartingpoint = Convert.ToDecimal(this.txtStampDutyStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.StampDutyStartingpoint = 0; // AppGlobalVariable.INIT_DECIMAL; } xH_SpotCosts.SystemToll = 0; //根据需求指定默认值// Convert.ToDecimal(this.txtSystemToll.Text); if (!string.IsNullOrEmpty(this.txtTransferToll.Text)) { if (InputTest.DecimalTest(this.txtTransferToll.Text)) { xH_SpotCosts.TransferToll = Convert.ToDecimal(this.txtTransferToll.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.TransferToll = 0; // AppGlobalVariable.INIT_DECIMAL; } if (!string.IsNullOrEmpty(this.txtTransferTollStartpoint.Text)) { if (InputTest.DecimalTest(this.txtTransferTollStartpoint.Text)) { xH_SpotCosts.TransferTollStartingpoint = Convert.ToDecimal(this.txtTransferTollStartpoint.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { xH_SpotCosts.TransferTollStartingpoint = 0; // AppGlobalVariable.INIT_DECIMAL; } if (EditType == (int)UITypes.EditTypeEnum.AddUI) { m_Result = SpotManageCommon.AddSpotCosts(xH_SpotCosts); if (m_Result) { //m_ValueType = Convert.ToInt32(xH_SpotCosts.ValueTypeMinChangePrice); //if (m_ValueType == (int)Types.GetValueTypeEnum.Scope) //{ // btnMinChangePriceV.Visible = true; //} m_BreedClassID = Convert.ToInt32(xH_SpotCosts.BreedClassID); ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { m_Result = SpotManageCommon.UpdateSpotCosts(xH_SpotCosts); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-5402"; string errMsg = "添加或修改现货交易费用失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }
/// <summary> /// 添加或修改商品期货_保证金比例 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { QH_CFBailScaleValue qH_CFBailScaleValue = new QH_CFBailScaleValue(); QH_CFBailScaleValue qH_CFBailScaleValue2 = new QH_CFBailScaleValue(); if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { qH_CFBailScaleValue.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; qH_CFBailScaleValue2.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { ShowMessageBox.ShowInformation("请选择品种!"); this.cmbBreedClassID.Focus(); return; } if (!string.IsNullOrEmpty(this.txtStart.Text) && !string.IsNullOrEmpty(this.txtEnds.Text)) { if (InputTest.intTest(this.txtStart.Text) && InputTest.intTest(this.txtEnds.Text)) { if (Convert.ToInt32(this.txtStart.Text) < Convert.ToInt32(this.txtEnds.Text)) { qH_CFBailScaleValue.Start = Convert.ToInt32(this.txtStart.Text); } else { ShowMessageBox.ShowInformation("起始值不能大于或等于结束值!"); this.txtStart.Focus(); return; } if (Convert.ToInt32(this.txtEnds.Text) > Convert.ToInt32(this.txtStart.Text)) { qH_CFBailScaleValue.Ends = Convert.ToInt32(this.txtEnds.Text); } else { ShowMessageBox.ShowInformation("结束值不能小于或等于起始值!"); this.txtEnds.Focus(); return; } if (InputTest.intTest(this.txtEnds2.Text)) { qH_CFBailScaleValue2.Ends = Convert.ToInt32(this.txtEnds2.Text); } } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtStart.Focus(); this.txtEnds.Focus(); return; } } else { if (string.IsNullOrEmpty(this.txtStart.Text) && string.IsNullOrEmpty(this.txtEnds.Text)) { ShowMessageBox.ShowInformation("范围值不能为空!"); this.txtStart.Focus(); return; } if (!string.IsNullOrEmpty(this.txtStart.Text)) { if (InputTest.intTest(this.txtStart.Text)) { qH_CFBailScaleValue.Start = Convert.ToInt32(this.txtStart.Text); } else { ShowMessageBox.ShowInformation("请输入正整数字!"); this.txtStart.Focus(); return; } } if (!string.IsNullOrEmpty(this.txtEnds.Text)) { if (InputTest.intTest(this.txtEnds.Text)) { qH_CFBailScaleValue.Ends = Convert.ToInt32(this.txtEnds.Text); } else { ShowMessageBox.ShowInformation("请输入正整数字!"); this.txtEnds.Focus(); return; } if (InputTest.intTest(this.txtEnds2.Text)) { qH_CFBailScaleValue2.Ends = Convert.ToInt32(this.txtEnds2.Text); } } } if (!string.IsNullOrEmpty(this.txtBailScale.Text)) { if (InputTest.DecimalTest(this.txtBailScale.Text)) { qH_CFBailScaleValue.BailScale = Convert.ToDecimal(this.txtBailScale.Text); } else { ShowMessageBox.ShowInformation("请输入数字!"); this.txtBailScale.Focus(); return; } if (InputTest.DecimalTest(this.txtBailScale2.Text)) { qH_CFBailScaleValue2.BailScale = Convert.ToDecimal(this.txtBailScale2.Text); } } else { ShowMessageBox.ShowInformation("请输入保证金比例!"); this.txtBailScale.Focus(); return; } if (!string.IsNullOrEmpty(this.cmbDeliveryMonthTypeID.Text)) { qH_CFBailScaleValue.DeliveryMonthType = ((UComboItem)this.cmbDeliveryMonthTypeID.SelectedItem).ValueIndex; qH_CFBailScaleValue2.DeliveryMonthType = ((UComboItem)this.cmbDeliveryMonthTypeID.SelectedItem).ValueIndex; } if (checkBox1.Checked) { qH_CFBailScaleValue.LowerLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes; } else { qH_CFBailScaleValue.LowerLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No; } if (checkBox2.Checked) { qH_CFBailScaleValue.UpperLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes; } else { qH_CFBailScaleValue.UpperLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No; } if (checkBox5.Checked) { qH_CFBailScaleValue2.UpperLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes; } else { qH_CFBailScaleValue2.UpperLimitIfEquation = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No; } if (!string.IsNullOrEmpty(this.cmbPositionBailTypeID.Text)) { qH_CFBailScaleValue.PositionBailTypeID = ((UComboItem)this.cmbPositionBailTypeID.SelectedItem).ValueIndex; qH_CFBailScaleValue2.PositionBailTypeID = ((UComboItem)this.cmbPositionBailTypeID.SelectedItem).ValueIndex; } if (EditType == (int)UITypes.EditTypeEnum.AddUI) { int result; if (!chkLastTrDay.Checked) { result = FuturesManageCommon.AddQHCFBailScaleValue(qH_CFBailScaleValue); } else { result = FuturesManageCommon.AddQHCFBailScaleValue(qH_CFBailScaleValue, qH_CFBailScaleValue2); } if (result != AppGlobalVariable.INIT_INT) { FireSaved(this, new EventArgs()); ShowMessageBox.ShowInformation("添加成功!"); //this.ClearAll(); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { if (m_CFBailScaleValueID != AppGlobalVariable.INIT_INT) { qH_CFBailScaleValue.CFBailScaleValueID = m_CFBailScaleValueID; } if (m_CFBailScaleValueID2 != AppGlobalVariable.INIT_INT) { qH_CFBailScaleValue2.CFBailScaleValueID = m_CFBailScaleValueID2; qH_CFBailScaleValue.RelationScaleID = m_CFBailScaleValueID2; } if (!chkLastTrDay.Checked) { //当现在修改后的保证金控制类型不等于原来的保证金控制类型:交易日 时,则把原来的子记录删除,并把 //父记录中子记录的ID变为NULL if (m_PositionBailTypeID == (int)GTA.VTS.Common.CommonObject.Types.QHPositionBailType.ByTradeDays) { if (((UComboItem)this.cmbPositionBailTypeID.SelectedItem).ValueIndex != m_PositionBailTypeID) { FuturesManageCommon.DeleteQHCFBailScaleValue(m_CFBailScaleValueID2); qH_CFBailScaleValue.RelationScaleID = null;//AppGlobalVariable.INIT_INT; } } m_Result = FuturesManageCommon.UpdateQHCFBailScaleValue(qH_CFBailScaleValue); } else { m_Result = FuturesManageCommon.UpdateQHCFBailScaleValue(qH_CFBailScaleValue, qH_CFBailScaleValue2); } if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-6402"; string errMsg = "添加或修改商品期货_保证金比例失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } }
/// <summary> /// 自由转帐(同币种) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { CT_CounterBLL CounterBLL = new CT_CounterBLL(); if (!CounterBLL.TestCenterConnection()) { MessageBox.Show("柜台服务连接失败,请检查柜台服务是否开启!", "系统提示"); return; } if (this.ViewUserInfo != null && this.ViewUserInfo.FocusedRowHandle >= 0 && ViewUserInfo.RowCount > 0) { m_cutRow = this.ViewUserInfo.FocusedRowHandle; if (m_cutRow < 0) { return; } DataRow dw = ViewUserInfo.GetDataRow(m_cutRow); int userID = Convert.ToInt32(dw["UserID"].ToString()); //用户ID int counterID = int.Parse(dw["CouterID"].ToString()); //柜台ID int FromCapitalAccountType = ((UComboItem)cmbTransOut.SelectedItem).ValueIndex; int ToCapitalAccountType = ((UComboItem)cmbTransIn.SelectedItem).ValueIndex; decimal TransferAmount = AppGlobalVariable.INIT_DECIMAL; string _Money = string.Empty;//输入的金额 if (!string.IsNullOrEmpty(txtTransferMoney.Text)) { if (InputTest.DecimalTest(this.txtTransferMoney.Text)) { if (Convert.ToDecimal(txtTransferMoney.Text) <= 0) { ShowMessageBox.ShowInformation("转出金额需大于0!"); return; } _Money = this.txtTransferMoney.Text; string[] _lengthRMB = _Money.Split('.'); if (_lengthRMB[0].Length > 12) { ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!"); return; } if (_lengthRMB.Length > 1) { if (_lengthRMB[1].Length > 3) { ShowMessageBox.ShowInformation("小数部分不能大于3位!"); return; } } if (this.txtTransferMoney.Text.Length > 16) { ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!"); return; } TransferAmount = Convert.ToDecimal(txtTransferMoney.Text); } else { ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!"); return; } } else { ShowMessageBox.ShowInformation("转出资金不能为空!"); return; } TransactionManageBLL = new ManagementCenter.BLL.UserManage.TransactionManage(); int currencyType = ((UComboItem)cmbCurrencyType.SelectedItem).ValueIndex; string outMessage = string.Empty; bool result = TransactionManageBLL.ConvertFreeTransferEntity(userID, FromCapitalAccountType, ToCapitalAccountType, TransferAmount, currencyType, counterID, out outMessage); if (result) { ShowMessageBox.ShowInformation("成功转出资金:" + TransferAmount + "元"); InitAccountListByUserID(userID.ToString(), counterID, m_cutRow); } else { if (!string.IsNullOrEmpty(outMessage)) { ShowMessageBox.ShowInformation(outMessage + "!");//在柜台返回的异常信息后加! } } } } catch (Exception ex) { string errCode = "GL-0374"; string errMsg = " 自由转帐(同币种)失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), ex); return; } }
/// <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 } }