//================================  私有  方法 ================================

        #region 获取期货品种名称 GetBindBreedClassName

        /// <summary>
        /// 获取期货品种名称
        /// </summary>
        private void GetBindBreedClassName()
        {
            try
            {
                DataSet ds = FuturesManageCommon.GetQHBreedClassNameByBreedClassID(); //从交易商品品种表中获取
                if (ds != null)
                {
                    UComboItem _item;
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        _item = new UComboItem(ds.Tables[0].Rows[i]["BreedClassName"].ToString(),
                                               Convert.ToInt32(ds.Tables[0].Rows[i]["BreedClassID"]));
                        this.cmbBreedClassID.Properties.Items.Add(_item);
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5873";
                string      errMsg    = "获取期货品种名称失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 获取需要更新的(商品)期货_持仓限制的实体
        /// </summary>
        /// <param name="handle">行号</param>
        private void UpdateQHPositionLimitValue(int handle)
        {
            try
            {
                if (handle < 0)
                {
                    return;
                }
                //显示添加(商品)期货_持仓限制窗体
                AddPositionLimitValueUI addPositionLimitValueUI = new AddPositionLimitValueUI();
                addPositionLimitValueUI.EditType = (int)UITypes.EditTypeEnum.UpdateUI;
                DataRow _dr = this.gdPositionLimitValueSelect.GetDataRow(handle);
                int     positionLimitValueID = Convert.ToInt32(_dr["PositionLimitValueID"]);
                QH_PositionLimitValue qHPositionLimitValue = FuturesManageCommon.GetQHPositionLimitValueModel(positionLimitValueID);
                addPositionLimitValueUI.QHPositionLimitValue = qHPositionLimitValue;

                if (addPositionLimitValueUI.ShowDialog(this) == DialogResult.OK)
                {
                    this.QueryQHPositionLimitValue();
                    this.gdPositionLimitValueSelect.FocusedRowHandle = handle;
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6463";
                string      errMsg    = "获取需要更新的(商品)期货_持仓限制的实体失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 获取需要更新的期货交易规则数据
        /// </summary>
        /// <param name="handle"></param>
        private void UpdateFuturesTradeRules(int handle)
        {
            try
            {
                if (handle < 0)
                {
                    return;
                }
                //显示添加期货规则窗体
                AddFuturesTradeRulesUI addFuturesTradeRulesUI = new AddFuturesTradeRulesUI();
                addFuturesTradeRulesUI.EditType = (int)UITypes.EditTypeEnum.UpdateUI;
                DataRow _dr          = this.gdvFuturesTradeRulesSelect.GetDataRow(handle);
                int     breedClassID = Convert.ToInt32(_dr["BreedClassID"]);
                QH_FuturesTradeRules qHFuturesTradeRules = FuturesManageCommon.GetFuturesTradeRulesModel(breedClassID);
                addFuturesTradeRulesUI.QHFuturesTradeRules = qHFuturesTradeRules;

                if (addFuturesTradeRulesUI.ShowDialog(this) == DialogResult.OK)
                {
                    this.QueryFuturesTradeRules();
                    this.gdvFuturesTradeRulesSelect.FocusedRowHandle = handle;
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5823";
                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 btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No)
                {
                    return;
                }

                DataRow _dr = this.gdCFBailScaleValueSelect.GetDataRow(this.gdCFBailScaleValueSelect.FocusedRowHandle);
                if (_dr == null)
                {
                    ShowMessageBox.ShowInformation("请选择数据!");
                    return;
                }

                if (!string.IsNullOrEmpty(Convert.ToString(_dr["CFBailScaleValueID"])))
                {
                    m_CFBailScaleValueID = Convert.ToInt32(_dr["CFBailScaleValueID"]);
                }
                else
                {
                    m_CFBailScaleValueID = AppGlobalVariable.INIT_INT;
                }

                if (m_CFBailScaleValueID != AppGlobalVariable.INIT_INT)
                {
                    QH_CFBailScaleValue qH_CFBailScaleVal = FuturesManageCommon.GetQHCFBailScaleValueModel(m_CFBailScaleValueID);
                    //当子ID的数据存在时,则删除子数据,无论子数据是否删除成功,都继续执行删除当前的记录
                    if (qH_CFBailScaleVal.RelationScaleID != AppGlobalVariable.INIT_INT ||
                        string.IsNullOrEmpty(qH_CFBailScaleVal.RelationScaleID.Value.ToString()))
                    {
                        FuturesManageCommon.DeleteQHCFBailScaleValue(Convert.ToInt32(qH_CFBailScaleVal.RelationScaleID));
                    }
                    m_Result = FuturesManageCommon.DeleteQHCFBailScaleValue(m_CFBailScaleValueID);
                }

                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_CFBailScaleValueID = AppGlobalVariable.INIT_INT;
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
                this.QueryQHCFBailScaleValue();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6446";
                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 btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No)
                {
                    return;
                }

                DataRow _dr = this.gdPositionLimitValueSelect.GetDataRow(this.gdPositionLimitValueSelect.FocusedRowHandle);
                if (_dr == null)
                {
                    ShowMessageBox.ShowInformation("请选择数据!");
                    return;
                }

                if (!string.IsNullOrEmpty(Convert.ToString(_dr["PositionLimitValueID"])))
                {
                    m_PositionLimitValueID = Convert.ToInt32(_dr["PositionLimitValueID"]);
                }
                else
                {
                    m_PositionLimitValueID = AppGlobalVariable.INIT_INT;
                }

                if (m_PositionLimitValueID != AppGlobalVariable.INIT_INT)
                {
                    m_Result = FuturesManageCommon.DeleteQHPositionLimitValue(m_PositionLimitValueID);
                }

                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_PositionLimitValueID = AppGlobalVariable.INIT_INT;
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
                this.QueryQHPositionLimitValue();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6466";
                string      errMsg    = "删除(商品)期货_持仓限制失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 根据查询条件,获取品种_期货_交易费用
        /// </summary>
        /// <returns></returns>
        private bool QueryQHFutureCosts()
        {
            try
            {
                string  breedClassName   = this.txtBreedClassID.Text;
                DataSet _dsQHFutureCosts = FuturesManageCommon.GetAllQHFutureCosts(breedClassName,
                                                                                   m_pageNo,
                                                                                   m_pageSize,
                                                                                   out m_rowCount);
                DataTable _dtQHFutureCosts;
                if (_dsQHFutureCosts == null || _dsQHFutureCosts.Tables[0].Rows.Count == 0)
                {
                    _dtQHFutureCosts = new DataTable();
                }
                else
                {
                    _dtQHFutureCosts = _dsQHFutureCosts.Tables[0];
                }

                //绑定绑定品种类型是商品期货或股指期货的品种名称
                this.ddlBreedClassID.DataSource  = CommonParameterSetCommon.GetQHFutureCostsBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    CommonParameterSetCommon.GetQHFutureCostsBreedClassName().Tables[0].Columns["BreedClassID"].
                    ToString();
                this.ddlBreedClassID.DisplayMember =
                    CommonParameterSetCommon.GetQHFutureCostsBreedClassName().Tables[0].Columns["BreedClassName"].
                    ToString();

                //绑定货币类型
                this.ddlCurrencyTypeID.DataSource    = BindData.GetBindListCurrencyType();
                this.ddlCurrencyTypeID.ValueMember   = "ValueIndex";
                this.ddlCurrencyTypeID.DisplayMember = "TextTitleValue";

                //绑定手续费类型
                this.ddlCostType.DataSource    = BindData.GetBindListFutrueCostType();
                this.ddlCostType.ValueMember   = "ValueIndex";
                this.ddlCostType.DisplayMember = "TextTitleValue";

                this.gdFutureCostsResult.DataSource = _dtQHFutureCosts;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6204";
                string      errMsg    = "根据查询条件,获取品种_期货_交易费用失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 根据查询条件,获取(商品)期货_持仓限制
        /// </summary>
        /// <returns></returns>
        private bool QueryQHPositionLimitValue()
        {
            try
            {
                string BreedClassName      = this.txtBreedClassName.Text;
                int    PositionBailTypeID  = AppGlobalVariable.INIT_INT;
                int    DeliveryMonthTypeID = AppGlobalVariable.INIT_INT;
                if (!string.IsNullOrEmpty(cmbPositionBailTypeID.Text))
                {
                    PositionBailTypeID = ((UComboItem)cmbPositionBailTypeID.SelectedItem).ValueIndex;
                }
                if (!string.IsNullOrEmpty(cmbDeliveryMonthTypeID.Text))
                {
                    DeliveryMonthTypeID = ((UComboItem)cmbDeliveryMonthTypeID.SelectedItem).ValueIndex;
                }
                DataSet _dsQHPositionLimitV = FuturesManageCommon.GetAllQHPositionLimitValue(BreedClassName, DeliveryMonthTypeID, PositionBailTypeID,
                                                                                             m_pageNo,
                                                                                             m_pageSize,
                                                                                             out m_rowCount);
                DataTable _dtQHPositionLimitV;
                if (_dsQHPositionLimitV == null || _dsQHPositionLimitV.Tables[0].Rows.Count == 0)
                {
                    _dtQHPositionLimitV = new DataTable();
                }
                else
                {
                    _dtQHPositionLimitV = _dsQHPositionLimitV.Tables[0];
                }

                //绑定商品期货类型的品种名称
                this.ddlBreedClassID.DataSource  = CommonParameterSetCommon.GetSpQhTypeBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    CommonParameterSetCommon.GetSpQhTypeBreedClassName().Tables[0].Columns["BreedClassID"].ToString();
                this.ddlBreedClassID.DisplayMember =
                    CommonParameterSetCommon.GetSpQhTypeBreedClassName().Tables[0].Columns["BreedClassName"].ToString();

                this.gdPositionLimitValueResult.DataSource = _dtQHPositionLimitV;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6465";
                string      errMsg    = "根据查询条件,获取(商品)期货_持仓限制失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
            return(true);
        }
        /// <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;
            }
        }
        //================================  事件 ================================

        #region 添加或修改合约交割月份UI AgreementDeliMonthManageUI_Load

        /// <summary>
        /// 添加或修改合约交割月份UI AgreementDeliMonthManageUI_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AgreementDeliMonthManageUI_Load(object sender, EventArgs e)
        {
            try
            {
                //绑定期货交易规则表中的品种ID对应的品种名称
                //this.cmbBreedClassID.Properties.Items.Clear();
                //this.GetBindBreedClassName(); //获取期货交易规则表中的品种ID对应的品种名称
                //this.cmbBreedClassID.SelectedIndex = 0;
                labBreedClassName.Text = SpotManageCommon.GetBreedClassNameByID(m_BreedClassID);
                List <QH_AgreementDeliveryMonth> MonthID = new List <QH_AgreementDeliveryMonth>();
                MonthID = FuturesManageCommon.GetQHAgreementDeliveryMonth(m_BreedClassID);

                foreach (Control c in this.panelControl1.Controls)
                {
                    if (c is DevExpress.XtraEditors.CheckEdit)
                    {
                        DevExpress.XtraEditors.CheckEdit checkEdit = (DevExpress.XtraEditors.CheckEdit)c;

                        int id = int.Parse(c.Name.Substring(9));

                        CheckTag ct = new CheckTag();
                        ct.ID             = id;
                        ct.InitIsChecked  = false;
                        checkEdit.Checked = false;

                        foreach (QH_AgreementDeliveryMonth i in MonthID)
                        {
                            if (i.MonthID == id)
                            {
                                ct.InitIsChecked  = true;
                                checkEdit.Checked = true;
                            }
                        }
                        c.Tag = ct;
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5870";
                string      errMsg    = "添加或修改合约交割月份UI加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 根据查询条件,获取期货交易规则
        /// </summary>
        /// <returns></returns>
        private bool QueryFuturesTradeRules()
        {
            try
            {
                string  breedClassName       = this.txtBreeClassName.Text;
                DataSet _dsFuturesTradeRules = FuturesManageCommon.GetAllFuturesTradeRules(breedClassName,
                                                                                           m_pageNo,
                                                                                           m_pageSize,
                                                                                           out m_rowCount);
                DataTable _dtFuturesTradeRules;
                if (_dsFuturesTradeRules == null || _dsFuturesTradeRules.Tables[0].Rows.Count == 0)
                {
                    _dtFuturesTradeRules = new DataTable();
                }
                else
                {
                    _dtFuturesTradeRules = _dsFuturesTradeRules.Tables[0];
                }

                //绑定品种名称
                this.ddlBreedClassID.DataSource  = CommonParameterSetCommon.GetQHFutureCostsBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    CommonParameterSetCommon.GetQHFutureCostsBreedClassName().Tables[0].Columns["BreedClassID"].ToString
                        ();
                this.ddlBreedClassID.DisplayMember =
                    CommonParameterSetCommon.GetQHFutureCostsBreedClassName().Tables[0].Columns["BreedClassName"].
                    ToString();


                this.gdFuturesTradeRulesResult.DataSource = _dtFuturesTradeRules;
                foreach (DevExpress.XtraGrid.Columns.GridColumn _col in this.gdvFuturesTradeRulesSelect.Columns)
                {
                    _col.Width = this.gdFuturesTradeRulesResult.Size.Width / this.gdvFuturesTradeRulesSelect.Columns.Count + 50;
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5826";
                string      errMsg    = "根据查询条件,获取期货交易规则失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
            return(true);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 添加或修改合约交割月份UI
        /// </summary>
        private void AddOrUpdateUIAgreementDeliveryMonth()
        {
            AgreementDeliMonthManageUI agreementDeliMonthManageUI = new AgreementDeliMonthManageUI();

            if (m_BreedClassID != AppGlobalVariable.INIT_INT)
            {
                if (
                    FuturesManageCommon.ExistsFuturesTradeRules(
                        ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex))
                {
                    agreementDeliMonthManageUI.m_BreedClassID = m_BreedClassID;
                    agreementDeliMonthManageUI.ShowDialog();
                }
                else
                {
                    ShowMessageBox.ShowInformation("请点击确定按钮!");
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 根据查询条件,获取所有股指期货持仓限制和品种_股指期货_保证金数据
        /// </summary>
        /// <returns></returns>
        private bool QueryQHSIFPositionAndBail()
        {
            try
            {
                string  breedClassName          = this.txtBreedClassID.Text;
                DataSet _dsQHSIFPositionAndBail = FuturesManageCommon.GetAllQHSIFPositionAndQHSIFBail(breedClassName,
                                                                                                      m_pageNo,
                                                                                                      m_pageSize,
                                                                                                      out m_rowCount);
                DataTable _dtQHSIFPositionAndBail;
                if (_dsQHSIFPositionAndBail == null || _dsQHSIFPositionAndBail.Tables[0].Rows.Count == 0)
                {
                    _dtQHSIFPositionAndBail = new DataTable();
                }
                else
                {
                    _dtQHSIFPositionAndBail = _dsQHSIFPositionAndBail.Tables[0];
                }

                //绑定品种类型是股指期货的品种名称
                this.ddlBreedClassID.DataSource =
                    CommonParameterSetCommon.GetQHSIFPositionAndBailBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    CommonParameterSetCommon.GetQHSIFPositionAndBailBreedClassName().Tables[0].Columns["BREEDCLASSID"].
                    ToString();
                this.ddlBreedClassID.DisplayMember =
                    CommonParameterSetCommon.GetQHSIFPositionAndBailBreedClassName().Tables[0].Columns["BREEDCLASSNAME"]
                    .
                    ToString();


                this.gdSIFPositionAndSIFBailResult.DataSource = _dtQHSIFPositionAndBail;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6485";
                string      errMsg    = "根据查询条件,获取所有股指期货持仓限制和品种_股指期货_保证金数据失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 当前UI是修改期货最小和最大委托量UI时,初始化控件的值 UpdateInitData
        /// </summary>
        private void UpdateInitData()
        {
            try
            {
                if (UpdateConsignQuantumID != AppGlobalVariable.INIT_INT)
                {
                    QH_ConsignQuantum qH_ConsignQuantum =
                        FuturesManageCommon.GetQHConsignQuantumModel(UpdateConsignQuantumID);
                    List <QH_SingleRequestQuantity> qH_SingleRequestQuantity = FuturesManageCommon.GetQHSingleRQuantityListByConsignQuantumID(UpdateConsignQuantumID);

                    if (qH_ConsignQuantum != null && qH_SingleRequestQuantity != null)
                    {
                        this.txtMinConsignQuantum.Text = qH_ConsignQuantum.MinConsignQuantum.ToString();
                        for (int i = 0; i < qH_SingleRequestQuantity.Count; i++)
                        {
                            if ((int)Types.MarketPriceType.MarketPrice ==
                                qH_SingleRequestQuantity[i].ConsignInstructionTypeID)
                            {
                                txtMarketQuantum.Text         = qH_SingleRequestQuantity[i].MaxConsignQuanturm.ToString();
                                m_MarkSingleRequestQuantityID =
                                    qH_SingleRequestQuantity[i].SingleRequestQuantityID;
                            }
                            if ((int)Types.MarketPriceType.otherPrice ==
                                qH_SingleRequestQuantity[i].ConsignInstructionTypeID)
                            {
                                this.txtLimitQuantum.Text      = qH_SingleRequestQuantity[i].MaxConsignQuanturm.ToString();
                                m_LimitSingleRequestQuantityID = qH_SingleRequestQuantity[i].SingleRequestQuantityID;
                            }
                        }
                        m_ConsignQuantumID = qH_ConsignQuantum.ConsignQuantumID;
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5862";
                string      errMsg    = "当前UI是修改期货最小和最大委托量UI时,初始化控件的值失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 绑定保证金关系表数据
        /// </summary>
        /// <param name="id"></param>
        private void BindRelationValues(int id)
        {
            QH_CFBailScaleValue model = FuturesManageCommon.GetQHCFBailScaleValueModel(id);

            if (model != null)
            {
                chkLastTrDay.Checked = true;
                //if (model.LowerLimitIfEquation.Value == (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes)
                //{
                //    //checkBox4.Checked = true;
                //}
                //else
                //{
                //    //checkBox4.Checked = false;
                //}
                if (model.UpperLimitIfEquation.Value == (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.Yes)
                {
                    checkBox5.Checked = true;
                }
                else
                {
                    checkBox5.Checked = false;
                }
                //if (model.Start != null)
                //{
                //    //txtStart2.Text = model.Start.Value.ToString();
                //}
                if (model.Ends != null)
                {
                    txtEnds2.Text = model.Ends.Value.ToString();
                }
                if (model.BailScale != null)
                {
                    txtBailScale2.Text = model.BailScale.Value.ToString();
                }
                m_CFBailScaleValueID2 = Convert.ToInt32(model.CFBailScaleValueID);
            }
        }
        /// <summary>
        /// 删除期货交易规则
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (ShowMessageBox.ShowQuestion("确认删除交易规则吗?") == DialogResult.No)
                {
                    return;
                }

                DataRow _dr = this.gdvFuturesTradeRulesSelect.GetDataRow(this.gdvFuturesTradeRulesSelect.FocusedRowHandle);
                if (_dr == null)
                {
                    ShowMessageBox.ShowInformation("请选择数据!");
                    return;
                }

                if (!string.IsNullOrEmpty(Convert.ToString(_dr["BreedClassID"])))
                {
                    m_BreedClassID = Convert.ToInt32(_dr["BreedClassID"]);
                }
                else
                {
                    m_BreedClassID = AppGlobalVariable.INIT_INT;
                }

                if (!string.IsNullOrEmpty(Convert.ToString(_dr["LastTradingDayID"])))
                {
                    m_LastTradingDayID = Convert.ToInt32(_dr["LastTradingDayID"]);
                }
                else
                {
                    m_LastTradingDayID = AppGlobalVariable.INIT_INT;
                }

                if (!string.IsNullOrEmpty(Convert.ToString(_dr["ConsignQuantumID"])))
                {
                    m_ConsignQuantumID = Convert.ToInt32(_dr["ConsignQuantumID"]);
                }
                else
                {
                    m_ConsignQuantumID = AppGlobalVariable.INIT_INT;
                }
                if (m_BreedClassID != AppGlobalVariable.INIT_INT)
                {
                    m_Result = FuturesManageCommon.DeleteFuturesTradeRulesAboutAll(m_BreedClassID);
                }

                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_BreedClassID     = AppGlobalVariable.INIT_INT;
                    m_LastTradingDayID = AppGlobalVariable.INIT_INT;
                    m_ConsignQuantumID = AppGlobalVariable.INIT_INT;
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
                this.QueryFuturesTradeRules();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5824";
                string      errMsg    = "删除期货交易规则数据失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 根据查询条件,获取商品期货_保证金比例
        /// </summary>
        /// <returns></returns>
        private bool QueryQHCFBailScaleValue()
        {
            try
            {
                string BreedClassName      = this.txtBreedClassName.Text;
                int    PositionBailTypeID  = AppGlobalVariable.INIT_INT;
                int    DeliveryMonthTypeID = AppGlobalVariable.INIT_INT;
                if (!string.IsNullOrEmpty(cmbPositionBailTypeID.Text))
                {
                    PositionBailTypeID = ((UComboItem)cmbPositionBailTypeID.SelectedItem).ValueIndex;
                }
                if (!string.IsNullOrEmpty(cmbDeliveryMonthTypeID.Text))
                {
                    ;
                    DeliveryMonthTypeID = ((UComboItem)cmbDeliveryMonthTypeID.SelectedItem).ValueIndex;
                }
                DataSet _dsQHCFBailScaleV = FuturesManageCommon.GetAllQHCFBailScaleValue(BreedClassName,
                                                                                         DeliveryMonthTypeID,
                                                                                         PositionBailTypeID,
                                                                                         m_pageNo,
                                                                                         m_pageSize,
                                                                                         out m_rowCount);
                DataTable _dtQHCFBailScaleV;
                if (_dsQHCFBailScaleV == null || _dsQHCFBailScaleV.Tables[0].Rows.Count == 0)
                {
                    _dtQHCFBailScaleV = new DataTable();
                }
                else
                {
                    _dtQHCFBailScaleV = _dsQHCFBailScaleV.Tables[0];

                    int _CFBailScaleValueID = 0;//商品期货保证金比例ID
                    for (int i = 0; i < _dtQHCFBailScaleV.Rows.Count; i++)
                    {
                        _CFBailScaleValueID = 0;
                        if (_dtQHCFBailScaleV.Rows[i][10] != System.DBNull.Value)
                        {
                            _CFBailScaleValueID = Convert.ToInt32(_dtQHCFBailScaleV.Rows[i][10]);
                        }

                        if (_CFBailScaleValueID != 0)
                        {
                            for (int j = 0; j < _dtQHCFBailScaleV.Rows.Count; j++)
                            {
                                if (Convert.ToInt32(_dtQHCFBailScaleV.Rows[j][1]) == _CFBailScaleValueID)
                                {
                                    _dtQHCFBailScaleV.Rows.RemoveAt(j);
                                    i++;
                                    break;
                                }
                            }
                        }
                    }
                }

                //绑定商品期货类型的品种名称
                this.ddlBreedClassID.DataSource  = CommonParameterSetCommon.GetSpQhTypeBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    CommonParameterSetCommon.GetSpQhTypeBreedClassName().Tables[0].Columns["BreedClassID"].ToString();
                this.ddlBreedClassID.DisplayMember =
                    CommonParameterSetCommon.GetSpQhTypeBreedClassName().Tables[0].Columns["BreedClassName"].ToString();

                this.gdCFBailScaleValueResult.DataSource = _dtQHCFBailScaleV;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-6445";
                string      errMsg    = "根据查询条件,获取商品期货_保证金比例失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 当前UI是修改最后交易日UI时,初始化控件的值 UpdateInitData
        /// </summary>
        private void UpdateInitData()
        {
            try
            {
                if (UpdateLastTradingDayID != AppGlobalVariable.INIT_INT)
                {
                    QH_LastTradingDay qH_LastTradingDay =
                        FuturesManageCommon.GetQHLastTradingDayModel(UpdateLastTradingDayID);

                    if (qH_LastTradingDay != null)
                    {
                        if (qH_LastTradingDay.LastTradingDayTypeID != 0)
                        {
                            foreach (object item in this.cmbLastTradingDayType.Properties.Items)
                            {
                                if (((UComboItem)item).ValueIndex == qH_LastTradingDay.LastTradingDayTypeID)
                                {
                                    this.cmbLastTradingDayType.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.cmbLastTradingDayType.SelectedIndex = 0;
                        }

                        if (qH_LastTradingDay.Week != 0)
                        {
                            foreach (object item in this.cmbWeek.Properties.Items)
                            {
                                if (((UComboItem)item).ValueIndex == qH_LastTradingDay.Week)
                                {
                                    this.cmbWeek.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.cmbWeek.SelectedIndex = 0;
                        }

                        if (qH_LastTradingDay.Sequence != 0)
                        {
                            foreach (object item in this.cmbSequence.Properties.Items)
                            {
                                if (((UComboItem)item).ValueIndex == qH_LastTradingDay.Sequence)
                                {
                                    this.cmbSequence.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.cmbSequence.SelectedIndex = 0;
                        }
                        this.speWhatDay.Text  = qH_LastTradingDay.WhatDay.ToString();
                        this.speWhatWeek.Text = qH_LastTradingDay.WhatWeek.ToString();
                        m_LastTradingDayID    = qH_LastTradingDay.LastTradingDayID;
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5842";
                string      errMsg    = "当前UI是修改最后交易日UI时,初始化控件的值失败!";
                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_LastTradingDay qHLastTradingDay = new QH_LastTradingDay();

                if (!string.IsNullOrEmpty(this.cmbLastTradingDayType.Text))
                {
                    qHLastTradingDay.LastTradingDayTypeID =
                        ((UComboItem)this.cmbLastTradingDayType.SelectedItem).ValueIndex;
                }
                else
                {
                    // qHLastTradingDay.LastTradingDayTypeID = AppGlobalVariable.INIT_INT;
                    ShowMessageBox.ShowInformation("最后交易日类型不能为空!");
                    return;
                }

                if (!string.IsNullOrEmpty(this.cmbSequence.Text))
                {
                    qHLastTradingDay.Sequence =
                        ((UComboItem)this.cmbSequence.SelectedItem).ValueIndex;
                }
                else
                {
                    qHLastTradingDay.Sequence = AppGlobalVariable.INIT_INT;
                }

                if (!string.IsNullOrEmpty(this.cmbWeek.Text))
                {
                    qHLastTradingDay.Week =
                        ((UComboItem)this.cmbWeek.SelectedItem).ValueIndex;
                }
                else
                {
                    qHLastTradingDay.Week = AppGlobalVariable.INIT_INT;
                }

                if (!string.IsNullOrEmpty(this.speWhatDay.Text))
                {
                    qHLastTradingDay.WhatDay = Convert.ToInt32(this.speWhatDay.EditValue);
                    ;
                }
                else
                {
                    qHLastTradingDay.WhatDay = AppGlobalVariable.INIT_INT;
                }

                if (!string.IsNullOrEmpty(this.speWhatWeek.Text))
                {
                    qHLastTradingDay.WhatWeek = Convert.ToInt32(this.speWhatWeek.EditValue);
                }
                else
                {
                    qHLastTradingDay.WhatWeek = AppGlobalVariable.INIT_INT;
                }


                if (LastTradingDayUIEditType == (int)UITypes.EditTypeEnum.AddUI)
                {
                    int lastTradingDayID = FuturesManageCommon.AddQHLastTradingDay(qHLastTradingDay);
                    if (lastTradingDayID != AppGlobalVariable.INIT_INT)
                    {
                        LastTradingDayID = lastTradingDayID;
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                else if (LastTradingDayUIEditType == (int)UITypes.EditTypeEnum.UpdateUI)
                {
                    switch (this.cmbLastTradingDayType.SelectedIndex)
                    {
                    case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAndDay - 1:
                        qHLastTradingDay.WhatWeek = 0;
                        qHLastTradingDay.Week     = 0;
                        qHLastTradingDay.Sequence = 1;    //默认顺数
                        break;

                    case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAndDownOrShunAndWeek - 1:
                        //qHLastTradingDay.WhatDay = 0;
                        qHLastTradingDay.Week     = 0;
                        qHLastTradingDay.WhatWeek = 0;
                        break;

                    case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAndWeek - 1:
                        qHLastTradingDay.WhatDay  = 0;
                        qHLastTradingDay.Sequence = 1;    //默认顺数
                        break;

                    case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAgoMonthLastTradeDay - 1:
                        qHLastTradingDay.WhatWeek = 0;
                        qHLastTradingDay.Week     = 0;
                        //qHLastTradingDay.Sequence = 1;//默认顺数
                        break;
                    }
                    if (m_UpdateLastTradingDayID != AppGlobalVariable.INIT_INT)
                    {
                        qHLastTradingDay.LastTradingDayID = m_LastTradingDayID;
                    }
                    bool _UpResult = FuturesManageCommon.UpdateQHLastTradingDay(qHLastTradingDay);
                    if (_UpResult)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5841";
                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
            {
                List <int> addID = new List <int>();
                List <int> delID = new List <int>();

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