/// <summary> /// 添加或修改最后交易日 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { QH_LastTradingDay qHLastTradingDay = new QH_LastTradingDay(); if (!string.IsNullOrEmpty(this.cmbLastTradingDayType.Text)) { qHLastTradingDay.LastTradingDayTypeID = ((UComboItem)this.cmbLastTradingDayType.SelectedItem).ValueIndex; } else { // qHLastTradingDay.LastTradingDayTypeID = AppGlobalVariable.INIT_INT; ShowMessageBox.ShowInformation("最后交易日类型不能为空!"); return; } if (!string.IsNullOrEmpty(this.cmbSequence.Text)) { qHLastTradingDay.Sequence = ((UComboItem)this.cmbSequence.SelectedItem).ValueIndex; } else { qHLastTradingDay.Sequence = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.cmbWeek.Text)) { qHLastTradingDay.Week = ((UComboItem)this.cmbWeek.SelectedItem).ValueIndex; } else { qHLastTradingDay.Week = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.speWhatDay.Text)) { qHLastTradingDay.WhatDay = Convert.ToInt32(this.speWhatDay.EditValue); ; } else { qHLastTradingDay.WhatDay = AppGlobalVariable.INIT_INT; } if (!string.IsNullOrEmpty(this.speWhatWeek.Text)) { qHLastTradingDay.WhatWeek = Convert.ToInt32(this.speWhatWeek.EditValue); } else { qHLastTradingDay.WhatWeek = AppGlobalVariable.INIT_INT; } if (LastTradingDayUIEditType == (int)UITypes.EditTypeEnum.AddUI) { int lastTradingDayID = FuturesManageCommon.AddQHLastTradingDay(qHLastTradingDay); if (lastTradingDayID != AppGlobalVariable.INIT_INT) { LastTradingDayID = lastTradingDayID; ShowMessageBox.ShowInformation("添加成功!"); this.ClearAll(); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("添加失败!"); } } else if (LastTradingDayUIEditType == (int)UITypes.EditTypeEnum.UpdateUI) { switch (this.cmbLastTradingDayType.SelectedIndex) { case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAndDay - 1: qHLastTradingDay.WhatWeek = 0; qHLastTradingDay.Week = 0; qHLastTradingDay.Sequence = 1; //默认顺数 break; case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAndDownOrShunAndWeek - 1: //qHLastTradingDay.WhatDay = 0; qHLastTradingDay.Week = 0; qHLastTradingDay.WhatWeek = 0; break; case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAndWeek - 1: qHLastTradingDay.WhatDay = 0; qHLastTradingDay.Sequence = 1; //默认顺数 break; case (int)GTA.VTS.Common.CommonObject.Types.QHLastTradingDayType.DeliMonthAgoMonthLastTradeDay - 1: qHLastTradingDay.WhatWeek = 0; qHLastTradingDay.Week = 0; //qHLastTradingDay.Sequence = 1;//默认顺数 break; } if (m_UpdateLastTradingDayID != AppGlobalVariable.INIT_INT) { qHLastTradingDay.LastTradingDayID = m_LastTradingDayID; } bool _UpResult = FuturesManageCommon.UpdateQHLastTradingDay(qHLastTradingDay); if (_UpResult) { ShowMessageBox.ShowInformation("修改成功!"); this.DialogResult = DialogResult.OK; this.Close(); } else { ShowMessageBox.ShowInformation("修改失败!"); } } } catch (Exception ex) { string errCode = "GL-5841"; string errMsg = "添加或修改最后交易日失败!"; VTException exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); return;; } }