/// <summary> /// 更新现货涨跌幅取值和涨跌幅类型及有效申报和有效申报类型 /// </summary> /// <param name="xHSpotHighLowConType"></param> /// <param name="xHSpotHighLowValue"></param> /// <param name="xHValidDecType"></param> /// <param name="xHValidDeclareValue"></param> /// <returns></returns> public static bool UpdateXHSpotHighLowAndValidDecl(XH_SpotHighLowControlType xHSpotHighLowConType, XH_SpotHighLowValue xHSpotHighLowValue, XH_ValidDeclareType xHValidDecType, XH_ValidDeclareValue xHValidDeclareValue) { XH_SpotHighLowControlTypeBLL xhSpotHighLowControlTypeBll = new XH_SpotHighLowControlTypeBLL(); return(xhSpotHighLowControlTypeBll.UpdateXHSpotHighLowAndValidDecl(xHSpotHighLowConType, xHSpotHighLowValue, xHValidDecType, xHValidDeclareValue)); }
/// <summary> /// 添加现货涨跌幅和有效申报 /// </summary> /// <param name="xHSpotHighLowConType"></param> /// <param name="xHSpotHighLowValue"></param> /// <param name="xHValidDecType">有效申报类型实体类</param> /// <param name="xHValidDeclareValue">有效申报取值实体</param> /// <returns></returns> public static XH_AboutSpotHighLowEntity AddXHSpotHighLowAndValidDecl(XH_SpotHighLowControlType xHSpotHighLowConType, XH_SpotHighLowValue xHSpotHighLowValue, XH_ValidDeclareType xHValidDecType, XH_ValidDeclareValue xHValidDeclareValue) { XH_SpotHighLowControlTypeBLL xhSpotHighLowControlTypeBll = new XH_SpotHighLowControlTypeBLL(); return(xhSpotHighLowControlTypeBll.AddXHSpotHighLowAndValidDecl(xHSpotHighLowConType, xHSpotHighLowValue, xHValidDecType, xHValidDeclareValue)); }
public XH_SpotHighLowControlType GetSpotHighLowControlTypeByBreedClassID(int breedClassID) { XH_SpotHighLowControlType result = null; XH_SpotTradeRules rules = GetSpotTradeRulesByBreedClassID(breedClassID); if (rules != null) { if (rules.BreedClassHighLowID.HasValue) { result = GetSpotHighLowControlTypeByBreedClassHighLowID(rules.BreedClassHighLowID.Value); } } return(result); }
/// <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> /// 当前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="xHSpotHighLowConType"></param> /// <param name="xHSpotHighLowValue"></param> /// <param name="xHValidDecType"></param> /// <param name="xHValidDeclareValue"></param> /// <returns></returns> public bool UpdateXHSpotHighLowAndValidDecl(XH_SpotHighLowControlType xHSpotHighLowConType, XH_SpotHighLowValue xHSpotHighLowValue, XH_ValidDeclareType xHValidDecType, XH_ValidDeclareValue xHValidDeclareValue) { XH_SpotHighLowValueDAL xHSpotHighLowValueDAL = new XH_SpotHighLowValueDAL(); XH_SpotHighLowControlTypeDAL xHSpotHighLowControlTypeDAL = new XH_SpotHighLowControlTypeDAL(); XH_ValidDeclareTypeDAL xHValidDeclareTypeDAL = new XH_ValidDeclareTypeDAL(); XH_ValidDeclareValueDAL xHValidDeclareValueDAL = new XH_ValidDeclareValueDAL(); DbConnection Conn = null; Database db = DatabaseFactory.CreateDatabase(); Conn = db.CreateConnection(); if (Conn.State != ConnectionState.Open) { Conn.Open(); } DbTransaction Tran = Conn.BeginTransaction(); try { if (!xHSpotHighLowControlTypeDAL.Update(xHSpotHighLowConType)) { Tran.Rollback(); return(false); } if (!xHSpotHighLowValueDAL.Update(xHSpotHighLowValue)) { Tran.Rollback(); return(false); } if (!xHValidDeclareTypeDAL.Update(xHValidDecType)) { Tran.Rollback(); return(false); } if (!xHValidDeclareValueDAL.Update(xHValidDeclareValue)) { Tran.Rollback(); return(false); } Tran.Commit(); return(true); } catch (Exception ex) { Tran.Rollback(); string errCode = "GL-5223"; string errMsg = "更新涨跌幅取值和涨跌幅类型失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return(false); } finally { if (Conn.State == ConnectionState.Open) { Conn.Close(); } } }
/// <summary> /// 添加现货涨跌幅和有效申报 /// </summary> /// <param name="xHSpotHighLowConType"></param> /// <param name="xHSpotHighLowValue"></param> /// <param name="xHValidDecType">有效申报类型实体类</param> /// <param name="xHValidDeclareValue">有效申报取值实体</param> /// <returns></returns> public XH_AboutSpotHighLowEntity AddXHSpotHighLowAndValidDecl(XH_SpotHighLowControlType xHSpotHighLowConType, XH_SpotHighLowValue xHSpotHighLowValue, XH_ValidDeclareType xHValidDecType, XH_ValidDeclareValue xHValidDeclareValue) { XH_SpotHighLowValueDAL xHSpotHighLowValueDAL = new XH_SpotHighLowValueDAL(); XH_SpotHighLowControlTypeDAL xHSpotHighLowControlTypeDAL = new XH_SpotHighLowControlTypeDAL(); XH_ValidDeclareTypeDAL xHValidDeclareTypeDAL = new XH_ValidDeclareTypeDAL(); XH_ValidDeclareValueDAL xHValidDeclareValueDAL = new XH_ValidDeclareValueDAL(); DbConnection Conn = null; Database db = DatabaseFactory.CreateDatabase(); Conn = db.CreateConnection(); if (Conn.State != ConnectionState.Open) { Conn.Open(); } DbTransaction Tran = Conn.BeginTransaction(); try { int breedClassHighLowID = AppGlobalVariable.INIT_INT; int breedClassValidID = AppGlobalVariable.INIT_INT; //List<XH_AboutSpotHighLowEntity> xhAboutSpotHighLowEList=new List<XH_AboutSpotHighLowEntity>(); XH_AboutSpotHighLowEntity xhAboutSpotHighLowEntity = new XH_AboutSpotHighLowEntity(); breedClassHighLowID = xHSpotHighLowControlTypeDAL.Add(xHSpotHighLowConType, Tran, db); if (breedClassHighLowID != AppGlobalVariable.INIT_INT) { xHSpotHighLowValue.BreedClassHighLowID = breedClassHighLowID; if (xHSpotHighLowValueDAL.AddXHSpotHighLowValue(xHSpotHighLowValue, Tran, db) == AppGlobalVariable.INIT_INT) { Tran.Rollback(); } } breedClassValidID = xHValidDeclareTypeDAL.AddValidDeclareType(xHValidDecType, Tran, db); if (breedClassValidID != AppGlobalVariable.INIT_INT) { xHValidDeclareValue.BreedClassValidID = breedClassValidID; if (!xHValidDeclareValueDAL.Add(xHValidDeclareValue, Tran, db)) { Tran.Rollback(); } } Tran.Commit(); xhAboutSpotHighLowEntity.BreedClassHighLowID = breedClassHighLowID; xhAboutSpotHighLowEntity.BreedClassValidID = breedClassValidID; return(xhAboutSpotHighLowEntity); } catch (Exception ex) { Tran.Rollback(); string errCode = "GL-5224"; string errMsg = "添加现货和有效申报失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return(null); } finally { if (Conn.State == ConnectionState.Open) { Conn.Close(); } } }