//================================  事件 ================================

        #region 现货_交易商品品种_持仓限制 管理UI SpotPositionManageUI_Load

        /// <summary>
        /// 现货_交易商品品种_持仓限制 管理UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SpotPositionManageUI_Load(object sender, EventArgs e)
        {
            try
            {
                //绑定交易规则表中的品种ID对应的品种名称
                this.cmbBreedClassID.Properties.Items.Clear();
                this.GetBindBreedClassName(); //获取交易规则表中的品种ID对应的品种名称
                this.cmbBreedClassID.SelectedIndex = 0;

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

                //绑定查询结果
                this.m_pageNo = 1;
                this.gdSpotPositionResult.DataSource = this.QuerySpotPosition();
                this.ShowDataPage();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5600";
                string      errMsg    = "现货_交易商品品种_持仓限制窗体加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 根据查询条件,获取现货最小交易单位
        /// </summary>
        /// <returns></returns>
        private bool QueryMinVolumeOfBusiness()
        {
            try
            {
                string  BreedClassName    = this.txtBreedClassName.Text;
                DataSet _dsMinVolumeOfBus = SpotManageCommon.GetAllXHMinVolumeOfBusiness(BreedClassName, m_pageNo,
                                                                                         m_pageSize,
                                                                                         out m_rowCount);
                DataTable _dtMinVolumeOfBus;
                if (_dsMinVolumeOfBus == null || _dsMinVolumeOfBus.Tables[0].Rows.Count == 0)
                {
                    _dtMinVolumeOfBus = new DataTable();
                }
                else
                {
                    _dtMinVolumeOfBus = _dsMinVolumeOfBus.Tables[0];
                }
                this.gdMinVolumeOfBusResult.DataSource = _dtMinVolumeOfBus;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5086";
                string      errMsg    = "根据查询条件,获取现货最小交易单位失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 获取当前行需要修改的数据
        /// </summary>
        /// <param name="handle">当前行号</param>
        private void UpdateSpotTradeRules(int handle)
        {
            try
            {
                if (handle < 0)
                {
                    return;
                }
                //显示添加现货规则窗体
                AddSpotTradeRulesUI addSpotTradeRulesUI = new AddSpotTradeRulesUI();
                addSpotTradeRulesUI.EditType = (int)UITypes.EditTypeEnum.UpdateUI;
                DataRow           _dr              = this.gdvSpotTradeRulesSelect.GetDataRow(handle);
                int               breedClassID     = Convert.ToInt32(_dr["BreedClassID"]);
                XH_SpotTradeRules xHSpotTradeRules = SpotManageCommon.GetModel(breedClassID);
                addSpotTradeRulesUI.XHSpotTradeRules = xHSpotTradeRules;

                if (addSpotTradeRulesUI.ShowDialog(this) == DialogResult.OK)
                {
                    this.QuerySpotTradeRules();
                    this.gdvSpotTradeRulesSelect.FocusedRowHandle = handle;
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5023";
                string      errMsg    = "获取当前行需要修改的数据失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                throw exception;
            }
        }
 /// <summary>
 /// gdSpotTradeRulesQResult的单击事件 gdSpotTradeRulesQResult_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gdSpotTradeRulesQResult_Click(object sender, EventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi =
         this.gdvSpotTradeRulesSelect.CalcHitInfo(((Control)sender).PointToClient(Control.MousePosition));
     if (this.gdvSpotTradeRulesSelect != null && this.gdvSpotTradeRulesSelect.FocusedRowHandle >= 0 &&
         hi.RowHandle >= 0)
     {
         int CurRow = this.gdvSpotTradeRulesSelect.FocusedRowHandle;
         if (CurRow < 0)
         {
             return;
         }
         DataRow   _dr            = this.gdvSpotTradeRulesSelect.GetDataRow(CurRow);
         int       breedClassID   = Convert.ToInt32(_dr["BreedClassID"]);
         DataSet   _dsSpotTRulesD = SpotManageCommon.GetSpotTradeRulesDetail(breedClassID);
         DataTable _dtSpotTrulesD;
         if (_dsSpotTRulesD == null || _dsSpotTRulesD.Tables[0].Rows.Count == 0)
         {
             _dtSpotTrulesD = new DataTable();
         }
         else
         {
             _dtSpotTrulesD = _dsSpotTRulesD.Tables[0];
         }
         //if (_dtSpotTrulesD != null)
         if (_dtSpotTrulesD.Rows.Count > 0)
         {
             if (_dtSpotTrulesD.Rows[0]["VALIDDECLARETYPEID"] != DBNull.Value)
             {
                 int validDTypeID = Convert.ToInt32(_dtSpotTrulesD.Rows[0]["VALIDDECLARETYPEID"]);
                 //当有效申报类型是:价位时,涨跌幅类型显示为“港股”
                 if (validDTypeID == (int)GTA.VTS.Common.CommonObject.Types.XHValidDeclareType.DownBuyOneAndSaleOne)
                 {
                     _dtSpotTrulesD.Rows[0]["HIGHLOWTYPEID"] = 5;//改变涨跌幅界面显示的类型值是5
                     //绑定涨跌幅类型
                     this.ddlHighLowTypeID.DataSource    = BindData.GetBindListXHHighLowTypeDisplayAll();
                     this.ddlHighLowTypeID.ValueMember   = "ValueIndex";
                     this.ddlHighLowTypeID.DisplayMember = "TextTitleValue";
                 }
                 else
                 {
                     //绑定涨跌幅类型
                     this.ddlHighLowTypeID.DataSource    = BindData.GetBindListXHHighLowTypeDisplayAll();
                     this.ddlHighLowTypeID.ValueMember   = "ValueIndex";
                     this.ddlHighLowTypeID.DisplayMember = "TextTitleValue";
                 }
             }
         }
         //绑定有效申报类型
         this.ddlValidDeclareTypeID.DataSource    = BindData.GetBindListXHValidDeclareTypeDisplayAll();
         this.ddlValidDeclareTypeID.ValueMember   = "ValueIndex";
         this.ddlValidDeclareTypeID.DisplayMember = "TextTitleValue";
         this.gdSpotTRulesDetailResult.DataSource = _dtSpotTrulesD;
     }
     //else
     //{
     //    ShowMessageBox.ShowInformation("请选择记录!");
     //}
 }
        //================================  事件 ================================

        #region 现货最小交易单位管理窗体 MinVolumeOfBusinessManageUI_Load

        /// <summary>
        /// 现货最小交易单位管理窗体 MinVolumeOfBusinessManageUI_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MinVolumeOfBusinessManageUI_Load(object sender, EventArgs e)
        {
            try
            {
                //初次加载时,更新按钮禁用
                //btnModify.Enabled = false;
                this.cmbBreedClassID.Properties.Items.Clear();
                this.GetXHAndHKBindBreedClassName(); //根据现货规则表和港股规则表中的品种标识获取品种名称
                this.cmbBreedClassID.SelectedIndex = 0;
                this.cmbTradeWayID.Properties.Items.Clear();
                this.cmbTradeWayID.Properties.Items.AddRange(BindData.GetBindListTransDire()); //绑定交易方向
                this.cmbTradeWayID.SelectedIndex = 0;
                this.cmbUnitID.Properties.Items.Clear();
                this.cmbUnitID.Properties.Items.AddRange(BindData.GetBindListXHAboutUnit());//GetBindListUnitType()); //绑定单位类型
                this.cmbUnitID.SelectedIndex = 0;

                //绑定交易方向
                this.ddlTradeWayID.DataSource    = BindData.GetBindListTransDire();
                this.ddlTradeWayID.ValueMember   = "ValueIndex";
                this.ddlTradeWayID.DisplayMember = "TextTitleValue";

                //绑定交易单位
                this.ddlUnitID.DataSource    = BindData.GetBindListUnitType();
                this.ddlUnitID.ValueMember   = "ValueIndex";
                this.ddlUnitID.DisplayMember = "TextTitleValue";

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


                //绑定查询结果
                this.m_pageNo = 1;
                this.gdMinVolumeOfBusResult.DataSource = this.QueryMinVolumeOfBusiness();
                this.ShowDataPage();

                //禁用界面上输入框
                this.cmbBreedClassID.Enabled     = false;
                this.txtVolumeOfBusiness.Enabled = false;
                this.cmbTradeWayID.Enabled       = false;
                this.cmbUnitID.Enabled           = false;
                this.btnOK.Enabled = false;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5080";
                string      errMsg    = "现货最小交易单位管理窗体加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
        //================================  私有  方法 ================================

        #region 获取现货品种名称 GetBindBreedClassName

        /// <summary>
        /// 获取现货品种名称
        /// </summary>
        private void GetBindBreedClassName()
        {
            DataSet    ds = SpotManageCommon.GetBreedClassName(); //从交易商品品种表中获取
            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);
            }
        }
        /// <summary>
        /// 根据查询条件,获取现货交易规则
        /// </summary>
        /// <returns></returns>
        private bool QuerySpotTradeRules()
        {
            try
            {
                string  breedClassName    = this.txtBreeClassName.Text;
                DataSet _dsSpotTradeRules = SpotManageCommon.GetAllSpotTradeRules(breedClassName,
                                                                                  m_pageNo,
                                                                                  m_pageSize,
                                                                                  out m_rowCount);
                DataTable _dtSpotTradeRule;
                if (_dsSpotTradeRules == null || _dsSpotTradeRules.Tables[0].Rows.Count == 0)
                {
                    _dtSpotTradeRule = new DataTable();
                }
                else
                {
                    _dtSpotTradeRule = _dsSpotTradeRules.Tables[0];
                }

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


                this.gdSpotTradeRulesQResult.DataSource = _dtSpotTradeRule;
                //设置GridView显示效果
                foreach (DevExpress.XtraGrid.Columns.GridColumn _gridColumn in this.gdvSpotTradeRulesSelect.Columns)
                {
                    //switch (_gridColumn.FieldName.ToUpper())
                    //{
                    //    case "VALUETYPEMINCHANGEPRICE":
                    //        _gridColumn.Width = 90;
                    //        break;

                    //}
                    _gridColumn.Width = this.gdSpotTradeRulesQResult.Size.Width /
                                        this.gdvSpotTradeRulesSelect.Columns.Count + 6;
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5025";
                string      errMsg    = "根据查询条件,获取现货交易规则失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                throw exception;
            }
            return(true);
        }
Esempio n. 8
0
        /// <summary>
        /// 删除现货交易费用 btnDelete_Click
        /// </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.gdvSpotCostsSelect.GetDataRow(this.gdvSpotCostsSelect.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 (m_BreedClassID != AppGlobalVariable.INIT_INT)
                {
                    //注意需要判断多值是,把此品种ID下的所有多值交易手续费删除
                    m_Result = SpotManageCommon.DeleteSpotCosts(m_BreedClassID);
                }

                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_BreedClassID = AppGlobalVariable.INIT_INT;
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
                this.QuerySpotCosts();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5422";
                string      errMsg    = "删除现货交易费用失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        //================================  事件 ================================

        #region 现货单位换算管理窗体 SpotUnitConversionManageUI_Load

        /// <summary>
        /// 现货单位换算管理窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SpotUnitConversionManageUI_Load(object sender, EventArgs e)
        {
            try
            {
                //初次加载时,更新按钮禁用
                //btnModify.Enabled = false;
                //绑定交易规则表中的品种ID对应的品种名称
                this.cmbBreedClassID.Properties.Items.Clear();
                this.GetBindBreedClassName(); //获取交易规则表中的品种ID对应的品种名称
                this.cmbBreedClassID.SelectedIndex = 0;

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

                //绑定从单位 From
                this.cmbUnitIDFrom.Properties.Items.Clear();
                this.cmbUnitIDFrom.Properties.Items.AddRange(BindData.GetBindListXHAboutUnit());
                this.cmbUnitIDFrom.SelectedIndex = 0;

                //绑定到单位 To
                this.cmbUnitIDTo.Properties.Items.Clear();
                this.cmbUnitIDTo.Properties.Items.AddRange(BindData.GetBindListXHAboutUnit());
                this.cmbUnitIDTo.SelectedIndex = 0;

                //绑定查询结果
                this.m_pageNo = 1;
                this.gdSpotUnitConversionRelult.DataSource = this.QuerySpotUnitConversion();
                this.ShowDataPage();

                //禁用文本框的编辑状态
                this.cmbBreedClassID.Enabled = false;
                this.cmbUnitIDFrom.Enabled   = false;
                this.cmbUnitIDTo.Enabled     = false;
                this.txtValue.Enabled        = false;
                this.btnOK.Enabled           = false;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5700";
                string      errMsg    = "现货单位换算管理窗体加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        //================================  事件 ================================

        #region 现货交易规则管理UI SpotTradeRulesManageUI_Load

        /// <summary>
        /// 现货交易规则管理UI SpotTradeRulesManageUI_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SpotTradeRulesManageUI_Load(object sender, EventArgs e)
        {
            try
            {
                //绑定最小变动价位
                this.ddlValueTypeMinChangePrice.DataSource    = BindData.GetBindListValueType();
                this.ddlValueTypeMinChangePrice.ValueMember   = "ValueIndex";
                this.ddlValueTypeMinChangePrice.DisplayMember = "TextTitleValue";

                //绑定每笔最大委托量单位
                this.ddlMaxLeaveQuantityUnit.DataSource    = BindData.GetBindListXHAboutUnit();
                this.ddlMaxLeaveQuantityUnit.ValueMember   = "ValueIndex";
                this.ddlMaxLeaveQuantityUnit.DisplayMember = "TextTitleValue";

                //绑定是否允许回转
                this.ddlIsSlew.DataSource    = BindData.GetBindListYesOrNo();
                this.ddlIsSlew.ValueMember   = "ValueIndex";
                this.ddlIsSlew.DisplayMember = "TextTitleValue";


                //绑定行情成交量单位
                this.ddlMarketUnitID.DataSource    = BindData.GetBindListXHAboutUnit();
                this.ddlMarketUnitID.ValueMember   = "ValueIndex";
                this.ddlMarketUnitID.DisplayMember = "TextTitleValue";

                //绑定计价单位
                this.ddlPriceUnit.DataSource    = BindData.GetBindListXHAboutUnit();
                this.ddlPriceUnit.ValueMember   = "ValueIndex";
                this.ddlPriceUnit.DisplayMember = "TextTitleValue";

                //绑定品种名称
                this.ddlBreedClassID.DataSource  = SpotManageCommon.GetBreedClassNameByBreedClassID().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    SpotManageCommon.GetBreedClassNameByBreedClassID().Tables[0].Columns["BreedClassID"].ToString();
                this.ddlBreedClassID.DisplayMember =
                    SpotManageCommon.GetBreedClassNameByBreedClassID().Tables[0].Columns["BreedClassName"].ToString();
                //绑定查询结果
                this.m_pageNo = 1;
                this.gdSpotTradeRulesQResult.DataSource = this.QuerySpotTradeRules();
                this.ShowDataPage();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5020";
                string      errMsg    = " 现货交易规则管理UI加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
        /// <summary>
        /// 根据查询条件,获取现货单位换算
        /// </summary>
        /// <returns></returns>
        private bool QuerySpotUnitConversion()
        {
            try
            {
                string  breedClassName        = this.txtBreedClassName.Text;
                DataSet _dsSpotUnitConversion = SpotManageCommon.GetAllCMUnitConversion(breedClassName,
                                                                                        m_pageNo,
                                                                                        m_pageSize,
                                                                                        out m_rowCount);
                DataTable _dtSpotUnitConversion;
                if (_dsSpotUnitConversion == null || _dsSpotUnitConversion.Tables[0].Rows.Count == 0)
                {
                    _dtSpotUnitConversion = new DataTable();
                }
                else
                {
                    _dtSpotUnitConversion = _dsSpotUnitConversion.Tables[0];
                }

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

                //绑定从单位 From
                this.ddlUnitIDFrom.DataSource    = BindData.GetBindListXHAboutUnit();
                this.ddlUnitIDFrom.ValueMember   = "ValueIndex";
                this.ddlUnitIDFrom.DisplayMember = "TextTitleValue";
                //绑定到单位 To
                this.ddlUnitIDTo.DataSource    = BindData.GetBindListXHAboutUnit();
                this.ddlUnitIDTo.ValueMember   = "ValueIndex";
                this.ddlUnitIDTo.DisplayMember = "TextTitleValue";

                this.gdSpotUnitConversionRelult.DataSource = _dtSpotUnitConversion;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5704";
                string      errMsg    = "根据查询条件,获取现货单位换算失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                throw exception;
                // return false;
            }
            return(true);
        }
        //================================  事件 ================================

        #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;
            }
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No)
         {
             return;
         }
         DataRow _dr = this.gdvMinVolumeOfBusSelect.GetDataRow(this.gdvMinVolumeOfBusSelect.FocusedRowHandle);
         if (_dr == null)
         {
             ShowMessageBox.ShowInformation("请选择数据!");
             return;
         }
         if (!string.IsNullOrEmpty(Convert.ToString(_dr["MinVolumeOfBusinessID"])))
         {
             m_MinVolumeOfBusinessID = Convert.ToInt32(_dr["MinVolumeOfBusinessID"]);
         }
         else
         {
             m_MinVolumeOfBusinessID = AppGlobalVariable.INIT_INT;
         }
         if (m_MinVolumeOfBusinessID != AppGlobalVariable.INIT_INT)
         {
             m_Result = SpotManageCommon.DeleteXHMinVolumeOfBusByID(m_MinVolumeOfBusinessID);
         }
         if (m_Result)
         {
             ShowMessageBox.ShowInformation("删除成功!");
             m_MinVolumeOfBusinessID = AppGlobalVariable.INIT_INT;
         }
         else
         {
             ShowMessageBox.ShowInformation("删除失败!");
         }
         this.QueryMinVolumeOfBusiness();
     }
     catch (Exception ex)
     {
         string      errCode   = "GL-5082";
         string      errMsg    = "删除现货最小交易单位失败!";
         VTException exception = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(exception.ToString(), exception.InnerException);
     }
 }
        //================================  事件 ================================

        #region 添加或修改现货交易规则窗体的 AddSpotTradeRulesUI_Load事件

        /// <summary>
        /// 添加或修改现货交易规则窗体的 AddSpotTradeRulesUI_Load事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddSpotTradeRulesUI_Load(object sender, EventArgs e)
        {
            try
            {
                if (EditType == (int)UITypes.EditTypeEnum.AddUI)
                {
                    m_SpotTradeRules             = new XH_SpotTradeRules();
                    this.cmbBreedClassID.Enabled = true;
                    //this.btnMinChangePriceV.Visible = false;//添加交易规则时最小变动价位范围不显示
                }
                this.InitBindData();

                if (EditType == (int)UITypes.EditTypeEnum.UpdateUI)
                {
                    this.UpdateInitData();
                    this.btnAddXHSpotHighLowValue.Text = "涨跌幅";
                    //this.btnAddXHValidDeclareValue.Text = "有效申报";
                    this.Text = "现货交易规则";
                    this.cmbBreedClassID.Enabled = false;
                }

                string BreedClassName = SpotManageCommon.GetBreedClassNameByID(m_BreedClassID);

                //if (((int)CommonObject.Types.GetValueTypeEnum.Scope ==
                //     ((UComboItem)this.cmbMinChangePriceVType.SelectedItem).ValueIndex)
                //    && BreedClassName == "香港H股")
                //{
                //    this.txtMinChangePrice.Enabled = false;
                //}
                //else
                //{
                //    this.txtMinChangePrice.Enabled = true;
                //}
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5000";
                string      errMsg    = "添加或修改现货交易规则窗体加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 根据查询条件,获取现货交易费用
        /// </summary>
        /// <returns></returns>
        private bool QuerySpotCosts()
        {
            try
            {
                string  breedClassName = this.txtBreedClassName.Text;
                DataSet _dsSpotCosts   = SpotManageCommon.GetAllSpotCosts(m_BreedClassID, breedClassName,
                                                                          m_pageNo,
                                                                          m_pageSize,
                                                                          out m_rowCount);
                DataTable _dtSpotCosts;
                if (_dsSpotCosts == null || _dsSpotCosts.Tables[0].Rows.Count == 0)
                {
                    _dtSpotCosts = new DataTable();
                }
                else
                {
                    _dtSpotCosts = _dsSpotCosts.Tables[0];
                }

                //绑定品种名称
                this.ddlBreedClassID.DataSource  = SpotManageCommon.GetSpotCostsBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    SpotManageCommon.GetSpotCostsBreedClassName().Tables[0].Columns["BreedClassID"].ToString();
                this.ddlBreedClassID.DisplayMember =
                    SpotManageCommon.GetSpotCostsBreedClassName().Tables[0].Columns["BreedClassName"].ToString();
                this.gdSpotCostsResult.DataSource = _dtSpotCosts;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5425";
                string      errMsg    = "根据查询条件,获取现货交易费用失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                throw exception;
            }

            return(true);
        }
Esempio n. 16
0
        //================================  事件 ================================

        #region 现货交易费UI SpotCostsManageUI_Load

        /// <summary>
        /// 现货交易费UI SpotCostsManageUI_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SpotCostsManageUI_Load(object sender, EventArgs e)
        {
            try
            {
                //绑定币种类型
                this.ddlCurrencyTypeID.DataSource    = BindData.GetBindListCurrencyType();
                this.ddlCurrencyTypeID.ValueMember   = "ValueIndex";
                this.ddlCurrencyTypeID.DisplayMember = "TextTitleValue";

                //绑定印花税收取方式
                this.ddlStampDutyTypeID.DataSource    = BindData.GetBindListStampDutyType();
                this.ddlStampDutyTypeID.ValueMember   = "ValueIndex";
                this.ddlStampDutyTypeID.DisplayMember = "TextTitleValue";

                //绑定过户费取值类型
                this.ddlTransferTollTypeID.DataSource    = BindData.GetBindListXHTransferTollType();
                this.ddlTransferTollTypeID.ValueMember   = "ValueIndex";
                this.ddlTransferTollTypeID.DisplayMember = "TextTitleValue";

                //绑定品种名称
                this.ddlBreedClassID.DataSource  = SpotManageCommon.GetSpotCostsBreedClassName().Tables[0];
                this.ddlBreedClassID.ValueMember =
                    SpotManageCommon.GetSpotCostsBreedClassName().Tables[0].Columns["BreedClassID"].ToString();
                this.ddlBreedClassID.DisplayMember =
                    SpotManageCommon.GetSpotCostsBreedClassName().Tables[0].Columns["BreedClassName"].ToString();
                //绑定查询结果
                this.m_pageNo = 1;
                this.gdSpotCostsResult.DataSource = this.QuerySpotCosts();
                this.ShowDataPage();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5420";
                string      errMsg    = "现货交易费UI加载失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
        /// <summary>
        ///  确定按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (m_EditType == 1)
            {
                #region 添加操作

                EditType = (int)UITypes.EditTypeEnum.AddUI;
                int result = AppGlobalVariable.INIT_INT;
                try
                {
                    CM_UnitConversion cM_UnitConversion = new CM_UnitConversion();
                    int breedClassID = AppGlobalVariable.INIT_INT; //品种ID
                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        breedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                        if (breedClassID != AppGlobalVariable.INIT_INT)
                        {
                            List <CM_UnitConversion> cMUnitConversionList =
                                SpotManageCommon.GetUnitConveByBreedClassID(breedClassID);
                            if (cMUnitConversionList.Count > 0)
                            {
                                int _curRow = 0; //当前记录行
                                foreach (CM_UnitConversion _UnitConversion in cMUnitConversionList)
                                {
                                    _curRow++;
                                    if (_UnitConversion.BreedClassID ==
                                        ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)
                                    {
                                        if (_UnitConversion.UnitIDFrom ==
                                            ((UComboItem)this.cmbUnitIDFrom.SelectedItem).ValueIndex &&
                                            _UnitConversion.UnitIDTo ==
                                            ((UComboItem)this.cmbUnitIDTo.SelectedItem).ValueIndex)
                                        {
                                            ShowMessageBox.ShowInformation("同一品种,同一从单位到单位的转换只允许一条记录!");
                                            break;
                                        }
                                        else
                                        {
                                            if (_curRow == cMUnitConversionList.Count)
                                            {
                                                string msg = string.Empty;
                                                cM_UnitConversion = VerifyUnitConversionInput(ref msg);
                                                if (!string.IsNullOrEmpty(msg))
                                                {
                                                    ShowMessageBox.ShowInformation(msg);
                                                }
                                                else
                                                {
                                                    result = SpotManageCommon.AddCMUnitConversion(cM_UnitConversion);
                                                    if (result != AppGlobalVariable.INIT_INT)
                                                    {
                                                        ShowMessageBox.ShowInformation("添加成功!");
                                                        this.ClearAll();
                                                        this.QuerySpotUnitConversion();
                                                    }
                                                    else
                                                    {
                                                        ShowMessageBox.ShowInformation("添加失败!");
                                                    }
                                                }
                                            }
                                        }
                                        continue;
                                    }
                                }
                            }
                            else
                            {
                                string msg = string.Empty;
                                cM_UnitConversion = VerifyUnitConversionInput(ref msg);
                                if (!string.IsNullOrEmpty(msg))
                                {
                                    ShowMessageBox.ShowInformation(msg);
                                }
                                else
                                {
                                    result = SpotManageCommon.AddCMUnitConversion(cM_UnitConversion);
                                    if (result != AppGlobalVariable.INIT_INT)
                                    {
                                        ShowMessageBox.ShowInformation("添加成功!");
                                        this.ClearAll();
                                        this.QuerySpotUnitConversion();
                                    }
                                    else
                                    {
                                        ShowMessageBox.ShowInformation("添加失败!");
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-5701";
                    string      errMsg    = "添加现货单位换算失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion
            }
            else if (m_EditType == 2)
            {
                #region 修改操作

                try
                {
                    EditType = (int)UITypes.EditTypeEnum.UpdateUI;
                    CM_UnitConversion cM_UnitConversion = new CM_UnitConversion();
                    int breedClassID = AppGlobalVariable.INIT_INT; //品种ID
                    if (m_UnitConversionID == AppGlobalVariable.INIT_INT)
                    {
                        ShowMessageBox.ShowInformation("请选择更新数据!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        breedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                        if (breedClassID != AppGlobalVariable.INIT_INT)
                        {
                            List <CM_UnitConversion> cMUnitConversionList =
                                SpotManageCommon.GetUnitConveByBreedClassID(breedClassID);
                            if (cMUnitConversionList.Count > 0)
                            {
                                int _curRow = 0; //当前记录行
                                foreach (CM_UnitConversion _UnitConversion in cMUnitConversionList)
                                {
                                    if (m_UnitConversionID == _UnitConversion.UnitConversionID) //不与自己比较
                                    {
                                        _curRow++;
                                        if (_curRow == cMUnitConversionList.Count)
                                        {
                                            string msg = string.Empty;
                                            cM_UnitConversion = VerifyUnitConversionInput(ref msg);
                                            if (!string.IsNullOrEmpty(msg))
                                            {
                                                ShowMessageBox.ShowInformation(msg);
                                            }
                                            else
                                            {
                                                m_Result = SpotManageCommon.UpdateCMUnitConversion(cM_UnitConversion);
                                                if (m_Result)
                                                {
                                                    ShowMessageBox.ShowInformation("修改成功!");
                                                    this.ClearAll();
                                                    this.QuerySpotUnitConversion();
                                                    m_UnitConversionID = AppGlobalVariable.INIT_INT;
                                                }
                                                else
                                                {
                                                    ShowMessageBox.ShowInformation("修改失败!");
                                                }
                                            }
                                            break;
                                        }
                                        continue;
                                    }
                                    _curRow++;
                                    if (_UnitConversion.BreedClassID ==
                                        ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)
                                    {
                                        if (_UnitConversion.UnitIDFrom ==
                                            ((UComboItem)this.cmbUnitIDFrom.SelectedItem).ValueIndex &&
                                            _UnitConversion.UnitIDTo ==
                                            ((UComboItem)this.cmbUnitIDTo.SelectedItem).ValueIndex)
                                        {
                                            ShowMessageBox.ShowInformation("同一品种,同一从单位到单位的转换只允许一条记录!");
                                            break;
                                        }
                                        else
                                        {
                                            if (_curRow == cMUnitConversionList.Count)
                                            {
                                                string msg = string.Empty;
                                                cM_UnitConversion = VerifyUnitConversionInput(ref msg);
                                                if (!string.IsNullOrEmpty(msg))
                                                {
                                                    ShowMessageBox.ShowInformation(msg);
                                                }
                                                else
                                                {
                                                    m_Result = SpotManageCommon.UpdateCMUnitConversion(cM_UnitConversion);
                                                    if (m_Result)
                                                    {
                                                        ShowMessageBox.ShowInformation("修改成功!");
                                                        this.ClearAll();
                                                        this.QuerySpotUnitConversion();
                                                        m_UnitConversionID = AppGlobalVariable.INIT_INT;
                                                    }
                                                    else
                                                    {
                                                        ShowMessageBox.ShowInformation("修改失败!");
                                                    }
                                                }
                                            }
                                        }
                                        continue;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-5703";
                    string      errMsg    = "修改现货单位换算失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion
            }
            this.ClearAll();
        }
        /// <summary>
        /// 删除现货交易规则 btnDelete_Click
        /// </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.gdvSpotTradeRulesSelect.GetDataRow(this.gdvSpotTradeRulesSelect.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["BreedClassValidID"])))
                {
                    m_BreedClassValidID = Convert.ToInt32(_dr["BreedClassValidID"]);
                }
                else
                {
                    m_BreedClassValidID = AppGlobalVariable.INIT_INT;
                }

                if (!string.IsNullOrEmpty(Convert.ToString(_dr["BreedClassHighLowID"])))
                {
                    m_BreedClassHighLowID = Convert.ToInt32(_dr["BreedClassHighLowID"]);
                }
                else
                {
                    m_BreedClassHighLowID = AppGlobalVariable.INIT_INT;
                }
                //删除需要实现当交易规则删除时,港股的最小变动价位的删除
                if (m_BreedClassID != AppGlobalVariable.INIT_INT)
                {
                    // m_Result = SpotManageCommon.DeleteSpotTradeRules(m_BreedClassID, m_BreedClassHighLowID,
                    // m_BreedClassValidID);
                    m_Result = SpotManageCommon.DeleteSpotTradeRulesAboutAll(m_BreedClassID);
                }

                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_BreedClassID        = AppGlobalVariable.INIT_INT;
                    m_BreedClassHighLowID = AppGlobalVariable.INIT_INT;
                    m_BreedClassValidID   = AppGlobalVariable.INIT_INT;
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
                this.QuerySpotTradeRules();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5022";
                string      errMsg    = "删除现货交易规则失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 添加或修改现货交易费用
        /// 说明:根据需求,当以下值,分别是(印花税,印花税起点,佣金起点,过户费,过户费起点,结算费)用户没有填写时,默认值是0;
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (EditType == (int)UITypes.EditTypeEnum.AddUI)
                {
                    if (
                        SpotManageCommon.ExistsSpotCosts(
                            ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex))
                    {
                        ShowMessageBox.ShowInformation("此品种的交易费用已存在!");
                        return;
                    }
                }
                XH_SpotCosts xH_SpotCosts = new XH_SpotCosts();
                if (XHSpotCosts != null)
                {
                    ManagementCenter.Model.CommonClass.UtilityClass.CopyEntityToEntity(XHSpotCosts, xH_SpotCosts);
                }

                if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                {
                    xH_SpotCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                }
                else
                {
                    ShowMessageBox.ShowInformation("品种名称不能为空!");
                    return;
                }
                xH_SpotCosts.CurrencyTypeID = ((UComboItem)this.cmbCurrencyType.SelectedItem).ValueIndex;
                xH_SpotCosts.GetValueTypeID = (int)GTA.VTS.Common.CommonObject.Types.GetValueTypeEnum.Single;
                //根据需求指定默认值 //((UComboItem)this.cmbGetValueType.SelectedItem).ValueIndex;
                xH_SpotCosts.StampDutyTypeID    = ((UComboItem)this.cmbStampDutyType.SelectedItem).ValueIndex;
                xH_SpotCosts.TransferTollTypeID = ((UComboItem)this.cmbTransferTollType.SelectedItem).ValueIndex;
                if (!string.IsNullOrEmpty(this.txtClearingFees.Text))
                {
                    if (InputTest.DecimalTest(this.txtClearingFees.Text))
                    {
                        xH_SpotCosts.ClearingFees = Convert.ToDecimal(this.txtClearingFees.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.ClearingFees = 0; // AppGlobalVariable.INIT_DECIMAL;
                }
                if (!string.IsNullOrEmpty(this.txtCommision.Text))
                {
                    if (InputTest.DecimalTest(this.txtCommision.Text))
                    {
                        xH_SpotCosts.Commision = Convert.ToDecimal(this.txtCommision.Text); //null;
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.Commision = 0; //?现货所有品种都有拥金 AppGlobalVariable.INIT_DECIMAL;
                }
                if (!string.IsNullOrEmpty(this.txtCommisionStartpoint.Text))
                {
                    if (InputTest.DecimalTest(this.txtCommisionStartpoint.Text))
                    {
                        xH_SpotCosts.CommisionStartingpoint = Convert.ToDecimal(this.txtCommisionStartpoint.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.CommisionStartingpoint = 0; // AppGlobalVariable.INIT_DECIMAL;
                }
                xH_SpotCosts.MonitoringFee       = 0;        //根据需求指定默认值 //Convert.ToDecimal(this.txtMonitoringFee.Text);
                xH_SpotCosts.PoundageSingleValue = 0;        //根据需求改成默认值 //Convert.ToDecimal(this.txtPoundageSingleValue.Text);
                if (!string.IsNullOrEmpty(this.txtStampDuty.Text))
                {
                    if (InputTest.DecimalTest(this.txtStampDuty.Text))
                    {
                        xH_SpotCosts.StampDuty = Convert.ToDecimal(this.txtStampDuty.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.StampDuty = 0; // AppGlobalVariable.INIT_DECIMAL;
                }
                if (!string.IsNullOrEmpty(this.txtStampDutyStartpoint.Text))
                {
                    if (InputTest.DecimalTest(this.txtStampDutyStartpoint.Text))
                    {
                        xH_SpotCosts.StampDutyStartingpoint = Convert.ToDecimal(this.txtStampDutyStartpoint.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.StampDutyStartingpoint = 0; // AppGlobalVariable.INIT_DECIMAL;
                }

                xH_SpotCosts.SystemToll = 0; //根据需求指定默认值// Convert.ToDecimal(this.txtSystemToll.Text);
                if (!string.IsNullOrEmpty(this.txtTransferToll.Text))
                {
                    if (InputTest.DecimalTest(this.txtTransferToll.Text))
                    {
                        xH_SpotCosts.TransferToll = Convert.ToDecimal(this.txtTransferToll.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.TransferToll = 0; // AppGlobalVariable.INIT_DECIMAL;
                }
                if (!string.IsNullOrEmpty(this.txtTransferTollStartpoint.Text))
                {
                    if (InputTest.DecimalTest(this.txtTransferTollStartpoint.Text))
                    {
                        xH_SpotCosts.TransferTollStartingpoint = Convert.ToDecimal(this.txtTransferTollStartpoint.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    xH_SpotCosts.TransferTollStartingpoint = 0; // AppGlobalVariable.INIT_DECIMAL;
                }

                if (EditType == (int)UITypes.EditTypeEnum.AddUI)
                {
                    m_Result = SpotManageCommon.AddSpotCosts(xH_SpotCosts);
                    if (m_Result)
                    {
                        //m_ValueType = Convert.ToInt32(xH_SpotCosts.ValueTypeMinChangePrice);
                        //if (m_ValueType == (int)Types.GetValueTypeEnum.Scope)
                        //{
                        //    btnMinChangePriceV.Visible = true;
                        //}
                        m_BreedClassID = Convert.ToInt32(xH_SpotCosts.BreedClassID);
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI)
                {
                    m_Result = SpotManageCommon.UpdateSpotCosts(xH_SpotCosts);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5402";
                string      errMsg    = "添加或修改现货交易费用失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
        /// <summary>
        /// 确定按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            //获取状态值,并对状态值进行比较 1代表添加操作,2代表修改操作
            int status = Status;

            if (status == 1)
            {
                #region
                EditType = (int)UITypes.EditTypeEnum.AddUI;
                int result = AppGlobalVariable.INIT_INT;
                try
                {
                    XH_MinVolumeOfBusiness xH_MinVolumeOfBusiness = new XH_MinVolumeOfBusiness();
                    int breedClassID = AppGlobalVariable.INIT_INT; //品种ID
                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        breedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                        if (breedClassID != AppGlobalVariable.INIT_INT)
                        {
                            List <XH_MinVolumeOfBusiness> xhMinVolumeOfBusList =
                                SpotManageCommon.GetXHMinVolumeOfBusByBreedClassID(breedClassID);
                            if (xhMinVolumeOfBusList.Count > 0)
                            {
                                int _curRow = 0; //当前记录行
                                foreach (XH_MinVolumeOfBusiness _xHMinVOfBus in xhMinVolumeOfBusList)
                                {
                                    _curRow++;
                                    if (_xHMinVOfBus.BreedClassID ==
                                        ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)
                                    {
                                        if (_xHMinVOfBus.UnitID == ((UComboItem)this.cmbUnitID.SelectedItem).ValueIndex &&
                                            _xHMinVOfBus.TradeWayID ==
                                            ((UComboItem)this.cmbTradeWayID.SelectedItem).ValueIndex)
                                        {
                                            ShowMessageBox.ShowInformation("同一品种,同一交易方向,同一交易单位只允许一条记录!");
                                            break;
                                        }
                                        else
                                        {
                                            if (_curRow == xhMinVolumeOfBusList.Count)
                                            {
                                                string msg = string.Empty;
                                                xH_MinVolumeOfBusiness = VerifyXHMinVolumeOfBusInput(ref msg);
                                                if (!string.IsNullOrEmpty(msg))
                                                {
                                                    ShowMessageBox.ShowInformation(msg);
                                                }
                                                else
                                                {
                                                    result =
                                                        SpotManageCommon.AddXHMinVolumeOfBusiness(xH_MinVolumeOfBusiness);
                                                    if (result != AppGlobalVariable.INIT_INT)
                                                    {
                                                        ShowMessageBox.ShowInformation("添加成功!");
                                                        this.ClearAll();
                                                        this.QueryMinVolumeOfBusiness();
                                                    }
                                                    else
                                                    {
                                                        ShowMessageBox.ShowInformation("添加失败!");
                                                    }
                                                }
                                            }
                                        }
                                        continue;
                                    }
                                }
                            }
                            else
                            {
                                string msg = string.Empty;
                                xH_MinVolumeOfBusiness = VerifyXHMinVolumeOfBusInput(ref msg);
                                if (!string.IsNullOrEmpty(msg))
                                {
                                    ShowMessageBox.ShowInformation(msg);
                                }
                                else
                                {
                                    result = SpotManageCommon.AddXHMinVolumeOfBusiness(xH_MinVolumeOfBusiness);
                                    if (result != AppGlobalVariable.INIT_INT)
                                    {
                                        ShowMessageBox.ShowInformation("添加成功!");
                                        this.ClearAll();
                                        this.QueryMinVolumeOfBusiness();
                                    }
                                    else
                                    {
                                        ShowMessageBox.ShowInformation("添加失败!");
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-5081";
                    string      errMsg    = "添加现货最小交易单位失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }
                #endregion
            }
            else if (status == 2)
            {
                #region
                try
                {
                    EditType = (int)UITypes.EditTypeEnum.UpdateUI;
                    XH_MinVolumeOfBusiness xH_MinVolumeOfBusiness = new XH_MinVolumeOfBusiness();
                    int breedClassID = AppGlobalVariable.INIT_INT; //品种ID
                    if (m_MinVolumeOfBusinessID == AppGlobalVariable.INIT_INT)
                    {
                        ShowMessageBox.ShowInformation("请选择更新数据!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        breedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                        if (breedClassID != AppGlobalVariable.INIT_INT)
                        {
                            List <XH_MinVolumeOfBusiness> xhMinVolumeOfBusList =
                                SpotManageCommon.GetXHMinVolumeOfBusByBreedClassID(breedClassID);
                            if (xhMinVolumeOfBusList.Count > 0)
                            {
                                int _curRow = 0; //当前记录行
                                foreach (XH_MinVolumeOfBusiness _xHMinVOfBus in xhMinVolumeOfBusList)
                                {
                                    if (m_MinVolumeOfBusinessID == _xHMinVOfBus.MinVolumeOfBusinessID)//不与自己比较
                                    {
                                        _curRow++;
                                        if (_curRow == xhMinVolumeOfBusList.Count)
                                        {
                                            string msg = string.Empty;
                                            xH_MinVolumeOfBusiness = VerifyXHMinVolumeOfBusInput(ref msg);
                                            if (!string.IsNullOrEmpty(msg))
                                            {
                                                ShowMessageBox.ShowInformation(msg);
                                            }
                                            else
                                            {
                                                m_Result = SpotManageCommon.UpdateXHMinVolumeOfBus(xH_MinVolumeOfBusiness);
                                                if (m_Result)
                                                {
                                                    ShowMessageBox.ShowInformation("修改成功!");
                                                    this.ClearAll();
                                                    this.QueryMinVolumeOfBusiness();
                                                    m_MinVolumeOfBusinessID = AppGlobalVariable.INIT_INT;
                                                }
                                                else
                                                {
                                                    ShowMessageBox.ShowInformation("修改失败!");
                                                }
                                            }
                                            break;
                                        }
                                        continue;
                                    }
                                    _curRow++;
                                    if (_xHMinVOfBus.BreedClassID ==
                                        ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex)
                                    {
                                        if (_xHMinVOfBus.UnitID == ((UComboItem)this.cmbUnitID.SelectedItem).ValueIndex &&
                                            _xHMinVOfBus.TradeWayID ==
                                            ((UComboItem)this.cmbTradeWayID.SelectedItem).ValueIndex)
                                        {
                                            ShowMessageBox.ShowInformation("同一品种,同一交易方向,同一交易单位只允许一条记录!");
                                            break;
                                        }
                                        else
                                        {
                                            if (_curRow == xhMinVolumeOfBusList.Count)
                                            {
                                                string msg = string.Empty;
                                                xH_MinVolumeOfBusiness = VerifyXHMinVolumeOfBusInput(ref msg);
                                                if (!string.IsNullOrEmpty(msg))
                                                {
                                                    ShowMessageBox.ShowInformation(msg);
                                                }
                                                else
                                                {
                                                    m_Result = SpotManageCommon.UpdateXHMinVolumeOfBus(xH_MinVolumeOfBusiness);
                                                    if (m_Result)
                                                    {
                                                        ShowMessageBox.ShowInformation("修改成功!");
                                                        this.ClearAll();
                                                        this.QueryMinVolumeOfBusiness();
                                                        m_MinVolumeOfBusinessID = AppGlobalVariable.INIT_INT;
                                                    }
                                                    else
                                                    {
                                                        ShowMessageBox.ShowInformation("修改失败!");
                                                    }
                                                }
                                            }
                                        }
                                        continue;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-5084";
                    string      errMsg    = "修改现货最小交易单位失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                }
                #endregion
            }
            this.btnAdd.Enabled    = true;
            this.btnModify.Enabled = true;
            this.btnDelete.Enabled = true;
            this.btnOK.Enabled     = false;
            this.btnAdd.Text       = "添加";
            this.btnModify.Text    = "修改";
            this.EnabledFalse();
            Status = 0;
        }
        /// <summary>
        /// 点击确定按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            int status = Status;

            if (status == 1)
            {
                #region 添加操作
                try
                {
                    if (
                        SpotManageCommon.ExistsXHSpotPosition(
                            ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex))
                    {
                        ShowMessageBox.ShowInformation("此品种的持仓比率已存在!");
                        return;
                    }
                    XH_SpotPosition xH_SpotPosition = new XH_SpotPosition();

                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        xH_SpotPosition.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                    }
                    else
                    {
                        xH_SpotPosition.BreedClassID = AppGlobalVariable.INIT_INT;
                    }

                    if (!string.IsNullOrEmpty(this.txtRate.Text))
                    {
                        if (InputTest.DecimalTest(this.txtRate.Text))
                        {
                            xH_SpotPosition.Rate = Convert.ToDecimal(this.txtRate.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        //xH_SpotPosition.Rate = AppGlobalVariable.INIT_DECIMAL;
                        ShowMessageBox.ShowInformation("持仓比率不能为空!");
                        return;
                    }
                    m_Result = SpotManageCommon.AddXHSpotPosition(xH_SpotPosition);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.QuerySpotPosition();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-5601";
                    string      errMsg    = "添加现货_交易商品品种_持仓限制失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }
                #endregion 添加操作
                this.btnAdd.Enabled    = true;
                this.btnModify.Enabled = true;
                this.btnDelete.Enabled = true;
                this.btnAdd.Text       = "添加";
                this.btnModify.Text    = "修改";
                Status = 0;
            }
            else if (status == 2)
            {
                #region 修改操作
                try
                {
                    XH_SpotPosition xH_SpotPosition = new XH_SpotPosition();
                    if (m_BreedClassID == AppGlobalVariable.INIT_INT)
                    {
                        ShowMessageBox.ShowInformation("请选择更新数据!");
                        return;
                    }
                    xH_SpotPosition.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                    // xH_SpotPosition.Rate = Convert.ToDecimal(this.txtRate.Text);
                    if (!string.IsNullOrEmpty(this.txtRate.Text))
                    {
                        if (InputTest.DecimalTest(this.txtRate.Text))
                        {
                            xH_SpotPosition.Rate = Convert.ToDecimal(this.txtRate.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        //xH_SpotPosition.Rate = AppGlobalVariable.INIT_DECIMAL;
                        ShowMessageBox.ShowInformation("持仓比率不能为空!");
                        return;
                    }
                    m_Result = SpotManageCommon.UpdateXHSpotPosition(xH_SpotPosition);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.ClearAll();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                    this.QuerySpotPosition();
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-5604";
                    string      errMsg    = "修改现货_交易商品品种_持仓限制失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }
                #endregion  修改操作
                this.btnAdd.Enabled    = true;
                this.btnModify.Enabled = true;
                this.btnDelete.Enabled = true;
                this.btnAdd.Text       = "添加";
                this.btnModify.Text    = "修改";
                Status = 0;
            }
            this.btnOK.Enabled = false;
        }
        /// <summary>
        /// 当前UI是修改涨跌幅UI时,初始化控件的值 UpdateInitData
        /// </summary>
        private void UpdateInitData()
        {
            try
            {
                if (BreedClassHighLowID != AppGlobalVariable.INIT_INT || BreedClassValidID != AppGlobalVariable.INIT_INT)
                {
                    XH_SpotHighLowControlType xH_SpotHighLowControlType =
                        SpotManageCommon.GetModelSpotHighLowControlType(BreedClassHighLowID);
                    //(UpdateBreedClassHighLowID);
                    XH_SpotHighLowValue xH_SpotHighLowValue =
                        SpotManageCommon.GetModelByBCHighLowID(BreedClassHighLowID); //(UpdateBreedClassHighLowID);
                    XH_ValidDeclareType xH_ValidDeclareType =
                        SpotManageCommon.GetModelValidDeclareType(BreedClassValidID);
                    XH_ValidDeclareValue xH_ValidDeclareValue =
                        SpotManageCommon.GetModelValidDeclareValue(BreedClassValidID);
                    //涨跌幅
                    if (xH_SpotHighLowControlType != null && xH_SpotHighLowValue != null)
                    {
                        if (xH_SpotHighLowControlType.HighLowTypeID != 0)
                        {
                            foreach (object item in cmbHighLowTypeID.Properties.Items)
                            {
                                if (((UComboItem)item).ValueIndex == xH_SpotHighLowControlType.HighLowTypeID)
                                {
                                    cmbHighLowTypeID.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            cmbHighLowTypeID.SelectedIndex = 0;
                        }
                        switch (cmbHighLowTypeID.SelectedIndex)
                        {
                        case 0:     //股票
                            txtHighLowValue1.Text = xH_SpotHighLowValue.StValue.ToString();
                            txtHighLowValue2.Text = xH_SpotHighLowValue.NormalValue.ToString();
                            break;

                        case 1:     //权证
                            txtHighLowValue1.Text = xH_SpotHighLowValue.RightHighLowScale.ToString();
                            break;

                        case 2:     //基金
                            txtHighLowValue1.Text = xH_SpotHighLowValue.FundYestClosePriceScale.ToString();
                            break;

                        case 3:      //债券和港股(无涨跌幅限制:因债券和港股均无涨跌幅限制,所以当是修改时界面上是否显示“港股”由有效申报类型决定)
                            cmbHighLowTypeID.SelectedIndex = 3;
                            break;
                        }
                        m_BreedClassHighLowID = xH_SpotHighLowControlType.BreedClassHighLowID;
                    }
                    //有效申报
                    if (xH_ValidDeclareType != null && xH_ValidDeclareValue != null)
                    {
                        if (xH_ValidDeclareType.ValidDeclareTypeID != 0)
                        {
                            foreach (object item in this.cmbValidDeclareTypeID.Properties.Items)
                            {
                                if (((UComboItem)item).ValueIndex == xH_ValidDeclareType.ValidDeclareTypeID)
                                {
                                    this.cmbValidDeclareTypeID.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            this.cmbValidDeclareTypeID.SelectedIndex = 0;
                        }
                        this.txtUpperLimit.Text = xH_ValidDeclareValue.UpperLimit.ToString();
                        this.txtLowerLimit.Text = xH_ValidDeclareValue.LowerLimit.ToString();
                        if (xH_ValidDeclareValue.NewDayUpperLimit != null)
                        {
                            this.txtNewDayUpperLimit.Text = xH_ValidDeclareValue.NewDayUpperLimit.ToString();
                        }
                        if (xH_ValidDeclareValue.NewDayLowerLimit != null)
                        {
                            this.txtNewDayLowerLimit.Text = xH_ValidDeclareValue.NewDayLowerLimit.ToString();
                        }
                        m_BreedClassValidID = xH_ValidDeclareType.BreedClassValidID;
                    }
                }
            }
            catch (Exception ex)
            {
                string errCode   = "GL-5043";
                string errMsg    = " 当前UI是修改涨跌幅UI时,初始化控件的值失败!";
                var    exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                throw exception;
            }
        }
        /// <summary>
        /// 添加/修改现货涨跌幅和有效申报
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                var xHSpotHighLowValue       = new XH_SpotHighLowValue();
                var xHSpotHighLowControlType = new XH_SpotHighLowControlType();
                var xHValidDeclareType       = new XH_ValidDeclareType();
                var xHValidDeclareValue      = new XH_ValidDeclareValue();

                //涨跌幅类型和有效申报类型
                if (!string.IsNullOrEmpty(cmbHighLowTypeID.Text) && !string.IsNullOrEmpty(cmbValidDeclareTypeID.Text))
                {
                    xHSpotHighLowControlType.HighLowTypeID = ((UComboItem)cmbHighLowTypeID.SelectedItem).ValueIndex;

                    switch (cmbHighLowTypeID.SelectedIndex)
                    {
                    case 0:
                        //股票
                        if (!string.IsNullOrEmpty(txtHighLowValue1.Text))
                        {
                            if (InputTest.DecimalTest(this.txtHighLowValue1.Text))
                            {
                                xHSpotHighLowValue.StValue = Convert.ToDecimal(txtHighLowValue1.Text);
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("ST股票不能为空!");
                            return;
                        }

                        if (!string.IsNullOrEmpty(txtHighLowValue2.Text))
                        {
                            if (InputTest.DecimalTest(this.txtHighLowValue2.Text))
                            {
                                xHSpotHighLowValue.NormalValue = Convert.ToDecimal(txtHighLowValue2.Text);
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("正常股票不能为空!");
                            return;
                        }
                        break;

                    case 1:     //权证
                        if (!string.IsNullOrEmpty(txtHighLowValue1.Text))
                        {
                            if (InputTest.DecimalTest(this.txtHighLowValue1.Text))
                            {
                                xHSpotHighLowValue.RightHighLowScale = Convert.ToDecimal(txtHighLowValue1.Text);
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("权证涨跌幅不能为空!");
                            return;
                        }
                        break;

                    case 2:     //基金
                        if (!string.IsNullOrEmpty(txtHighLowValue1.Text))
                        {
                            if (InputTest.DecimalTest(this.txtHighLowValue1.Text))
                            {
                                xHSpotHighLowValue.FundYestClosePriceScale = Convert.ToDecimal(txtHighLowValue1.Text);
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("基金涨跌幅不能为空!");
                            return;
                        }
                        break;

                    case 3:
                        //债券(无涨跌幅限制)
                        xHSpotHighLowValue.StValue                 = AppGlobalVariable.INIT_DECIMAL;
                        xHSpotHighLowValue.NormalValue             = AppGlobalVariable.INIT_DECIMAL;
                        xHSpotHighLowValue.RightHighLowScale       = AppGlobalVariable.INIT_DECIMAL;
                        xHSpotHighLowValue.FundYestClosePriceScale = AppGlobalVariable.INIT_DECIMAL;
                        break;
                    }
                    //有效申报
                    switch (cmbValidDeclareTypeID.SelectedIndex)
                    {
                    case 0:     //最近成交价的上下百分比
                        if (!string.IsNullOrEmpty(cmbValidDeclareTypeID.Text))
                        {
                            xHValidDeclareType.ValidDeclareTypeID =
                                ((UComboItem)cmbValidDeclareTypeID.SelectedItem).ValueIndex;
                        }
                        else
                        {
                            xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT;
                        }
                        string mess = string.Empty;
                        xHValidDeclareValue = VeriyXHValidDeclareValue(ref mess);
                        if (!string.IsNullOrEmpty(mess))
                        {
                            ShowMessageBox.ShowInformation(mess);
                            return;
                        }
                        break;

                    case 1:     //不高于即时揭示的最低卖出价格的百分比且不低于即时揭示
                        if (!string.IsNullOrEmpty(cmbValidDeclareTypeID.Text))
                        {
                            xHValidDeclareType.ValidDeclareTypeID =
                                ((UComboItem)cmbValidDeclareTypeID.SelectedItem).ValueIndex;
                        }
                        else
                        {
                            xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT;
                        }
                        mess = string.Empty;
                        xHValidDeclareValue = VeriyXHValidDeclareValue(ref mess);
                        if (!string.IsNullOrEmpty(mess))
                        {
                            ShowMessageBox.ShowInformation(mess);
                            return;
                        }
                        break;

                    case 2:    //3:
                        if (!string.IsNullOrEmpty(cmbValidDeclareTypeID.Text))
                        {
                            xHValidDeclareType.ValidDeclareTypeID =
                                ((UComboItem)cmbValidDeclareTypeID.SelectedItem).ValueIndex;
                        }
                        else
                        {
                            xHValidDeclareType.ValidDeclareTypeID = AppGlobalVariable.INIT_INT;
                        }
                        mess = string.Empty;
                        xHValidDeclareValue = VeriyXHValidDeclareValue(ref mess);
                        if (!string.IsNullOrEmpty(mess))
                        {
                            ShowMessageBox.ShowInformation(mess);
                            return;
                        }
                        if (!string.IsNullOrEmpty(txtNewDayUpperLimit.Text))
                        {
                            if (InputTest.DecimalTest(this.txtNewDayUpperLimit.Text))
                            {
                                xHValidDeclareValue.NewDayUpperLimit = Convert.ToDecimal(txtNewDayUpperLimit.Text);
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("上市首日上限不能为空!");
                            return;
                        }
                        if (!string.IsNullOrEmpty(txtNewDayLowerLimit.Text))
                        {
                            if (InputTest.DecimalTest(this.txtNewDayLowerLimit.Text))
                            {
                                xHValidDeclareValue.NewDayLowerLimit = Convert.ToDecimal(txtNewDayLowerLimit.Text);
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("上市首日下限不能为空!");
                            return;
                        }

                        break;
                    }
                    if (HighLowUIEditType == (int)UITypes.EditTypeEnum.AddUI)
                    {
                        XH_AboutSpotHighLowEntity xhAboutSpotHighLowEntity =
                            SpotManageCommon.AddXHSpotHighLowAndValidDecl(xHSpotHighLowControlType, xHSpotHighLowValue,
                                                                          xHValidDeclareType, xHValidDeclareValue);
                        if (xhAboutSpotHighLowEntity != null)
                        {
                            BreedClassHighLowID = (int)xhAboutSpotHighLowEntity.BreedClassHighLowID;
                            BreedClassValidID   = (int)xhAboutSpotHighLowEntity.BreedClassValidID;
                            ShowMessageBox.ShowInformation("添加成功!");
                            ClearAll();
                            DialogResult = DialogResult.OK;
                            Close();
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("添加失败!");
                        }
                    }
                    else if (HighLowUIEditType == (int)UITypes.EditTypeEnum.UpdateUI)
                    {
                        if (m_BreedClassHighLowID != AppGlobalVariable.INIT_INT)
                        {
                            xHSpotHighLowControlType.BreedClassHighLowID = m_BreedClassHighLowID;
                            xHSpotHighLowValue.BreedClassHighLowID       = m_BreedClassHighLowID;
                            xHValidDeclareType.BreedClassValidID         = m_BreedClassValidID;
                            xHValidDeclareValue.BreedClassValidID        = m_BreedClassValidID;
                        }
                        bool _UpResult = SpotManageCommon.UpdateXHSpotHighLowAndValidDecl(xHSpotHighLowControlType,
                                                                                          xHSpotHighLowValue, xHValidDeclareType, xHValidDeclareValue);
                        if (_UpResult)
                        {
                            ShowMessageBox.ShowInformation("修改成功!");
                            DialogResult = DialogResult.OK;
                            Close();
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("修改失败!");
                        }
                    }
                }
                else
                {
                    xHSpotHighLowControlType.HighLowTypeID = AppGlobalVariable.INIT_INT;
                    xHValidDeclareType.ValidDeclareTypeID  = AppGlobalVariable.INIT_INT;
                    return;
                }
            }
            catch (Exception ex)
            {
                string errCode   = "GL-5042";
                string errMsg    = " 添加现货涨跌幅失败!";
                var    exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
        /// <summary>
        /// 添加或修改现货交易规则  btnOK_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (EditType == (int)UITypes.EditTypeEnum.AddUI)
                {
                    if (
                        SpotManageCommon.ExistsSpotTradeRules(
                            ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex))
                    {
                        ShowMessageBox.ShowInformation("此品种的交易规则已存在!");
                        return;
                    }
                }

                XH_SpotTradeRules xH_SpotTradeRules = new XH_SpotTradeRules();
                if (XHSpotTradeRules != null)
                {
                    ManagementCenter.Model.CommonClass.UtilityClass.CopyEntityToEntity(XHSpotTradeRules,
                                                                                       xH_SpotTradeRules);
                }

                if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                {
                    xH_SpotTradeRules.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                }
                else
                {
                    xH_SpotTradeRules.BreedClassID = AppGlobalVariable.INIT_INT;
                }
                xH_SpotTradeRules.FundDeliveryInstitution  = Convert.ToInt32(this.speFundDeliveryIns.EditValue);
                xH_SpotTradeRules.StockDeliveryInstitution = Convert.ToInt32(this.speStockDeliveryIns.EditValue);

                //if (!string.IsNullOrEmpty(this.cmbMinChangePriceVType.Text))
                //{
                xH_SpotTradeRules.ValueTypeMinChangePrice = (int)GTA.VTS.Common.CommonObject.Types.GetValueTypeEnum.Single;
                //        ((UComboItem) this.cmbMinChangePriceVType.SelectedItem).ValueIndex;
                //}
                //else
                //{
                //    xH_SpotTradeRules.ValueTypeMinChangePrice = AppGlobalVariable.INIT_INT;
                //}
                if (!string.IsNullOrEmpty(this.txtMinChangePrice.Text))
                {
                    if (InputTest.DecimalTest(this.txtMinChangePrice.Text))
                    {
                        xH_SpotTradeRules.MinChangePrice = Convert.ToDecimal(this.txtMinChangePrice.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                        return;
                    }
                }
                else
                {
                    //if ((int) CommonObject.Types.GetValueTypeEnum.Single ==
                    //    ((UComboItem) this.cmbMinChangePriceVType.SelectedItem).ValueIndex)
                    //{
                    //    this.txtMinChangePrice.Enabled = true;
                    ShowMessageBox.ShowInformation("最小变动价位不能为空!");
                    return;
                    //}
                    //this.txtMinChangePrice.Enabled = false;
                    //xH_SpotTradeRules.MinChangePrice = 0; //最小变动价位=0时说明是范围值// AppGlobalVariable.INIT_INT; //money类型
                }
                if (!string.IsNullOrEmpty(this.txtMaxLeaveQuantity.Text))
                {
                    if (InputTest.intTest(this.txtMaxLeaveQuantity.Text))
                    {
                        xH_SpotTradeRules.MaxLeaveQuantity = Convert.ToInt32(this.txtMaxLeaveQuantity.Text);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("请输入数字且第一位数不能为0!");
                        return;
                    }
                }
                else
                {
                    //xH_SpotTradeRules.MaxLeaveQuantity = AppGlobalVariable.INIT_INT;
                    ShowMessageBox.ShowInformation("每笔最大委托量不能为空!");
                    return;
                }
                //if (!string.IsNullOrEmpty(this.cmbMaxLeaveQuantityUnit.Text))
                //根据20009.05.15界面修改确认结果 计价单位赋给每笔最大委托量单,每笔最大委托量单位在界面上不显示
                if (!string.IsNullOrEmpty(this.cmbPriceUnit.Text))
                {
                    xH_SpotTradeRules.MaxLeaveQuantityUnit =
                        ((UComboItem)this.cmbPriceUnit.SelectedItem).ValueIndex;
                }
                else
                {
                    xH_SpotTradeRules.MaxLeaveQuantityUnit = AppGlobalVariable.INIT_INT;
                }
                if (!string.IsNullOrEmpty(this.cmbPriceUnit.Text))
                {
                    xH_SpotTradeRules.PriceUnit = ((UComboItem)this.cmbPriceUnit.SelectedItem).ValueIndex;
                }
                else
                {
                    xH_SpotTradeRules.PriceUnit = AppGlobalVariable.INIT_INT;
                }
                if (!string.IsNullOrEmpty(this.cmbMarketUnitID.Text))
                {
                    xH_SpotTradeRules.MarketUnitID = ((UComboItem)this.cmbMarketUnitID.SelectedItem).ValueIndex;
                }
                else
                {
                    xH_SpotTradeRules.MarketUnitID = AppGlobalVariable.INIT_INT;
                }

                //根据20009.05.15界面修改确认结果 最小交易单位倍数在界面上不显示。此值从最小交易单位管理界面中已存在
                xH_SpotTradeRules.MinVolumeMultiples = 0;
                //判断品种涨跌幅ID或品种有效申报ID为空时提示添加品种涨跌幅和品种有效申报

                if (m_BreedClassHighLowID != AppGlobalVariable.INIT_INT && m_BreedClassValidID != AppGlobalVariable.INIT_INT)
                {
                    xH_SpotTradeRules.BreedClassHighLowID = m_BreedClassHighLowID;
                    xH_SpotTradeRules.BreedClassValidID   = m_BreedClassValidID;
                }
                else
                {
                    if (EditType == (int)UITypes.EditTypeEnum.AddUI)
                    {
                        ShowMessageBox.ShowInformation("请添加涨跌幅!");
                        return;
                    }
                }

                if (EditType == (int)UITypes.EditTypeEnum.AddUI)
                {
                    m_Result = SpotManageCommon.AddXHSpotTradeRules(xH_SpotTradeRules);
                    if (m_Result)
                    {
                        m_ValueType    = Convert.ToInt32(xH_SpotTradeRules.ValueTypeMinChangePrice);
                        m_BreedClassID = Convert.ToInt32(xH_SpotTradeRules.BreedClassID);
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                    }
                    else
                    {
                        if (m_BreedClassValidID != AppGlobalVariable.INIT_INT)
                        {
                            SpotManageCommon.DeleteValidDeclareValue(m_BreedClassValidID);
                        }
                        if (m_BreedClassHighLowID != AppGlobalVariable.INIT_INT)
                        {
                            SpotManageCommon.DeleteSpotHighLowValue(m_BreedClassHighLowID);
                        }
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                else if (EditType == (int)UITypes.EditTypeEnum.UpdateUI)
                {
                    m_Result = SpotManageCommon.UpdateSpotTradeRules(xH_SpotTradeRules);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-5001";
                string      errMsg    = "添加或修改现货交易规则失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }