/// <summary> /// 选择车型是自动加载其他油耗数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cbClxh_SelectedIndexChanged(object sender, EventArgs e) { string selectedClxh = this.cbClxh.Text.Trim(); CafcService.ForecastParam param = null; try { foreach (CafcService.ForecastParam p in existParamArray) { if (p.Clxh == selectedClxh) { param = p; break; } } this.cbRllx.Text = Convert.ToString(param.Rllx); this.cbBsqxs.Text = Convert.ToString(param.Bsqxs); this.teZwps.Text = Convert.ToString(param.Zwps); this.teZczbzl.Text = Convert.ToString(param.Zczbzl); this.teZhgkxslc.Text = Convert.ToString(param.Zhgkxslc); this.teZhgkrlxhl.Text = Convert.ToString(param.Zhgkrlxhl); } catch (Exception ex) { throw ex; } }
/// <summary> /// 初始化带修改的数据 /// </summary> /// <param name="prjObj"></param> private void InitData(CafcService.ForecastParam paramObj) { this.tePrjId.Text = paramObj.Prj_Id; this.cbClxh.Text = paramObj.Clxh; this.cbRllx.Text = paramObj.Rllx; this.cbBsqxs.Text = paramObj.Bsqxs; this.teZwps.Text = Convert.ToString(paramObj.Zwps); this.teZczbzl.Text = Convert.ToString(paramObj.Zczbzl); this.teZhgkxslc.Text = Convert.ToString(paramObj.Zhgkxslc); this.teZhgkrlxhl.Text = Convert.ToString(paramObj.Zhgkrlxhl); this.teJksl.Text = Convert.ToString(paramObj.Sl); }
/// <summary> /// 获取界面上的数据 /// </summary> public CafcService.ForecastParam GetPageData() { CafcService.ForecastParam pageParamObj = new CafcService.ForecastParam(); if (this.operateType == StaticUtil.EditOp) { pageParamObj.Param_Id = this.ParamObj.Param_Id; } pageParamObj.Prj_Id = this.tePrjId.Text.Trim(); pageParamObj.Qcscqy = Utils.qymc; pageParamObj.Clxh = this.cbClxh.Text.Trim(); pageParamObj.Rllx = this.cbRllx.Text.Trim(); pageParamObj.Bsqxs = this.cbBsqxs.Text.Trim(); pageParamObj.Zwps = Convert.ToInt32(this.teZwps.Text.Trim()); pageParamObj.Zczbzl = Convert.ToInt32(this.teZczbzl.Text.Trim()); pageParamObj.Zhgkxslc = Convert.ToDecimal(this.teZhgkxslc.Text.Trim()); pageParamObj.Zhgkrlxhl = Convert.ToDecimal(this.teZhgkrlxhl.Text.Trim()); pageParamObj.Sl = Convert.ToInt32(this.teJksl.Text.Trim()); return(pageParamObj); }
/// <summary> /// 获取选中的数据 /// </summary> /// <returns></returns> private CafcService.ForecastParam[] GetSelectedData() { List <CafcService.ForecastParam> selectedParam = new List <CafcService.ForecastParam>(); try { this.gvParam.PostEditor(); CafcService.FuelCAFCDetails[] detailObjArr = (CafcService.FuelCAFCDetails[]) this.gvParam.DataSource; if (detailObjArr != null) { foreach (CafcService.FuelCAFCDetails detailObj in detailObjArr) { if (detailObj.Check) { CafcService.ForecastParam paramObj = new CafcService.ForecastParam(); paramObj.Prj_Id = this.PrjId; paramObj.Qcscqy = detailObj.Qcscqy; paramObj.Clxh = detailObj.Clxh; paramObj.Rllx = detailObj.Rllx; paramObj.Bsqxs = detailObj.Bsqxs; paramObj.Zczbzl = detailObj.Zczbzl; paramObj.Zwps = detailObj.Zwps; paramObj.Zhgkxslc = detailObj.Zhgkxslc; paramObj.Zhgkrlxhl = detailObj.ActZhgkrlxhl; paramObj.Sl = detailObj.Sl_act; selectedParam.Add(paramObj); } } } } catch (Exception ex) { throw ex; } return(selectedParam.ToArray()); }
/// <summary> /// 修改预测数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEditData_ItemClick(object sender, ItemClickEventArgs e) { try { CafcService.ForecastParam editParamObj = this.GetEidtForecastParamObj(); if (editParamObj != null) { this.defaultPrjId = editParamObj.Prj_Id; AddNewParamForm editParamForm = new AddNewParamForm(StaticUtil.EditOp, editParamObj); DialogResult editResult = editParamForm.ShowDialog(); if (editResult == DialogResult.OK) { this.SearchForecastParam();; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//向服务器传递新的预测数据 private static bool newCarType(DataTable _dt) { DataTable dt = _dt; List <CafcService.ForecastParam> dataList = new List <CafcService.ForecastParam>(); foreach (DataRow dr in dt.Rows) { CafcService.ForecastParam obj = new CafcService.ForecastParam(); obj.Prj_Id = "prj_" + Utils.userId; obj.Qcscqy = Utils.qymc; obj.Clxh = string.IsNullOrEmpty(dr["CLXH"].ToString()) ? "" : dr["CLXH"].ToString(); obj.Rllx = string.IsNullOrEmpty(dr["RLLX"].ToString()) ? "" : dr["RLLX"].ToString(); obj.Bsqxs = string.IsNullOrEmpty(dr["BSQXS"].ToString()) ? "" : dr["BSQXS"].ToString(); obj.Zwps = string.IsNullOrEmpty(dr["ZWPS"].ToString()) ? 0 : Convert.ToInt32(dr["ZWPS"]); obj.Zczbzl = string.IsNullOrEmpty(dr["ZCZBZL"].ToString()) ? 0 : Convert.ToInt32(dr["ZCZBZL"]); obj.Zhgkxslc = string.IsNullOrEmpty(dr["ZHGKXSLC"].ToString()) ? 0 : Convert.ToDecimal(dr["ZHGKXSLC"]); obj.Zhgkrlxhl = string.IsNullOrEmpty(dr["ZHGKRLXHL"].ToString()) ? 0 : Convert.ToDecimal(dr["ZHGKRLXHL"]); obj.Sl = string.IsNullOrEmpty(dr["SL"].ToString()) ? 0 : Convert.ToInt32(dr["SL"]); dataList.Add(obj); } return(Utils.serviceCafc.SaveForecastParam(Utils.userId, Utils.password, dataList.ToArray())); }
private bool newCarType(DataTable _dt) { DataTable dt = _dt; //var dataArr = (from d in dt.AsEnumerable() // select new CafcService.ForecastParam // { // Prj_Id = "prj_" + Utils.userId, // Qcscqy = Utils.qymc, // Clxh = d.Field<string>("CLXH"), // Rllx = d.Field<string>("RLLX"), // Bsqxs = d.Field<string>("BSQXS"), // Zwps = string.IsNullOrEmpty(d.Field<string>("ZWPS")) ? 0 : Convert.ToInt32(d.Field<string>("ZWPS")), // Zczbzl = string.IsNullOrEmpty(d.Field<string>("ZCZBZL")) ? 0 : Convert.ToInt32(d.Field<string>("ZCZBZL")), // Zhgkxslc = string.IsNullOrEmpty(d.Field<string>("ZHGKXSLC")) ? 0 : Convert.ToDecimal(d.Field<string>("ZHGKXSLC")), // Zhgkrlxhl = string.IsNullOrEmpty(d.Field<string>("ZHGKRLXHL")) ? 0 : Convert.ToDecimal(d.Field<string>("ZHGKRLXHL")), // Sl = string.IsNullOrEmpty(d.Field<string>("SL")) ? 0 : Convert.ToInt32(d.Field<string>("SL")), // }).ToArray(); List <CafcService.ForecastParam> dataList = new List <CafcService.ForecastParam>(); foreach (DataRow dr in dt.Rows) { CafcService.ForecastParam obj = new CafcService.ForecastParam(); obj.Prj_Id = "prj_" + Utils.userId; obj.Qcscqy = Utils.qymc; obj.Clxh = string.IsNullOrEmpty(dr["CLXH"].ToString()) ? "" : dr["CLXH"].ToString(); obj.Rllx = string.IsNullOrEmpty(dr["RLLX"].ToString()) ? "" : dr["RLLX"].ToString(); obj.Bsqxs = string.IsNullOrEmpty(dr["BSQXS"].ToString()) ? "" : dr["BSQXS"].ToString(); obj.Zwps = string.IsNullOrEmpty(dr["ZWPS"].ToString()) ? 0 : Convert.ToInt32(dr["ZWPS"]); obj.Zczbzl = string.IsNullOrEmpty(dr["ZCZBZL"].ToString()) ? 0 : Convert.ToInt32(dr["ZCZBZL"]); obj.Zhgkxslc = string.IsNullOrEmpty(dr["ZHGKXSLC"].ToString()) ? 0 : Convert.ToDecimal(dr["ZHGKXSLC"]); obj.Zhgkrlxhl = string.IsNullOrEmpty(dr["ZHGKRLXHL"].ToString()) ? 0 : Convert.ToDecimal(dr["ZHGKRLXHL"]); obj.Sl = string.IsNullOrEmpty(dr["SL"].ToString()) ? 0 : Convert.ToInt32(dr["SL"]); dataList.Add(obj); } return(cafcService.SaveForecastParam(Utils.userId, Utils.password, dataList.ToArray())); }
/// <summary> /// 编辑预测参数的构造 /// </summary> /// <param name="operateType"></param> /// <param name="paramObj"></param> public AddNewParamForm(string operateType, CafcService.ForecastParam paramObj) : this(operateType) { this.ParamObj = paramObj; this.InitData(this.ParamObj); }