//================================ 私有 方法 ================================ #region 设置查询实体对象 /// <summary> /// 设置查询实体对象 /// </summary> private bool SetQueryUserInfo() { if (QueryUserInfo == null) { QueryUserInfo = new UM_UserInfo(); } if (this.txt_UserID.Text.Trim() == string.Empty) { QueryUserInfo.UserID = int.MaxValue; } else { if (InputTest.intTest(this.txt_UserID.Text.Trim())) { QueryUserInfo.UserID = int.Parse(this.txt_UserID.Text.Trim()); } else { ShowMessageBox.ShowInformation("请输入正确的交易员编号!"); return(false); } } QueryUserInfo.LoginName = string.Empty; QueryUserInfo.RoleID = (int)Types.RoleTypeEnum.Transaction; return(true); }
/// <summary> /// 设置查询实体对象 /// </summary> private bool SetManagerQueryEntity() { if (managerQueryEntity == null) { managerQueryEntity = new ManagerQueryEntity(); } if (this.txt_UserID.Text.Trim() == string.Empty) { managerQueryEntity.UserID = int.MaxValue; } else { if (InputTest.intTest(this.txt_UserID.Text.Trim())) { managerQueryEntity.UserID = int.Parse(this.txt_UserID.Text.Trim()); } else { ShowMessageBox.ShowInformation("请输入正确的交易员编号!"); return(false); } } managerQueryEntity.LoginName = this.txt_LoginName.Text.Trim() != string.Empty ? this.txt_LoginName.Text.Trim() : string.Empty; managerQueryEntity.ManagerGroupName = this.txt_rightgroupname.Text.Trim() != string.Empty ? this.txt_rightgroupname.Text.Trim() : string.Empty; managerQueryEntity.ManagerGroupID = int.MaxValue; managerQueryEntity.UserName = string.Empty; managerQueryEntity.RoleID = (int)Types.RoleTypeEnum.Manager; return(true); }
// Start is called before the first frame update void Start() { if (instance) { Debug.LogError("Multiple instances not allowed."); return; } instance = this; }
/// <summary> /// 检测输入 /// </summary> /// <returns></returns> public bool CheckInPut() { try { if (MatchCenter == null) { MatchCenter = new RC_MatchCenter(); } if (this.txt_CenterName.Text == string.Empty) { ShowMessageBox.ShowInformation("请输入撮合中心名称!"); return(false); } MatchCenter.MatchCenterName = this.txt_CenterName.Text; if (this.txt_CenterIP.Text == string.Empty) { ShowMessageBox.ShowInformation("请输入IP地址!"); return(false); } if (!InputTest.IPTest(this.txt_CenterIP.Text.Trim())) { ShowMessageBox.ShowInformation("IP地址,输入有误,请重新输入!"); return(false); } MatchCenter.IP = this.txt_CenterIP.Text; if (!InputTest.intTest(this.txt_Port.Text)) { ShowMessageBox.ShowInformation("端口输入有误,请重新输入!"); return(false); } MatchCenter.Port = int.Parse(this.txt_Port.Text); if (this.txt_cuoheService.Text == string.Empty) { ShowMessageBox.ShowInformation("请输入撮合服务的名称!"); return(false); } MatchCenter.CuoHeService = this.txt_cuoheService.Text; if (this.txt_xiadanService.Text == string.Empty) { ShowMessageBox.ShowInformation("请输入下单服务的名称!"); return(false); } MatchCenter.XiaDanService = this.txt_xiadanService.Text; return(true); } catch (Exception ex) { string errCode = "GL-2004"; string errMsg = "检测输入失败"; VTException vte = new VTException(errCode, errMsg, ex); LogHelper.WriteError(vte.ToString(), vte.InnerException); return(false); } }
/// <summary> /// 检验港股品种交易规则的输入 /// </summary> /// <param name="strMess">提示信息</param> /// <returns></returns> private HK_SpotTradeRules VerifyHKSpotTradeRules(ref string strMess) { try { HK_SpotTradeRules hK_SpotTradeRules = new HK_SpotTradeRules(); strMess = string.Empty; if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { hK_SpotTradeRules.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { strMess = "请选择品种类型!"; } hK_SpotTradeRules.FundDeliveryInstitution = Convert.ToInt32(this.speFundDeliveryIns.EditValue); hK_SpotTradeRules.StockDeliveryInstitution = Convert.ToInt32(this.speStockDeliveryIns.EditValue); if (!string.IsNullOrEmpty(this.txtMaxLeaveQuantity.Text)) { if (InputTest.intTest(this.txtMaxLeaveQuantity.Text)) { hK_SpotTradeRules.MaxLeaveQuantity = Convert.ToInt32(this.txtMaxLeaveQuantity.Text); } else { strMess = "请输入数字且第一位数不能为0!"; } } else { strMess = "每笔最大委托量不能为空!"; } if (!string.IsNullOrEmpty(this.cmbPriceUnit.Text)) { hK_SpotTradeRules.PriceUnit = ((UComboItem)this.cmbPriceUnit.SelectedItem).ValueIndex; } else { strMess = "计价单位不能为空!"; } if (!string.IsNullOrEmpty(this.cmbMarketUnitID.Text)) { hK_SpotTradeRules.MarketUnitID = ((UComboItem)this.cmbMarketUnitID.SelectedItem).ValueIndex; } else { strMess = "行情成交量单位不能为空!"; } return(hK_SpotTradeRules); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); return(null); } }
public void Test() { //Arrange InputTest obj = new InputTest(); //Act bool res = obj.CheckType("aaaa"); bool res1 = obj.CheckType("aakk222"); //Assert Assert.True(res); Assert.False(res1); }
/// <summary> /// 设置查询实体对象 /// </summary> private bool SetQueryUserInfo() { if (QueryUserInfo == null) { QueryUserInfo = new UM_UserInfo(); } if (this.txt_UserID.Text.Trim() == string.Empty) { QueryUserInfo.UserID = int.MaxValue; } else { if (InputTest.intTest(this.txt_UserID.Text.Trim())) { QueryUserInfo.UserID = int.Parse(this.txt_UserID.Text.Trim()); } else { ShowMessageBox.ShowInformation("请输入正确的交易员编号!"); return(false); } } QueryUserInfo.UserName = this.txt_Name.Text.Trim() != string.Empty ? this.txt_Name.Text.Trim() : string.Empty; //if (this.txt_CounterID.Text.Trim() == string.Empty) //{ // QueryUserInfo.CouterID = int.MaxValue; //} //else //{ // if (InputTest.intTest(this.txt_CounterID.Text.Trim())) // { // QueryUserInfo.CouterID = int.Parse(this.txt_CounterID.Text.Trim()); // } // else // { // ShowMessageBox.ShowInformation("请输入正确的柜台编号!"); // return false; // } //} //柜台名称 QueryUserInfo.Name = this.txt_CounterName.Text.Trim() != string.Empty ? this.txt_CounterName.Text.Trim() : string.Empty; QueryUserInfo.LoginName = string.Empty; QueryUserInfo.RoleID = (int)Types.RoleTypeEnum.Transaction; return(true); }
public IActionResult Index([FromBody] InputTest inputTest) { List <Task> listTask = new List <Task>(); for (int concurrent = 0; concurrent < inputTest.NumberConcurrent; concurrent++) { var current = concurrent; listTask.Add(Task.Factory.StartNew(async() => { await Dowork(current, inputTest.Delay, inputTest.TotalPerConcurrent); })); } return(Ok("Starting...")); }
/// <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; } }
void Start() { INTERACT_ANGLE = Mathf.Cos(Mathf.Rad2Deg * INTERACTION_ANGLE); playerAnimator = GetComponent <Animator>(); transform.position = NetworkManager.singleton.startPositions[GetComponent <PlayerNetworkControl>().index].position; CmdCreateBox(); FindLunarModule(GetComponent <PlayerNetworkControl>().index); playerInput = GetComponent <InputTest>(); if (isLocalPlayer) { GameManager.instance.myPlayer = gameObject; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } }
/// <summary> /// 现货最小交易单位数据输入检测 /// </summary> /// <param name="msg">提示信息</param> /// <returns></returns> private XH_MinVolumeOfBusiness VerifyXHMinVolumeOfBusInput(ref string msg) { try { msg = string.Empty; XH_MinVolumeOfBusiness xH_MinVolumeOfBusiness = new XH_MinVolumeOfBusiness(); if (!string.IsNullOrEmpty(this.txtVolumeOfBusiness.Text)) { if (InputTest.intTest(this.txtVolumeOfBusiness.Text)) { xH_MinVolumeOfBusiness.VolumeOfBusiness = Convert.ToInt32(this.txtVolumeOfBusiness.Text); } else { msg = "请输入数字且第一位数不能为0!"; } } else { msg = "最小交易量不能为空!"; } xH_MinVolumeOfBusiness.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; xH_MinVolumeOfBusiness.UnitID = ((UComboItem)this.cmbUnitID.SelectedItem).ValueIndex; xH_MinVolumeOfBusiness.TradeWayID = ((UComboItem)this.cmbTradeWayID.SelectedItem).ValueIndex; if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { xH_MinVolumeOfBusiness.MinVolumeOfBusinessID = m_MinVolumeOfBusinessID; } return(xH_MinVolumeOfBusiness); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); return(null); } }
/// <summary> /// 数据检测 /// </summary> /// <returns></returns> public bool CheckData() { try { DataTable editData = ds.Tables[0]; for (int i = 0; i < editData.Rows.Count; i++) { if (!InputTest.intTest(editData.Rows[i]["MachineNo"].ToString())) { ShowMessageBox.ShowInformation("请为每个交易所分配正确的撮合机个数!"); return(false); } } return(true); } catch (Exception ex) { string errCode = "GL-2053"; string errMsg = "数据检测失败"; VTException vte = new VTException(errCode, errMsg, ex); LogHelper.WriteError(vte.ToString(), vte.InnerException); return(false); } }
/// <summary> /// 现货单位换算数据输入检测 /// </summary> /// <param name="msg">提示信息</param> /// <returns></returns> private CM_UnitConversion VerifyUnitConversionInput(ref string msg) { try { msg = string.Empty; CM_UnitConversion cM_UnitConversion = new CM_UnitConversion(); if (!string.IsNullOrEmpty(this.txtValue.Text)) { if (InputTest.intTest(this.txtValue.Text)) { cM_UnitConversion.Value = Convert.ToInt32(this.txtValue.Text); } else { msg = "请输入数字且第一位数不能为0!"; } } else { msg = "比例不能为空!"; } cM_UnitConversion.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; cM_UnitConversion.UnitIDFrom = ((UComboItem)this.cmbUnitIDFrom.SelectedItem).ValueIndex; cM_UnitConversion.UnitIDTo = ((UComboItem)this.cmbUnitIDTo.SelectedItem).ValueIndex; if (EditType == (int)UITypes.EditTypeEnum.UpdateUI) { cM_UnitConversion.UnitConversionID = m_UnitConversionID; } return(cM_UnitConversion); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); return(null); } }
/// <summary> /// 检测用户信息 /// </summary> /// <returns></returns> public bool CheckUserInfo() { try { JudgmentMessage = string.Empty; if (this.dll_CouterID.Properties.Items.Count < 1) { ShowMessageBox.ShowInformation("请先添加柜台信息!"); return(false); } if (this.txt_Name.Text == string.Empty) { ShowMessageBox.ShowInformation("请输入交易员(对应真实姓名项)名称!");//("请输入交易员名称!"); return(false); } else { if (!IsSuperLenth(this.txt_Name.Text, 20)) { ShowMessageBox.ShowInformation("姓名超出有效范围长度20!"); return(false); } this.m_currentUser.UserName = this.txt_Name.Text.ToString(); } if (this.txt_CertificateNo.Text.ToString() != string.Empty) { if (!IsSuperLenth(this.txt_CertificateNo.Text.ToString(), 50)) { ShowMessageBox.ShowInformation("证件号码超出有效范围长度50!"); return(false); } if (((UComboItem)this.dll_CertificateStyle.SelectedItem).ValueIndex == (int)ManagementCenter.Model.CommonClass.Types.CertificateStyleEnum.StatusCard) { if (!InputTest.IsStatusCard(this.txt_CertificateNo.Text)) { ShowMessageBox.ShowInformation("证件号码是15位或18位的合法格式!"); return(false); } } this.m_currentUser.CertificateNo = this.txt_CertificateNo.Text.ToString(); this.m_currentUser.CertificateStyle = ((UComboItem)this.dll_CertificateStyle.SelectedItem).ValueIndex; } else { this.m_currentUser.CertificateNo = null; this.m_currentUser.CertificateStyle = null; } if (this.txt_Postalcode.Text != string.Empty) { if (!IsSuperLenth(this.txt_Postalcode.Text, 50)) { ShowMessageBox.ShowInformation("邮政编码超出有效范围长度50!"); return(false); } if (!InputTest.IsPostCode(this.txt_Postalcode.Text)) { ShowMessageBox.ShowInformation("邮编是6个整数!"); return(false); } this.m_currentUser.Postalcode = this.txt_Postalcode.Text.ToString(); } else { this.m_currentUser.Postalcode = null; } if (this.txt_Email.Text != string.Empty) { if (!IsSuperLenth(this.txt_Email.Text, 50)) { ShowMessageBox.ShowInformation("邮箱超出有效范围长度50!"); return(false); } if (!InputTest.emailTest(this.txt_Email.Text)) { ShowMessageBox.ShowInformation("邮箱格式错误,请输入正确的邮箱!"); return(false); } this.m_currentUser.Email = this.txt_Email.Text; } else { this.m_currentUser.Email = null; } if (this.txt_Telephone.Text != string.Empty) { if (!IsSuperLenth(this.txt_Telephone.Text, 20)) { ShowMessageBox.ShowInformation("电话号码超出有效范围长度20!"); return(false); } if (!InputTest.IsMobileOrTelephone(this.txt_Telephone.Text)) { ShowMessageBox.ShowInformation("电话号码格式不正确!"); return(false); } this.m_currentUser.Telephone = this.txt_Telephone.Text.ToString(); } else { this.m_currentUser.Telephone = null; } if (this.txt_Address.Text != string.Empty) { if (!IsSuperLenth(this.txt_Address.Text, 50)) { ShowMessageBox.ShowInformation("地址超出有效范围长度50!"); return(false); } this.m_currentUser.Address = this.txt_Address.Text.ToString(); } else { this.m_currentUser.Address = null; } this.m_currentUser.CouterID = ((UComboItem)this.dll_CouterID.SelectedItem).ValueIndex; this.m_currentUser.RoleID = (int)ManagementCenter.Model.CommonClass.Types.RoleTypeEnum.Transaction; this.m_currentUser.AddType = (int)ManagementCenter.Model.CommonClass.Types.AddTpyeEnum.BackTaransaction; if (EditType == 1) { try { string _Money = string.Empty;//输入的金额 if (this.txt_RMB.Text != string.Empty) { _Money = this.txt_RMB.Text; string[] _lengthRMB = _Money.Split('.'); if (_lengthRMB[0].Length > 12) { ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!"); return(false); } if (_lengthRMB.Length > 1) { if (_lengthRMB[1].Length > 3) { ShowMessageBox.ShowInformation("小数部分不能大于3位!"); return(false); } } if (this.txt_RMB.Text.Length > 16) { ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!"); return(false); } m_InitFund.RMB = decimal.Parse(this.txt_RMB.Text); } if (this.txt_US.Text != string.Empty) { _Money = this.txt_US.Text; string[] _lengthRMB = _Money.Split('.'); if (_lengthRMB[0].Length > 12) { ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!"); return(false); } if (_lengthRMB.Length > 1) { if (_lengthRMB[1].Length > 3) { ShowMessageBox.ShowInformation("小数部分不能大于3位!"); return(false); } } if (this.txt_US.Text.Length > 16) { ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!"); return(false); } m_InitFund.US = decimal.Parse(this.txt_US.Text); } if (this.txt_HK.Text != string.Empty) { _Money = this.txt_HK.Text; string[] _lengthRMB = _Money.Split('.'); if (_lengthRMB[0].Length > 12) { ShowMessageBox.ShowInformation("超出存储的范围(整数部分不能大于12位)!"); return(false); } if (_lengthRMB.Length > 1) { if (_lengthRMB[1].Length > 3) { ShowMessageBox.ShowInformation("小数部分不能大于3位!"); return(false); } } if (this.txt_HK.Text.Length > 16) { ShowMessageBox.ShowInformation("超出存储的范围(不能大于16位)!"); return(false); } m_InitFund.HK = decimal.Parse(this.txt_HK.Text); } } catch (Exception ex) { ShowMessageBox.ShowInformation("请输入正确的金额!"); LogHelper.WriteError(ex.Message, ex); return(false); } } //登陆密码检测 if (EditType == 1 || (EditType == 2 && this.che_UpdatePass.Checked == true)) { if (this.txt_Password.Text.ToString() == string.Empty || this.txt_PassAgain.Text.ToString() == string.Empty) { ShowMessageBox.ShowInformation("密码不能为空!"); return(false); } if (!IsSuperLenth(this.txt_Password.Text.ToString(), 12)) { MessageBox.Show("密码超出有效范围长度12!"); return(false); } if (!InputTest.LoginTest(this.txt_Password.Text.ToString())) { MessageBox.Show("密码中包含非法字符!"); return(false); } if (this.txt_Password.Text.ToString() != this.txt_PassAgain.Text.ToString()) { MessageBox.Show("两次输入的密码不一致!"); return(false); } this.m_currentUser.Password = this.txt_Password.Text.ToString(); if ((EditType == 2 && this.che_UpdatePass.Checked == true)) { this.m_currentUser.Password = ManagementCenter.Model.CommonClass.UtilityClass.DesEncrypt( this.txt_Password.Text.ToString(), string.Empty); } } return(true); } catch (Exception ex) { ShowMessageBox.ShowInformation("用户输入检测失败!"); string errCode = "GL-0303"; string errMsg = "用户输入检测失败!"; VTException vte = new VTException(errCode, errMsg, ex); LogHelper.WriteError(vte.ToString(), vte.InnerException); return(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) { 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> /// 添加或修改现货交易规则 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) { 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) { try { QH_ConsignQuantum qH_ConsignQuantum = new QH_ConsignQuantum(); QH_SingleRequestQuantity qH_SingleRequestQuantity1; QH_SingleRequestQuantity qH_SingleRequestQuantity2; if (this.txtLimitQuantum.Text != string.Empty) { if (InputTest.intTest(this.txtLimitQuantum.Text)) { qH_SingleRequestQuantity1 = new QH_SingleRequestQuantity(); qH_SingleRequestQuantity1.ConsignInstructionTypeID = (int)GTA.VTS.Common.CommonObject.Types.MarketPriceType.otherPrice; qH_SingleRequestQuantity1.MaxConsignQuanturm = int.Parse(this.txtLimitQuantum.Text); } else { ShowMessageBox.ShowInformation("请输入正整数!"); return; } } else { qH_SingleRequestQuantity1 = null; } if (this.txtMarketQuantum.Text != string.Empty) { if (InputTest.intTest(this.txtMarketQuantum.Text)) { qH_SingleRequestQuantity2 = new QH_SingleRequestQuantity(); qH_SingleRequestQuantity2.ConsignInstructionTypeID = (int)GTA.VTS.Common.CommonObject.Types.MarketPriceType.MarketPrice; qH_SingleRequestQuantity2.MaxConsignQuanturm = int.Parse(this.txtMarketQuantum.Text); } else { ShowMessageBox.ShowInformation("请输入正整数!"); return; } } else { qH_SingleRequestQuantity2 = null; } if (!string.IsNullOrEmpty(this.txtMinConsignQuantum.Text)) { qH_ConsignQuantum.MinConsignQuantum = Convert.ToInt32(txtMinConsignQuantum.Text); } else { qH_ConsignQuantum.MinConsignQuantum = AppGlobalVariable.INIT_INT; } if (m_MinAndMaxConsignQuantumUIEditType == (int)UITypes.EditTypeEnum.AddUI) { m_Result = FuturesManageCommon.AddQHConsignQuantumAndSingle(qH_ConsignQuantum, qH_SingleRequestQuantity1, qH_SingleRequestQuantity2); if (m_Result != AppGlobalVariable.INIT_INT) { ConsignQuantumID = m_Result; ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else if (m_MinAndMaxConsignQuantumUIEditType == (int)UITypes.EditTypeEnum.UpdateUI) { if (m_ConsignQuantumID != AppGlobalVariable.INIT_INT) { qH_ConsignQuantum.ConsignQuantumID = m_ConsignQuantumID; qH_SingleRequestQuantity1.ConsignQuantumID = m_ConsignQuantumID; qH_SingleRequestQuantity1.SingleRequestQuantityID = m_LimitSingleRequestQuantityID; if (m_MarkSingleRequestQuantityID == AppGlobalVariable.INIT_INT) { qH_SingleRequestQuantity2 = null; } else { qH_SingleRequestQuantity2.ConsignQuantumID = m_ConsignQuantumID; qH_SingleRequestQuantity2.SingleRequestQuantityID = m_MarkSingleRequestQuantityID; } } bool _UpResult = FuturesManageCommon.UpdateQHConsignQuantumAndSingle(qH_ConsignQuantum, qH_SingleRequestQuantity1, qH_SingleRequestQuantity2); if (_UpResult) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-5861"; 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) { //根据状态进行操作 1:添加 2:修改 if (m_EditType == 1) { #region 添加操作 try { CM_Commodity cM_Commodity = new CM_Commodity(); if (!string.IsNullOrEmpty(this.txtCommodityCode.Text)) { if (!CommonParameterSetCommon.IsExistCommodityCode(this.txtCommodityCode.Text)) { ShowMessageBox.ShowInformation("代码已经存在!"); return; } if (InputTest.zeroXHAndQHStartIntTest(this.txtCommodityCode.Text)) { if (this.txtCommodityCode.Text.Length == 6 || this.txtCommodityCode.Text.Length == 5) { cM_Commodity.CommodityCode = this.txtCommodityCode.Text; } else { ShowMessageBox.ShowInformation("代码长度是5或6!"); return; } } else { ShowMessageBox.ShowInformation("请输入期货代码简称+数字或6个数字!"); return; } } else { ShowMessageBox.ShowInformation("请输入代码!"); return; } if (!string.IsNullOrEmpty(this.txtCommodityName.Text)) { if (!CommonParameterSetCommon.IsExistCommodityName(this.txtCommodityName.Text)) { ShowMessageBox.ShowInformation("代码名称已经存在!"); return; } cM_Commodity.CommodityName = this.txtCommodityName.Text; } else { ShowMessageBox.ShowInformation("请输入代码名称!"); return; } if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { cM_Commodity.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { //cM_Commodity.BreedClassID = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("请选择品种类型!"); return; } if (!string.IsNullOrEmpty(this.txtLabelCommodityCode.Text)) { cM_Commodity.LabelCommodityCode = this.txtLabelCommodityCode.Text; } else { cM_Commodity.LabelCommodityCode = AppGlobalVariable.INIT_STRING; } if (!string.IsNullOrEmpty(this.txtGoerScale.Text)) { cM_Commodity.GoerScale = Convert.ToDecimal(this.txtGoerScale.Text); } else { cM_Commodity.GoerScale = AppGlobalVariable.INIT_DECIMAL; } //if (!string.IsNullOrEmpty(this.txtStockPinYin.Text)) //{ //cM_Commodity.StockPinYin = this.txtStockPinYin.Text; //} //else //{ // cM_Commodity.StockPinYin = AppGlobalVariable.INIT_STRING; // //ShowMessageBox.ShowInformation("拼音简称不能为空!"); // //return; //} if (!string.IsNullOrEmpty(this.txtStockPinYin.Text)) { if (m_DiffBreeadClassType) { cM_Commodity.StockPinYin = this.txtStockPinYin.Text; } else { cM_Commodity.StockPinYin = AppGlobalVariable.INIT_STRING; } } else { if (m_DiffBreeadClassType) { ShowMessageBox.ShowInformation("拼音简称不能为空!"); return; } else { cM_Commodity.StockPinYin = AppGlobalVariable.INIT_STRING; //期货时此值为空 } } if (!string.IsNullOrEmpty(this.dtMarketDate.Text)) { cM_Commodity.MarketDate = Convert.ToDateTime(this.dtMarketDate.Text); } else { //cM_Commodity.MarketDate = AppGlobalVariable.INIT_DATETIME; ShowMessageBox.ShowInformation("请选择上市日期!"); return; } if (!string.IsNullOrEmpty(this.txtturnovervolume.Text)) { if (m_DiffBreeadClassType) { if (InputTest.intTest(this.txtturnovervolume.Text)) { cM_Commodity.turnovervolume = Convert.ToDouble(this.txtturnovervolume.Text); } else { ShowMessageBox.ShowInformation("请输入正整数!"); return; } } else { cM_Commodity.turnovervolume = null; //期货时此值为空 } } else { if (m_DiffBreeadClassType) { ShowMessageBox.ShowInformation("请输入流通股数!"); return; } else { cM_Commodity.turnovervolume = null; //期货时此值为空 } } cM_Commodity.IsExpired = AppGlobalVariable.INIT_INT; //默认int初始值 // cM_Commodity.ISSysDefaultCode = AppGlobalVariable.INIT_INT;//用户添加的代码不是系统默认代码 cM_Commodity.ISSysDefaultCode = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No; //用户添加的代码不是系统默认代码 m_Result = CommonParameterSetCommon.AddCMCommodity(cM_Commodity); if (m_Result) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QueryCMCommodity(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } catch (Exception ex) { string errCode = "GL-4201"; 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_Commodity cM_Commodity = new CM_Commodity(); if (string.IsNullOrEmpty(this.txtCommodityCode.Text)) { ShowMessageBox.ShowInformation("请选择更新数据!"); return; } cM_Commodity.CommodityCode = this.txtCommodityCode.Text; if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text)) { cM_Commodity.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; } else { //cM_Commodity.BreedClassID = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("请选择品种类型!"); return; } if (!string.IsNullOrEmpty(dtMarketDate.Text)) { cM_Commodity.MarketDate = dtMarketDate.DateTime; } cM_Commodity.IsExpired = AppGlobalVariable.INIT_INT; //默认int初始值 //cM_Commodity.ISSysDefaultCode = AppGlobalVariable.INIT_INT;//用户添加的代码不是系统默认代码 cM_Commodity.ISSysDefaultCode = m_ISSysDefaultCode; //当是修改时不改变原来的系统默认代码默认值 m_Result = CommonParameterSetCommon.UpdateCMCommodity(cM_Commodity); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.ClearAll(); } else { ShowMessageBox.ShowInformation("修改失败!"); } m_ISSysDefaultCode = AppGlobalVariable.INIT_INT; this.QueryCMCommodity(); } catch (Exception ex) { string errCode = "GL-4203"; string errMsg = "修改交易商品失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion } }
private void Awake() { _playerInput = new InputTest(); }
/// <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; } }
// Start is called before the first frame update void Awake() { instance = this; }
/// <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> /// 确定按钮事件 /// </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_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> /// <returns></returns> public bool CheckUserInfo() { try { JudgmentMessage = string.Empty; if (this.dll_rightgroup.Properties.Items.Count < 1) { ShowMessageBox.ShowInformation("请先设置权限组!"); return(false); } m_rightGroupID = ((UComboItem)this.dll_rightgroup.SelectedItem).ValueIndex; if (this.txt_LoginName.Text == string.Empty) { ShowMessageBox.ShowInformation("管理员帐号不能为空!");//("登录名称不能为空!"); return(false); } else { if (!IsSuperLenth(this.txt_LoginName.Text, 20)) { ShowMessageBox.ShowInformation("管理员帐号超出有效长度20!");//("登录名称不超出有效长度20!"); return(false); } if (!InputTest.LoginTest(this.txt_LoginName.Text)) { ShowMessageBox.ShowInformation("管理员帐号包含非法字符(只能包含数字、字母、以及下划线和-)!");//("登录名称包含非法字符(只能包含数字、字母、以及下划线和-)"); return(false); } this.m_userInfo.LoginName = this.txt_LoginName.Text.ToString(); } if (EditType == 1) { ManagementCenter.BLL.UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL(); if (!UserInfoBLL.CheckLoginName(this.m_userInfo.LoginName)) { MessageBox.Show("管理员帐号已经存在,请重新输入!");//("登录名称已经存在,请重新输入!"); return(false); } } if (this.txt_Name.Text != string.Empty) { if (!IsSuperLenth(this.txt_Name.Text, 20)) { MessageBox.Show("真实姓名超出有效范围长度20!");//("用户姓名超出有效范围长度20!"); return(false); } this.m_userInfo.UserName = this.txt_Name.Text.ToString(); } else { this.m_userInfo.UserName = null; } if (this.txt_CertificateNo.Text.ToString() != string.Empty) { if (!IsSuperLenth(this.txt_CertificateNo.Text.ToString(), 50)) { ShowMessageBox.ShowInformation("证件号码超出有效范围长度50!"); return(false); } this.m_userInfo.CertificateNo = this.txt_CertificateNo.Text.ToString(); this.m_userInfo.CertificateStyle = ((UComboItem)this.dll_CertificateStyle.SelectedItem).ValueIndex; } else { this.m_userInfo.CertificateNo = null; this.m_userInfo.CertificateStyle = null; } if (this.txt_Postalcode.Text != string.Empty) { if (!IsSuperLenth(this.txt_Postalcode.Text, 50)) { ShowMessageBox.ShowInformation("邮政编码超出有效范围长度50!"); return(false); } this.m_userInfo.Postalcode = this.txt_Postalcode.Text.ToString(); } else { this.m_userInfo.Postalcode = null; } if (this.txt_Email.Text != string.Empty) { if (!IsSuperLenth(this.txt_Email.Text, 50)) { ShowMessageBox.ShowInformation("邮箱超出有效范围长度50!"); return(false); } if (!InputTest.emailTest(this.txt_Email.Text)) { ShowMessageBox.ShowInformation("邮箱格式错误,请输入正确的邮箱!"); return(false); } this.m_userInfo.Email = this.txt_Email.Text; } else { this.m_userInfo.Email = null; } if (this.txt_Telephone.Text != string.Empty) { if (!IsSuperLenth(this.txt_Telephone.Text, 20)) { ShowMessageBox.ShowInformation("电话号码超出有效范围长度20!"); return(false); } this.m_userInfo.Telephone = this.txt_Telephone.Text.ToString(); } else { this.m_userInfo.Telephone = null; } if (this.txt_Address.Text != string.Empty) { if (!IsSuperLenth(this.txt_Address.Text, 50)) { ShowMessageBox.ShowInformation("地址超出有效范围长度50!"); return(false); } this.m_userInfo.Address = this.txt_Address.Text.ToString(); } else { this.m_userInfo.Address = null; } if (this.txt_Answer.Text.ToString() != string.Empty) { if (!IsSuperLenth(this.txt_Answer.Text, 200)) { ShowMessageBox.ShowInformation("答案超出有效范围长度200!"); return(false); } this.m_userInfo.Answer = this.txt_Answer.Text.ToString(); this.m_userInfo.QuestionID = ((UComboItem)this.dll_QuestionID.SelectedItem).ValueIndex; } else { this.m_userInfo.Answer = null; this.m_userInfo.QuestionID = null; } this.m_userInfo.RoleID = (int)ManagementCenter.Model.CommonClass.Types.RoleTypeEnum.Manager; this.m_userInfo.AddType = (int)ManagementCenter.Model.CommonClass.Types.AddTpyeEnum.BackManager; //登陆密码检测 if (EditType == 1 || (EditType == 2 && this.che_UpdatePass.Checked == true)) { if (this.txt_Password.Text.ToString() == string.Empty || this.txt_PassAgain.Text.ToString() == string.Empty) { ShowMessageBox.ShowInformation("密码不能为空!"); return(false); } if (!IsSuperLenth(this.txt_Password.Text.ToString(), 12)) { MessageBox.Show("密码超出有效范围长度12!"); return(false); } if (!InputTest.LoginTest(this.txt_Password.Text.ToString())) { MessageBox.Show("密码中包含非法字符!"); return(false); } if (this.txt_Password.Text.ToString() != this.txt_PassAgain.Text.ToString()) { MessageBox.Show("两次输入的密码不一致!"); return(false); } this.m_userInfo.Password = this.txt_Password.Text.ToString(); if ((EditType == 2 && this.che_UpdatePass.Checked == true)) { this.m_userInfo.Password = ManagementCenter.Model.CommonClass.UtilityClass.DesEncrypt( this.txt_Password.Text.ToString(), string.Empty); } } return(true); } catch (Exception ex) { ShowMessageBox.ShowInformation("用户输入检测失败!"); string errCode = "GL-1024"; string errMsg = "用户输入检测失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return(false); } }
/// <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 修改操作 } }