//加载负荷数据 private void barButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //FormForecastLoadDataforMaxHour ffs = new FormForecastLoadDataforMaxHour(); FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.maxhour = true; ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) return; Hashtable hs = ffs.HS; if (hs.Count == 0) return; string id = Guid.NewGuid().ToString(); foreach (Ps_History de3 in hs.Values) { Ps_Forecast_Math psp_Type = new Ps_Forecast_Math(); psp_Type.ForecastID = forecastReport.ID; psp_Type.Forecast = type; IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type); for (int j = 0; j < listTypes.Count; j++) { Ps_Forecast_Math currtenpfm = (Ps_Forecast_Math)listTypes[j]; //更新负荷数据 if (currtenpfm.Sort == 2) { for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { currtenpfm.GetType().GetProperty("y" + i).SetValue(currtenpfm, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); commonhelp.ResetValue(currtenpfm.ID, "y" + i); } Common.Services.BaseService.Update<Ps_Forecast_Math>(currtenpfm); break; } } } LoadData(); this.chart_user1.All_Select(true); RefreshChart(); }
private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) return; Hashtable hs = ffs.HS; if (hs.Count == 0) return; string id = Guid.NewGuid().ToString(); foreach (Ps_History de3 in hs.Values) { if (OldHt.ContainsKey(de3.Title)) { Ps_Forecast_Math py = Common.Services.BaseService.GetOneByKey<Ps_Forecast_Math>(OldHt[de3.Title]); for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { commonhelp.ResetValue(py.ID, "y" + i); py.GetType().GetProperty("y" + i).SetValue(py, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } Services.BaseService.Update<Ps_Forecast_Math>(py); } else { Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math(); ForecastMath.Title = de3.Title; for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { ForecastMath.GetType().GetProperty("y" + i).SetValue(ForecastMath, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } id = id.Substring(0, 8); ForecastMath.Col1 = de3.ID; ForecastMath.ID = id + "|" + de3.ID; if (de3.ParentID == "") { ForecastMath.ParentID = ""; } else { ForecastMath.ParentID = id + "|" + de3.ParentID; } ForecastMath.Forecast = type; ForecastMath.ForecastID = forecastReport.ID; ForecastMath.Sort = de3.Sort; Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath); } } LoadData(); this.chart_user1.All_Select(true); RefreshChart(); }
/// <summary> /// 读取原始数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) { return; } Hashtable hs = ffs.HS; if (hs.Count == 0) { return; } string id = Guid.NewGuid().ToString(); foreach (Ps_History de3 in hs.Values) { if (OldHt.ContainsKey(de3.Title)) { Ps_Forecast_Math py = Common.Services.BaseService.GetOneByKey <Ps_Forecast_Math>(OldHt[de3.Title]); for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { commonhelp.ResetValue(py.ID, "y" + i); py.GetType().GetProperty("y" + i).SetValue(py, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } Services.BaseService.Update <Ps_Forecast_Math>(py); } else { Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math(); ForecastMath.Title = de3.Title; for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { ForecastMath.GetType().GetProperty("y" + i).SetValue(ForecastMath, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } id = id.Substring(0, 8); ForecastMath.Col1 = de3.ID; ForecastMath.ID = id + "|" + de3.ID; if (de3.ParentID == "") { ForecastMath.ParentID = ""; } else { ForecastMath.ParentID = id + "|" + de3.ParentID; } ForecastMath.Forecast = type; ForecastMath.ForecastID = forecastReport.ID; ForecastMath.Sort = de3.Sort; Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath); } } LoadData(); this.chart_user1.All_Select(true); RefreshChart(); }
/// <summary> /// 读取原始数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem1_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) { return; } Hashtable hs = ffs.HS; if (hs.Count == 0) { return; } string id = Guid.NewGuid().ToString(); if (ffs.Selectid != "4") { foreach (Ps_History de3 in hs.Values) { if (OldHt.ContainsKey(de3.Title)) { Ps_Forecast_Math py = Common.Services.BaseService.GetOneByKey <Ps_Forecast_Math>(OldHt[de3.Title]); for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { commonhelp.ResetValue(py.ID, "y" + i); py.GetType().GetProperty("y" + i).SetValue(py, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } Services.BaseService.Update <Ps_Forecast_Math>(py); } else { Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math(); ForecastMath.Title = de3.Title; for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { ForecastMath.GetType().GetProperty("y" + i).SetValue(ForecastMath, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } id = id.Substring(0, 8); ForecastMath.Col1 = de3.ID; ForecastMath.ID = id + "|" + de3.ID; if (de3.ParentID == "") { ForecastMath.ParentID = ""; } else { ForecastMath.ParentID = id + "|" + de3.ParentID; } ForecastMath.Forecast = type; ForecastMath.ForecastID = forecastReport.ID; ForecastMath.Sort = de3.Sort; Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath); } } } else if (ffs.Selectid == "4") { foreach (PSP_Types de3 in hs.Values) { Ps_Forecast_Math py = new Ps_Forecast_Math(); //py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByWhere", "Title='" + de3.Title + "'" + " and Forecast='0' and ForecastID='" + forecastReport.ID + "' and Col1='"+de3.ID+"'"); py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByWhere", " Forecast = '" + type + "' and ForecastID='" + forecastReport.ID + "' and Col1='" + de3.ID + "'"); if (py == null) { Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math(); IList <PSP_Values> listValues = Common.Services.BaseService.GetList <PSP_Values>("SelectPSP_ValuesByWhere", "TypeID='" + de3.ID + "'"); foreach (PSP_Values value in listValues) { ForecastMath.GetType().GetProperty("y" + value.Year).SetValue(ForecastMath, value.Value, null); } id = id.Substring(0, 8); ForecastMath.Title = de3.Title; ForecastMath.Col1 = de3.ID.ToString(); ForecastMath.ID = id + "|" + de3.ID; ForecastMath.ParentID = id + "|" + de3.ParentID; ForecastMath.Forecast = type; ForecastMath.ForecastID = forecastReport.ID; object obj = Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null); if (obj != null) { ForecastMath.Sort = ((int)obj) + 1; } else { ForecastMath.Sort = 1; } Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath); } else { IList <PSP_Values> listValues = Common.Services.BaseService.GetList <PSP_Values>("SelectPSP_ValuesByWhere", " TypeID='" + de3.ID + "'"); foreach (PSP_Values value in listValues) { py.GetType().GetProperty("y" + value.Year).SetValue(py, value.Value, null); } Services.BaseService.Update <Ps_Forecast_Math>(py); } } } LoadData(); this.chart_user1.All_Select(true); RefreshChart(); }
private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) return; Hashtable hs = ffs.HS; if (hs.Count == 0) return; string id = Guid.NewGuid().ToString(); if (ffs.Selectid != "4") { foreach (Ps_History de3 in hs.Values) { Ps_Forecast_Math py = new Ps_Forecast_Math(); py.Col1 = de3.ID; py.Forecast = type; py.ForecastID = forecastReport.ID; py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByCol1", py); if (py == null) { Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math(); ForecastMath.Title = de3.Title; for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { ForecastMath.GetType().GetProperty("y" + i).SetValue(ForecastMath, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } id = id.Substring(0, 8); ForecastMath.Col1 = de3.ID; ForecastMath.ID = id + "|" + de3.ID; ForecastMath.ParentID = id + "|" + de3.ParentID; ForecastMath.Forecast = type; ForecastMath.ForecastID = forecastReport.ID; ForecastMath.Sort = de3.Sort; Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath); } else { for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { py.GetType().GetProperty("y" + i).SetValue(py, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } Services.BaseService.Update<Ps_Forecast_Math>(py); } } } else if (ffs.Selectid == "4") { foreach (PSP_Types de3 in hs.Values) { Ps_Forecast_Math py = new Ps_Forecast_Math(); //py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByWhere", "Title='" + de3.Title + "'" + " and Forecast='0' and ForecastID='" + forecastReport.ID + "' and Col1='"+de3.ID+"'"); py = (Ps_Forecast_Math)Services.BaseService.GetObject("SelectPs_Forecast_MathByWhere", " Forecast = '" + type + "' and ForecastID='" + forecastReport.ID + "' and Col1='" + de3.ID + "'"); if (py == null) { Ps_Forecast_Math ForecastMath = new Ps_Forecast_Math(); IList<PSP_Values> listValues = Common.Services.BaseService.GetList<PSP_Values>("SelectPSP_ValuesByWhere", "TypeID='" + de3.ID + "'"); foreach (PSP_Values value in listValues) { ForecastMath.GetType().GetProperty("y" + value.Year).SetValue(ForecastMath, value.Value, null); } id = id.Substring(0, 8); ForecastMath.Title = de3.Title; ForecastMath.Col1 = de3.ID.ToString(); ForecastMath.ID = id + "|" + de3.ID; ForecastMath.ParentID = id + "|" + de3.ParentID; ForecastMath.Forecast = type; ForecastMath.ForecastID = forecastReport.ID; object obj = Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null); if (obj != null) ForecastMath.Sort = ((int)obj) + 1; else ForecastMath.Sort = 1; Services.BaseService.Create("InsertPs_Forecast_MathbyPs_History", ForecastMath); } else { IList<PSP_Values> listValues = Common.Services.BaseService.GetList<PSP_Values>("SelectPSP_ValuesByWhere", " TypeID='" + de3.ID + "'"); foreach (PSP_Values value in listValues) { py.GetType().GetProperty("y" + value.Year).SetValue(py, value.Value, null); } Services.BaseService.Update<Ps_Forecast_Math>(py); } } } LoadData(); this.chart_user1.All_Select(true); RefreshChart(); }
/// <summary> /// 加载GDP数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.Nodes.Count<0) { return; } MessageBox.Show("请选择GDP一产、二产、三产数据"); FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.ISGDP = true; ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) return; Hashtable hs = ffs.HS; if (hs.Count == 0) return; DataRow gdprow = gdprows[0]; DataRow gdprow01 = gdprows01[0]; DataRow gdprow02 = gdprows02[0]; DataRow gdprow03 = gdprows03[0]; Ps_History gdph01 = null; Ps_History gdph02 = null; Ps_History gdph03 = null; bool have = false; foreach (Ps_History de3 in hs.Values) { if (de3.Title.Contains("一产")) { gdph01 = de3; have = true; continue; } if (de3.Title.Contains("二产")) { gdph02 = de3; have = true; continue; } if (de3.Title.Contains("三产")) { gdph03 = de3; have = true; continue; } } if (have) { double db01 = 0; double db02 = 0; double db03 = 0; WaitDialogForm wait = new WaitDialogForm("", "正在载入数据,请稍后..."); treeList1.BeginInit(); int sum = forecastReport.EndYear - forecastReport.StartYear; for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { int per = (i - forecastReport.StartYear) * 100 / sum; wait.SetCaption(per + "%"); if (gdph01!=null) { gdprow01["y" + i] = gdph01.GetType().GetProperty("y" + i).GetValue(gdph01, null); //commonhelp.ResetValue(gdprow01["ID"].ToString(), "y" + i); } if (gdph02 != null) { gdprow02["y" + i] = gdph02.GetType().GetProperty("y" + i).GetValue(gdph02, null); //commonhelp.ResetValue(gdprow02["ID"].ToString(), "y" + i); } if (gdph03 != null) { gdprow03["y" + i] = gdph03.GetType().GetProperty("y" + i).GetValue(gdph03, null); //commonhelp.ResetValue(gdprow03["ID"].ToString(), "y" + i); } db01 = double.Parse(gdprow01["y" + i].ToString()); db02 = double.Parse(gdprow02["y" + i].ToString()); db03 = double.Parse(gdprow03["y" + i].ToString()); gdprow["y" + i] = db01 + db02 + db03; } Ps_Forecast_Math gdppfm01 = DataConverter.RowToObject<Ps_Forecast_Math>(gdprow01); Ps_Forecast_Math gdppfm02 = DataConverter.RowToObject<Ps_Forecast_Math>(gdprow02); Ps_Forecast_Math gdppfm03 = DataConverter.RowToObject<Ps_Forecast_Math>(gdprow03); Ps_Forecast_Math gdppfm = DataConverter.RowToObject<Ps_Forecast_Math>(gdprow); Common.Services.BaseService.Update<Ps_Forecast_Math>(gdppfm01); Common.Services.BaseService.Update<Ps_Forecast_Math>(gdppfm02); Common.Services.BaseService.Update<Ps_Forecast_Math>(gdppfm03); Common.Services.BaseService.Update<Ps_Forecast_Math>(gdppfm); treeList1.EndInit(); wait.Close(); GDPIncrease(); } RefreshChart(); }
/// <summary> /// 加载GDP数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //FormLoadForecastDataforMaxHour frm = new FormLoadForecastDataforMaxHour(); //frm.ProjectUID = Itop.Client.MIS.ProgUID; //if (frm.ShowDialog() == DialogResult.OK) //{ // DataRow row = frm.ROW; // Ps_Forecast_Math psp_Type = new Ps_Forecast_Math(); // psp_Type.ForecastID = forecastReport.ID; // psp_Type.Forecast = type; // IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type); // for (int j = 0; j < listTypes.Count; j++) // { // Ps_Forecast_Math currtenpfm=(Ps_Forecast_Math)listTypes[j]; // //更新GDP数据 // if (currtenpfm.Sort==1) // { // for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) // { // currtenpfm.GetType().GetProperty("y" + i).SetValue(currtenpfm, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 1), null); // } // Common.Services.BaseService.Update<Ps_Forecast_Math>(currtenpfm); // break; // } // } //} //LoadData(); //this.chart_user1.All_Select(true); //RefreshChart(); //FormForecastLoadDataforMaxHour ffs = new FormForecastLoadDataforMaxHour(); FormForecastLoadData2 ffs = new FormForecastLoadData2(); ffs.ISGDP = true; ffs.PID = MIS.ProgUID; ffs.StartYear = forecastReport.StartYear; ffs.EndYear = forecastReport.EndYear; if (ffs.ShowDialog() != DialogResult.OK) return; Hashtable hs = ffs.HS; if (hs.Count == 0) return; string id = Guid.NewGuid().ToString(); foreach (Ps_History de3 in hs.Values) { Ps_Forecast_Math psp_Type = new Ps_Forecast_Math(); psp_Type.ForecastID = forecastReport.ID; psp_Type.Forecast = type; IList listTypes = Common.Services.BaseService.GetList("SelectPs_Forecast_MathByForecastIDAndForecast", psp_Type); for (int j = 0; j < listTypes.Count; j++) { Ps_Forecast_Math currtenpfm = (Ps_Forecast_Math)listTypes[j]; //更新用电量数据 if (currtenpfm.Sort == 1) { for (int i = forecastReport.StartYear; i <= forecastReport.EndYear; i++) { currtenpfm.GetType().GetProperty("y" + i).SetValue(currtenpfm, de3.GetType().GetProperty("y" + i).GetValue(de3, null), null); } Common.Services.BaseService.Update<Ps_Forecast_Math>(currtenpfm); break; } } } LoadData(); this.chart_user1.All_Select(true); RefreshChart(); }