/// <summary>
        /// 删除港股交易商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No)
                {
                    return;
                }
                DataRow _dr = this.gdvHKCommoditySelect.GetDataRow(this.gdvHKCommoditySelect.FocusedRowHandle);
                if (_dr == null)
                {
                    ShowMessageBox.ShowInformation("请选择数据!");
                    return;
                }
                if (!string.IsNullOrEmpty(Convert.ToString(_dr["HKCommodityCode"])))
                {
                    m_HKCommodityCode = Convert.ToString(_dr["HKCommodityCode"]);
                }
                else
                {
                    m_HKCommodityCode = AppGlobalVariable.INIT_STRING;
                }
                //int breedClassID = Convert.ToInt32(_dr["BreedClassID"]);//品种ID
                if (m_HKCommodityCode != AppGlobalVariable.INIT_STRING)
                {
                    int _ISSysDefaultCode = Convert.ToInt32(_dr["ISSysDefaultCode"]);
                    if (_ISSysDefaultCode == (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No)
                    {
                        m_Result = HKManageCommon.DeleteHKCommodity(m_HKCommodityCode);
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("系统默认代码不能删除!");
                        return;
                    }
                }
                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_HKCommodityCode = AppGlobalVariable.INIT_STRING;
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
                this.QueryHKCommodity();
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-7706";
                string      errMsg    = "删除港股交易商品失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);

                return;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 删除港股交易费用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (ShowMessageBox.ShowQuestion("确认删除吗?") == DialogResult.No)
                {
                    return;
                }

                DataRow _dr = this.gdvHKCostsSelect.GetDataRow(this.gdvHKCostsSelect.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)
                {
                    m_Result = HKManageCommon.DeleteHKSpotCosts(m_BreedClassID);
                }

                if (m_Result)
                {
                    ShowMessageBox.ShowInformation("删除成功!");
                    m_BreedClassID = AppGlobalVariable.INIT_INT;
                    this.QueryHKCosts();
                }
                else
                {
                    ShowMessageBox.ShowInformation("删除失败!");
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-7806";
                string      errMsg    = "删除港股交易费用失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 根据查询条件,获取港股交易费用
        /// </summary>
        /// <returns></returns>
        private bool QueryHKCosts()
        {
            try
            {
                string  breedClassName = this.txtBreedClassName.Text;
                DataSet _dsHKCosts     = HKManageCommon.GetAllHKSpotCosts(breedClassName,
                                                                          m_pageNo,
                                                                          m_pageSize,
                                                                          out m_rowCount);
                DataTable _dtHKCosts;
                if (_dsHKCosts == null || _dsHKCosts.Tables[0].Rows.Count == 0)
                {
                    _dtHKCosts = new DataTable();
                }
                else
                {
                    _dtHKCosts = _dsHKCosts.Tables[0];
                }

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

                //绑定币种类型
                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.gdHKCostsResult.DataSource = _dtHKCosts;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-7801";
                string      errMsg    = "根据查询条件,获取港股交易费用失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                throw exception;
            }

            return(true);
        }
        /// <summary>
        /// 根据查询条件,获取港股交易规则
        /// </summary>
        /// <returns></returns>
        private bool QueryHKTradeRules()
        {
            try
            {
                string  breedClassName  = this.txtBreeClassName.Text;
                DataSet _dsHKTradeRules = HKManageCommon.GetAllHKSpotTradeRules(breedClassName,
                                                                                m_pageNo,
                                                                                m_pageSize,
                                                                                out m_rowCount);
                DataTable _dtHKTradeRule;
                if (_dsHKTradeRules == null || _dsHKTradeRules.Tables[0].Rows.Count == 0)
                {
                    _dtHKTradeRule = new DataTable();
                }
                else
                {
                    _dtHKTradeRule = _dsHKTradeRules.Tables[0];
                }

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

                //绑定行情成交量单位
                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.gdHKTradeRulesQResult.DataSource = _dtHKTradeRule;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-7901";
                string      errMsg    = "根据查询条件,获取港股交易规则失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                //throw exception;
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 根据查询条件,获取港股交易商品
        /// </summary>
        /// <returns></returns>
        private bool QueryHKCommodity()
        {
            try
            {
                //港股商品代码
                string HKCommodityCode = AppGlobalVariable.INIT_STRING;
                //港股商品名称
                string HKCommodityName = AppGlobalVariable.INIT_STRING;
                if (!string.IsNullOrEmpty(txtCondition.Text))
                {
                    HKCommodityCode = txtCondition.Text;
                    HKCommodityName = txtCondition.Text;
                }

                DataSet _dsHKCommodity = HKManageCommon.GetAllHKCommodity(HKCommodityCode, HKCommodityName,
                                                                          m_pageNo,
                                                                          m_pageSize,
                                                                          out m_rowCount);
                DataTable _dtHKCommodity;
                if (_dsHKCommodity == null || _dsHKCommodity.Tables[0].Rows.Count == 0)
                {
                    _dtHKCommodity = new DataTable();
                }
                else
                {
                    _dtHKCommodity = _dsHKCommodity.Tables[0];
                }

                //绑定交易商品品种表中的品种ID对应的品种名称
                string strWhere = " BreedClassTypeID=4 or DeleteState=1 ";
                this.ddlBreedClassID.DataSource  = CommonParameterSetCommon.GetList(strWhere).Tables[0];
                this.ddlBreedClassID.ValueMember =
                    CommonParameterSetCommon.GetList(strWhere).Tables[0].Columns["BreedClassID"].ToString();

                this.ddlBreedClassID.DisplayMember =
                    CommonParameterSetCommon.GetList(strWhere).Tables[0].Columns["BreedClassName"].ToString();

                this.gdHKCommodityResult.DataSource = _dtHKCommodity;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-7701";
                string      errMsg    = "根据查询条件,获取港股交易商品失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
            return(true);
        }
Beispiel #6
0
        /// <summary>
        /// 确定按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            //通过状态值来进行判断是进行那种操作 1:添加 2:修改
            if (m_EditType == 1)
            {
                #region 添加操作

                try
                {
                    if (
                        HKManageCommon.ExistsHKSpotCosts(
                            ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex))
                    {
                        ShowMessageBox.ShowInformation("此品种的交易费用已存在!");
                        return;
                    }
                    HK_SpotCosts hK_SpotCosts = new HK_SpotCosts();
                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        hK_SpotCosts.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("品种名称不能为空!");
                        return;
                    }
                    hK_SpotCosts.CurrencyTypeID  = ((UComboItem)this.cmbCurrencyType.SelectedItem).ValueIndex;
                    hK_SpotCosts.StampDutyTypeID = ((UComboItem)this.cmbStampDutyType.SelectedItem).ValueIndex;
                    if (!string.IsNullOrEmpty(this.txtStampDuty.Text)) //印花税
                    {
                        if (InputTest.DecimalTest(this.txtStampDuty.Text))
                        {
                            hK_SpotCosts.StampDuty = Convert.ToDecimal(this.txtStampDuty.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        //hK_SpotCosts.StampDuty = 0; // AppGlobalVariable.INIT_DECIMAL;
                        ShowMessageBox.ShowInformation("印花税不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtStampDutyStartpoint.Text)) //印花税起点
                    {
                        if (InputTest.DecimalTest(this.txtStampDutyStartpoint.Text))
                        {
                            hK_SpotCosts.StampDutyStartingpoint = Convert.ToDecimal(this.txtStampDutyStartpoint.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        hK_SpotCosts.StampDutyStartingpoint = 0;       //默认为0
                    }
                    if (!string.IsNullOrEmpty(this.txtCommision.Text)) //佣金
                    {
                        if (InputTest.DecimalTest(this.txtCommision.Text))
                        {
                            hK_SpotCosts.Commision = Convert.ToDecimal(this.txtCommision.Text); //null;
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        //hK_SpotCosts.Commision = 0; //
                        ShowMessageBox.ShowInformation("佣金不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtCommisionStartpoint.Text)) //佣金起点
                    {
                        if (InputTest.DecimalTest(this.txtCommisionStartpoint.Text))
                        {
                            hK_SpotCosts.CommisionStartingpoint = Convert.ToDecimal(this.txtCommisionStartpoint.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        hK_SpotCosts.CommisionStartingpoint = 0;           // //默认为0AppGlobalVariable.INIT_DECIMAL;
                    }
                    if (!string.IsNullOrEmpty(this.txtPoundageValue.Text)) //交易费
                    {
                        if (InputTest.DecimalTest(this.txtPoundageValue.Text))
                        {
                            hK_SpotCosts.PoundageValue = Convert.ToDecimal(this.txtPoundageValue.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("交易费不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtMonitoringFee.Text)) //监管费
                    {
                        if (InputTest.DecimalTest(this.txtMonitoringFee.Text))
                        {
                            hK_SpotCosts.MonitoringFee = Convert.ToDecimal(this.txtMonitoringFee.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("监管费不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtSystemToll.Text)) //交易系统使用费
                    {
                        if (InputTest.DecimalTest(this.txtSystemToll.Text))
                        {
                            hK_SpotCosts.SystemToll = Convert.ToDecimal(this.txtSystemToll.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("交易系统使用费不能为空!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.txtTransferToll.Text)) //过户费
                    {
                        if (InputTest.DecimalTest(this.txtTransferToll.Text))
                        {
                            hK_SpotCosts.TransferToll = Convert.ToDecimal(this.txtTransferToll.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        hK_SpotCosts.TransferToll = 0; //默认为0
                    }
                    m_Result = HKManageCommon.AddHKSpotCosts(hK_SpotCosts);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.QueryHKCosts();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-7803";
                    string      errMsg    = "添加港股交易费用失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

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

                try
                {
                    HK_SpotCosts hK_SpotCosts = new HK_SpotCosts();
                    hK_SpotCosts.BreedClassID    = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex; //品种名称不能修改
                    hK_SpotCosts.CurrencyTypeID  = ((UComboItem)this.cmbCurrencyType.SelectedItem).ValueIndex;
                    hK_SpotCosts.StampDutyTypeID = ((UComboItem)this.cmbStampDutyType.SelectedItem).ValueIndex;
                    if (!string.IsNullOrEmpty(this.txtStampDuty.Text)) //印花税
                    {
                        if (InputTest.DecimalTest(this.txtStampDuty.Text))
                        {
                            hK_SpotCosts.StampDuty = Convert.ToDecimal(this.txtStampDuty.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        //hK_SpotCosts.StampDuty = 0; // AppGlobalVariable.INIT_DECIMAL;
                        ShowMessageBox.ShowInformation("印花税不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtStampDutyStartpoint.Text)) //印花税起点
                    {
                        if (InputTest.DecimalTest(this.txtStampDutyStartpoint.Text))
                        {
                            hK_SpotCosts.StampDutyStartingpoint = Convert.ToDecimal(this.txtStampDutyStartpoint.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        hK_SpotCosts.StampDutyStartingpoint = 0;       //默认为0
                    }
                    if (!string.IsNullOrEmpty(this.txtCommision.Text)) //佣金
                    {
                        if (InputTest.DecimalTest(this.txtCommision.Text))
                        {
                            hK_SpotCosts.Commision = Convert.ToDecimal(this.txtCommision.Text); //null;
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        //hK_SpotCosts.Commision = 0; //
                        ShowMessageBox.ShowInformation("佣金不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtCommisionStartpoint.Text)) //佣金起点
                    {
                        if (InputTest.DecimalTest(this.txtCommisionStartpoint.Text))
                        {
                            hK_SpotCosts.CommisionStartingpoint = Convert.ToDecimal(this.txtCommisionStartpoint.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        hK_SpotCosts.CommisionStartingpoint = 0;           ////默认为0 AppGlobalVariable.INIT_DECIMAL;
                    }
                    if (!string.IsNullOrEmpty(this.txtPoundageValue.Text)) //交易费
                    {
                        if (InputTest.DecimalTest(this.txtPoundageValue.Text))
                        {
                            hK_SpotCosts.PoundageValue = Convert.ToDecimal(this.txtPoundageValue.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("交易费不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtMonitoringFee.Text)) //监管费
                    {
                        if (InputTest.DecimalTest(this.txtMonitoringFee.Text))
                        {
                            hK_SpotCosts.MonitoringFee = Convert.ToDecimal(this.txtMonitoringFee.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("监管费不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtSystemToll.Text)) //交易系统使用费
                    {
                        if (InputTest.DecimalTest(this.txtSystemToll.Text))
                        {
                            hK_SpotCosts.SystemToll = Convert.ToDecimal(this.txtSystemToll.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("交易系统使用费不能为空!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.txtTransferToll.Text)) //过户费
                    {
                        if (InputTest.DecimalTest(this.txtTransferToll.Text))
                        {
                            hK_SpotCosts.TransferToll = Convert.ToDecimal(this.txtTransferToll.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("格式不正确(只能包含数字和小数点)!");
                            return;
                        }
                    }
                    else
                    {
                        hK_SpotCosts.TransferToll = 0; //默认为0
                    }
                    m_Result = HKManageCommon.UpdateHKSpotCosts(hK_SpotCosts);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.ClearAll();
                        this.QueryHKCosts();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-7804";
                    string      errMsg    = "修改港股交易费用失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion 修改操作
            }
        }
        /// <summary>
        /// 确定按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (m_EditType == 1)
            {
                #region 添加操作

                try
                {
                    if (
                        HKManageCommon.ExistsHKSpotTradeRules(
                            ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex))
                    {
                        ShowMessageBox.ShowInformation("此品种的交易规则已存在!");
                        return;
                    }
                    HK_SpotTradeRules hK_SpotTradeRules = new HK_SpotTradeRules();
                    string            _strMess          = string.Empty;
                    hK_SpotTradeRules = VerifyHKSpotTradeRules(ref _strMess);
                    if (!string.IsNullOrEmpty(_strMess))
                    {
                        ShowMessageBox.ShowInformation(_strMess);
                        return;
                    }
                    m_Result = HKManageCommon.AddHKSpotTradeRules(hK_SpotTradeRules);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.QueryHKTradeRules();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-7903";
                    string      errMsg    = "添加港股交易规则失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

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

                try
                {
                    HK_SpotTradeRules hK_SpotTradeRules = new HK_SpotTradeRules();
                    string            _strMess          = string.Empty;
                    hK_SpotTradeRules = VerifyHKSpotTradeRules(ref _strMess);
                    if (!string.IsNullOrEmpty(_strMess))
                    {
                        ShowMessageBox.ShowInformation(_strMess);
                        return;
                    }
                    m_Result = HKManageCommon.UpdateHKSpotTradeRules(hK_SpotTradeRules);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.ClearAll();
                        this.QueryHKTradeRules();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-7904";
                    string      errMsg    = "修改港股交易规则失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion 修改操作
            }
        }
        /// <summary>
        /// 确定按钮操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (m_EditType == 1)
            {
                #region 添加操作

                try
                {
                    HK_Commodity hK_Commodity = new HK_Commodity();

                    if (!string.IsNullOrEmpty(this.txtHKCommodityCode.Text))
                    {
                        if (!HKManageCommon.IsExistHKCommodityCode(this.txtHKCommodityCode.Text))
                        {
                            ShowMessageBox.ShowInformation("代码已经存在!");
                            return;
                        }
                        if (InputTest.zeroStartIntTest(this.txtHKCommodityCode.Text))
                        {
                            if (this.txtHKCommodityCode.Text.Length == 5)
                            {
                                hK_Commodity.HKCommodityCode = this.txtHKCommodityCode.Text;
                            }
                            else
                            {
                                ShowMessageBox.ShowInformation("港股代码是五位数!");
                                return;
                            }
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入数字!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("请填写代码!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtHKCommodityName.Text))
                    {
                        if (!HKManageCommon.IsExistHKCommodityName(this.txtHKCommodityName.Text))
                        {
                            ShowMessageBox.ShowInformation("代码名称已经存在!");
                            return;
                        }
                        hK_Commodity.HKCommodityName = this.txtHKCommodityName.Text;
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("请填写代码名称!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.txtStockPinYin.Text))
                    {
                        hK_Commodity.StockPinYin = this.txtStockPinYin.Text;
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("拼音简称不能为空!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        hK_Commodity.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                    }
                    else
                    {
                        //cM_Commodity.BreedClassID = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("请选择品种类型!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.dtMarketDate.Text))
                    {
                        hK_Commodity.MarketDate = Convert.ToDateTime(this.dtMarketDate.Text);
                    }
                    else
                    {
                        //cM_Commodity.MarketDate = AppGlobalVariable.INIT_DATETIME;
                        ShowMessageBox.ShowInformation("请选择上市日期!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.txtturnovervolume.Text))
                    {
                        if (InputTest.intTest(this.txtturnovervolume.Text))
                        {
                            hK_Commodity.turnovervolume = Convert.ToDouble(this.txtturnovervolume.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入正整数!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("流通股数不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtPerHandThighOrShare.Text))
                    {
                        if (InputTest.intTest(this.txtPerHandThighOrShare.Text))
                        {
                            hK_Commodity.PerHandThighOrShare = Convert.ToInt32(this.txtPerHandThighOrShare.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入正整数!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("每手股数不能为空!");
                        return;
                    }
                    hK_Commodity.ISSysDefaultCode = (int)GTA.VTS.Common.CommonObject.Types.IsYesOrNo.No;
                    //用户添加的代码不是系统默认代码
                    m_Result = HKManageCommon.AddHKCommodity(hK_Commodity);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.QueryHKCommodity();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-7703";
                    string      errMsg    = "添加港股交易商品失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

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

                try
                {
                    HK_Commodity hK_Commodity = new HK_Commodity();
                    if (string.IsNullOrEmpty(this.txtHKCommodityCode.Text))
                    {
                        ShowMessageBox.ShowInformation("请选择更新数据!");
                        return;
                    }
                    hK_Commodity.HKCommodityCode = this.txtHKCommodityCode.Text;
                    if (!string.IsNullOrEmpty(this.cmbBreedClassID.Text))
                    {
                        hK_Commodity.BreedClassID = ((UComboItem)this.cmbBreedClassID.SelectedItem).ValueIndex;
                    }
                    else
                    {
                        //cM_Commodity.BreedClassID = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("请选择品种类型!");
                        return;
                    }
                    //注释掉修改港股代码的系统默认代码值
                    //hK_Commodity.ISSysDefaultCode = AppGlobalVariable.INIT_INT;//用户添加的代码不是系统默认代码
                    hK_Commodity.ISSysDefaultCode = m_ISSysDefaultCode; //当是修改时不改变原来的系统默认代码默认值
                    m_Result = HKManageCommon.UpdateHKCommodity(hK_Commodity);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.ClearAll();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                    this.QueryHKCommodity();
                    //this.txtHKCommodityCode.Enabled = true;//操作结束代码变成可输入状态
                    m_ISSysDefaultCode = AppGlobalVariable.INIT_INT;
                    this.ClearAll();
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-7704";
                    string      errMsg    = "修改港股交易商品失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion
            }
        }