/// <summary> /// 更新非交易日 /// </summary> /// <param name="model">非交易日实体</param> /// <returns></returns> public bool UpdateCMNotTradeDate(ManagementCenter.Model.CM_NotTradeDate model) { try { return(cM_NotTradeDateDAL.Update(model)); } catch (Exception ex) { string errCode = "GL-4722"; string errMsg = "修改非交易日失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return(false); } }
/// <summary> /// 添加非交易日 /// </summary> /// <param name="model">非交易日实体</param> /// <returns></returns> public int AddCMNotTradeDate(ManagementCenter.Model.CM_NotTradeDate model) { try { return(cM_NotTradeDateDAL.Add(model)); } catch (Exception ex) { string errCode = "GL-4720"; string errMsg = "添加非交易日失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return(AppGlobalVariable.INIT_INT); } }
/// <summary> /// 确定按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { //通过判断操作类型来进行操作 1:添加操作 2:修改操作 if (m_EditType == 1) { #region 添加操作 try { CM_NotTradeDate cM_NotTradeDate = new CM_NotTradeDate(); int BourseTypeID; DateTime NotTradeDay; if (!string.IsNullOrEmpty(this.cmbBourseTypeID.Text)) { BourseTypeID = ((UComboItem)this.cmbBourseTypeID.SelectedItem).ValueIndex; cM_NotTradeDate.BourseTypeID = BourseTypeID; } else { //cM_NotTradeDate.BourseTypeID = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("请选择交易所名称!"); return; } if (!string.IsNullOrEmpty(this.dtNotTradeDay.Text)) { NotTradeDay = Convert.ToDateTime(this.dtNotTradeDay.Text); cM_NotTradeDate.NotTradeDay = NotTradeDay; } else { // cM_NotTradeDate.NotTradeDay = AppGlobalVariable.INIT_DATETIME; ShowMessageBox.ShowInformation("请选择非交易日!"); return; } ManagementCenter.Model.CM_NotTradeDate NotTradeDate = CommonParameterSetCommon.GetNotTradeDate(BourseTypeID, NotTradeDay); if (NotTradeDate == null) { int result = CommonParameterSetCommon.AddCMNotTradeDate(cM_NotTradeDate); if (result != AppGlobalVariable.INIT_INT) { ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.QueryCMNotTradeDate(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else { ShowMessageBox.ShowInformation("该非交易日时间已经存在,请勿添加重复数据!"); } } catch (Exception ex) { string errCode = "GL-4421"; string errMsg = " 添加交易所类型_非交易日期失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion 添加操作 } else if (m_EditType == 2) { #region 修改操作 try { CM_NotTradeDate cM_NotTradeDate = new CM_NotTradeDate(); if (m_NotTradeDateID == AppGlobalVariable.INIT_INT) { ShowMessageBox.ShowInformation("请选择更新数据!"); return; } cM_NotTradeDate.NotTradeDateID = m_NotTradeDateID; //cM_NotTradeDate.BourseTypeID = ((UComboItem)this.cmbBourseTypeID.SelectedItem).ValueIndex; //cM_NotTradeDate.NotTradeDay = Convert.ToDateTime(this.dtNotTradeDay.Text); int BourseTypeID; DateTime NotTradeDay; if (!string.IsNullOrEmpty(this.cmbBourseTypeID.Text)) { BourseTypeID = ((UComboItem)this.cmbBourseTypeID.SelectedItem).ValueIndex; cM_NotTradeDate.BourseTypeID = BourseTypeID; } else { ShowMessageBox.ShowInformation("请选择交易所名称!"); return; } if (!string.IsNullOrEmpty(this.dtNotTradeDay.Text)) { NotTradeDay = Convert.ToDateTime(this.dtNotTradeDay.Text); cM_NotTradeDate.NotTradeDay = NotTradeDay; } else { // cM_NotTradeDate.NotTradeDay = AppGlobalVariable.INIT_DATETIME; ShowMessageBox.ShowInformation("请选择非交易日期!"); return; } ManagementCenter.Model.CM_NotTradeDate NotTradeDate = CommonParameterSetCommon.GetNotTradeDate(BourseTypeID, NotTradeDay); if (NotTradeDate == null) { m_Result = CommonParameterSetCommon.UpdateCMNotTradeDate(cM_NotTradeDate); if (m_Result) { ShowMessageBox.ShowInformation("修改成功!"); this.ClearAll(); //btnAdd.Enabled = true; //btnModify.Enabled = false; m_NotTradeDateID = AppGlobalVariable.INIT_INT; } else { ShowMessageBox.ShowInformation("修改失败!"); } this.QueryCMNotTradeDate(); } else { ShowMessageBox.ShowInformation("该非交易日时间已经存在,无法修改成重复数据!"); } } catch (Exception ex) { string errCode = "GL-4423"; string errMsg = "修改交易所类型_非交易日期失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return; } #endregion 修改操作 } }
/// <summary> /// 更新非交易日 /// </summary> /// <param name="model">非交易日实体</param> /// <returns></returns> public static bool UpdateCMNotTradeDate(ManagementCenter.Model.CM_NotTradeDate model) { CM_NotTradeDateBLL cM_NotTradeDateBLL = new CM_NotTradeDateBLL(); return(cM_NotTradeDateBLL.UpdateCMNotTradeDate(model)); }
/// <summary> /// 添加非交易日 /// </summary> /// <param name="model">非交易日实体</param> /// <returns></returns> public static int AddCMNotTradeDate(ManagementCenter.Model.CM_NotTradeDate model) { CM_NotTradeDateBLL cM_NotTradeDateBLL = new CM_NotTradeDateBLL(); return(cM_NotTradeDateBLL.AddCMNotTradeDate(model)); }