private void InitData(CafcService.ForecastPrj prjObj) { this.tePrjId.Text = prjObj.Prj_Id; this.dtEndTime.Text = Convert.ToString(prjObj.StartTime); this.dtEndTime.Text = Convert.ToString(prjObj.EndTime); this.teRemarks.Text = prjObj.Remarks; }
private void GetDefaultPrjId() { //if (string.IsNullOrEmpty(this.defaultPrjId)) //{ CafcService.ForecastPrj defaultPrjObj = this.GetEidtForecastPrjObj(); if (defaultPrjObj != null) { this.defaultPrjId = defaultPrjObj.Prj_Id; } //} }
//向服务器传递新的预测数据项目 private bool newProject() { string preTime = String.Format("{0}/{1}/{2}", this.comboBoxEdit1.Text, DateTime.Now.Month, DateTime.Now.Day); CafcService.ForecastPrj prjObj = new CafcService.ForecastPrj() { Prj_Id = "prj_" + Utils.userId, StartTime = Convert.ToDateTime(preTime), EndTime = Convert.ToDateTime(preTime) }; return(Utils.serviceCafc.SaveForecastPrj(Utils.userId, Utils.password, prjObj)); }
// 保存预测项目名称 private void btnSave_Click(object sender, EventArgs e) { CafcService.ForecastPrj prjObj = new CafcService.ForecastPrj(); string prjId = this.tePrjId.Text.Trim(); string startTime = this.dtStartTime.Text.Trim(); string endTime = this.dtEndTime.Text.Trim(); string remarks = this.teRemarks.Text.Trim(); if (true) { // TODO 验证输入信息 } prjObj.Prj_Id = prjId; prjObj.StartTime = Convert.ToDateTime(startTime); prjObj.EndTime = Convert.ToDateTime(endTime); prjObj.Remarks = remarks; bool flag = false; string msg = string.Empty; this.DialogResult = DialogResult.No; try { flag = this.SaveForecastPrj(prjObj); if (flag) { msg = "项目保存成功!"; this.DialogResult = DialogResult.OK; } else { msg = "项目保存失败"; } } catch (Exception ex) { msg = "项目保存失败:" + ex.Message; } MessageBox.Show(msg); this.Close(); }
/// <summary> /// 保存预测项目数据 /// </summary> /// <param name="prjObj"></param> /// <returns></returns> private bool SaveForecastPrj(CafcService.ForecastPrj prjObj) { bool flag = false; try { if (this.operateType == StaticUtil.AddOp) { flag = cafcService.SaveForecastPrj(Utils.userId, Utils.password, prjObj); } if (this.operateType == StaticUtil.EditOp) { flag = cafcService.UpdateForecastPrj(Utils.userId, Utils.password, prjObj); } } catch (Exception ex) { throw ex; } return(flag); }
/// <summary> /// 新增预测数据(现有数据源) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddData_ItemClick(object sender, ItemClickEventArgs e) { try { CafcService.ForecastPrj addPrjObj = this.GetEidtForecastPrjObj(); if (addPrjObj != null) { this.defaultPrjId = addPrjObj.Prj_Id; AddExistDataForm newDataFrm = new AddExistDataForm(addPrjObj.Prj_Id); DialogResult addParamFrmResult = newDataFrm.ShowDialog(); if (addParamFrmResult == DialogResult.OK) { this.SearchForecastParam(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 双击预测项目行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvForePrj_DoubleClick(object sender, EventArgs e) { ColumnView cv = (ColumnView)gcForePrj.FocusedView; CafcService.ForecastPrj prjObj = (CafcService.ForecastPrj)cv.GetFocusedRow(); try { if (prjObj != null) { AddForePrjForm editPrjForm = new AddForePrjForm(StaticUtil.EditOp, prjObj); DialogResult editResult = editPrjForm.ShowDialog(); if (editResult == DialogResult.OK) { this.SearchForecastPrj();; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AddForePrjForm(string operateType, CafcService.ForecastPrj prjObj) : this(operateType) { this.InitData(prjObj); }