public void UpdateFuHe(string pid,string col1,Ps_Table_BuildPro oldrs,Ps_Table_BuildPro newrs) { string conn = tong + "ProjectID='" + GetProjectID + "' and Col1='" + col1 + "' and ParentID='" + pid + "'"; IList list = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", conn); if (list.Count > 0) { for(int i=yAnge.BeginYear;i<=yAnge.EndYear;i++) { double oldyf = double.Parse(oldrs.GetType().GetProperty("yf"+i.ToString()).GetValue(oldrs,null).ToString()); double oldyk = double.Parse(oldrs.GetType().GetProperty("yk" + i.ToString()).GetValue(oldrs, null).ToString()); double newyf = double.Parse(newrs.GetType().GetProperty("yf" + i.ToString()).GetValue(newrs, null).ToString()); double newyk = double.Parse(newrs.GetType().GetProperty("yk" + i.ToString()).GetValue(newrs, null).ToString()); double myyf = double.Parse(list[0].GetType().GetProperty("yf" + i.ToString()).GetValue(list[0], null).ToString()); double myyk = double.Parse(list[0].GetType().GetProperty("yk" + i.ToString()).GetValue(list[0], null).ToString()); list[0].GetType().GetProperty("yf" + i.ToString()).SetValue(list[0], Math.Round(myyf - oldyf + newyf,1), null); list[0].GetType().GetProperty("yk" + i.ToString()).SetValue(list[0], Math.Round(myyk - oldyk + newyk,1), null); } Common.Services.BaseService.Update<Ps_Table_BuildPro>((Ps_Table_BuildPro)list[0]); } }
public Ps_Table_BuildPro GetTZGSParent(string type) { try { IList list = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", tong + "Col2='" + type + "' and ProjectID='" + GetProjectID + "' and ParentID='0'"); Ps_Table_BuildPro guid = new Ps_Table_BuildPro(); guid = null; if (list.Count > 0) guid = (Ps_Table_BuildPro)list[0]; return guid; } catch { return null; } }
public void RefreshData() { string n = ""; string conn = "ProjectID='" + GetProjectID + "' and Status!='拆除' and FinishYear>'" + Convert.ToString(yAnge.StartYear) + "' and FinishYear<'" + Convert.ToString(yAnge.StartYear + 6) + "' and (Col4='" + OperTable.ph110 + "' or Col4='" + OperTable.ph220 + "' or Col4='" + OperTable.ph500 + "') and ParentID not in (Select FromID from Ps_Table_BuildPro where ProjectID = '" + GetProjectID + "')"; IList<Ps_Table_Edit> list = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn); for (int i = 0; i < list.Count; i++) { n = ""; if (list[i].Col4 == OperTable.ph110) { Ps_Table_100PH table = Common.Services.BaseService.GetOneByKey<Ps_Table_100PH>(list[i].ParentID); if (table != null) { Ps_Table_BuildPro pare = new Ps_Table_BuildPro(); pare = GetTZGSParent("110"); Ps_Table_BuildPro tzgs = new Ps_Table_BuildPro(); if (pare != null) tzgs.ParentID = pare.ID; else { pare = new Ps_Table_BuildPro(); pare.ID += "|" + GetProjectID; pare.Col2 = "110"; pare.Title = "110千伏送变电工程"; pare.ParentID = "0"; pare.ProjectID = GetProjectID; pare.Sort = 2; Common.Services.BaseService.Create<Ps_Table_BuildPro>(pare); tzgs.ParentID = pare.ID; } tzgs.ID += "|" + GetProjectID; tzgs.FromID = table.ID; tzgs.ProjectID = GetProjectID; tzgs.Sort = OperTable.GetBuildProMaxSort() + 1; tzgs.Title = table.Title+"工程"; tzgs.BuildYear = list[i].StartYear; tzgs.BuildEd = list[i].FinishYear; tzgs.Volumn = double.Parse(list[i].Volume); tzgs.Col3 = list[i].Status; tzgs.AftVolumn = GetBianQ(double.Parse(list[i].Volume), list[i].Status, "110",ref n); tzgs.BianInfo = n; tzgs.Col4 = list[i].Col4; tzgs.AllVolumn = tzgs.AftVolumn; // tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null); pare.AftVolumn += tzgs.AftVolumn; pare.AllVolumn += tzgs.AllVolumn; pare.Length += tzgs.Length; pare.Volumn += tzgs.Volumn; // pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare, double.Parse(pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare, null).ToString()) + tzgs.AllVolumn, null); Common.Services.BaseService.Update<Ps_Table_BuildPro>(pare); Common.Services.BaseService.Create<Ps_Table_BuildPro>(tzgs); } } else if (list[i].Col4 == OperTable.ph220) { Ps_Table_200PH table = Common.Services.BaseService.GetOneByKey<Ps_Table_200PH>(list[i].ParentID); if (table != null) { Ps_Table_BuildPro pare = new Ps_Table_BuildPro(); pare = GetTZGSParent("220"); Ps_Table_BuildPro tzgs = new Ps_Table_BuildPro(); if (pare != null) tzgs.ParentID = pare.ID; else { pare = new Ps_Table_BuildPro(); pare.ID += "|" + GetProjectID; pare.Col2 = "220"; pare.Title = "220千伏送变电工程"; pare.ParentID = "0"; pare.ProjectID = GetProjectID; pare.Sort = 1; Common.Services.BaseService.Create<Ps_Table_BuildPro>(pare); tzgs.ParentID = pare.ID; } tzgs.ID += "|" + GetProjectID; tzgs.FromID = table.ID; tzgs.ProjectID = GetProjectID; tzgs.Sort = OperTable.GetBuildProMaxSort() + 1; tzgs.Title = table.Title + "工程"; tzgs.BuildYear = list[i].StartYear; tzgs.BuildEd = list[i].FinishYear; tzgs.Volumn = double.Parse(list[i].Volume); tzgs.Col3 = list[i].Status; tzgs.Col4 = list[i].Col4; tzgs.AftVolumn = GetBianQ(double.Parse(list[i].Volume), list[i].Status, "220",ref n); tzgs.AllVolumn = tzgs.AftVolumn; tzgs.BianInfo = n; // tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null); pare.AftVolumn += tzgs.AftVolumn; pare.AllVolumn += tzgs.AllVolumn; pare.Length += tzgs.Length; pare.Volumn += tzgs.Volumn; // pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare, double.Parse(pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare, null).ToString()) + tzgs.AllVolumn, null); Common.Services.BaseService.Update<Ps_Table_BuildPro>(pare); Common.Services.BaseService.Create<Ps_Table_BuildPro>(tzgs); } } else if (list[i].Col4 == OperTable.ph500) { Ps_Table_500PH table = Common.Services.BaseService.GetOneByKey<Ps_Table_500PH>(list[i].ParentID); if (table != null) { Ps_Table_BuildPro pare = new Ps_Table_BuildPro(); pare = GetTZGSParent("500"); Ps_Table_BuildPro tzgs = new Ps_Table_BuildPro(); if (pare != null) tzgs.ParentID = pare.ID; else { pare = new Ps_Table_BuildPro(); pare.ID += "|" + GetProjectID; pare.Col2 = "500"; pare.Title = "500千伏送变电工程"; pare.ParentID = "0"; pare.ProjectID = GetProjectID; pare.Sort = 0; Common.Services.BaseService.Create<Ps_Table_BuildPro>(pare); tzgs.ParentID = pare.ID; } tzgs.ID += "|" + GetProjectID; tzgs.FromID = table.ID; tzgs.ProjectID = GetProjectID; tzgs.Sort = OperTable.GetBuildProMaxSort()+1; tzgs.Title = table.Title + "工程"; tzgs.BuildYear = list[i].StartYear; tzgs.BuildEd = list[i].FinishYear; tzgs.Volumn = double.Parse(list[i].Volume); tzgs.Col3 = list[i].Status; tzgs.Col4 = list[i].Col4; tzgs.AftVolumn = GetBianQ(double.Parse(list[i].Volume), list[i].Status, "500",ref n); tzgs.AllVolumn = tzgs.AftVolumn; tzgs.BianInfo = n; // tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null); pare.AftVolumn += tzgs.AftVolumn; pare.AllVolumn += tzgs.AllVolumn; pare.Length += tzgs.Length; pare.Volumn += tzgs.Volumn; // pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare, double.Parse(pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare,null).ToString())+tzgs.AllVolumn, null); Common.Services.BaseService.Update<Ps_Table_BuildPro>(pare); Common.Services.BaseService.Create<Ps_Table_BuildPro>(tzgs); } } } LoadData1(); //string con = "ProjectID='" + GetProjectID + "'"; //IList<Ps_Table_BuildPro> list2 = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", con); //for (int i = 0; i < list1.Count; i++) //{ // for (int j = 0; j < list2.Count; j++) // { // } //} }
private void UPDateOldXl(DataTable dt, string condition, Ps_Table_BuildPro value) { DataRow[] dtrow = dt.Select("Col10='" + condition + "'"); Ps_Table_BuildPro ptb = Itop.Common.DataConverter.RowToObject<Ps_Table_BuildPro>(dtrow[0]); ptb.Length = value.Length; ptb.BuildYear = value.BuildYear; ptb.BuildEd = value.BuildEd; for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++) { ptb.GetType().GetProperty("y" + i).SetValue(ptb, 0, null); } ptb.GetType().GetProperty("y" + value.BuildYear).SetValue(ptb, value.Length, null); try { Common.Services.BaseService.Update<Ps_Table_BuildPro>(ptb); AddChildVol(ptb, true); } catch (Exception ee) { throw; } }
public void DelAll(string suid) { string conn = "ParentId='" + suid + "'"; IList<Ps_Table_BuildPro> list = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn); if (list.Count > 0) { foreach (Ps_Table_BuildPro var in list) { string child = var.ID; DelAll(child); Ps_Table_BuildPro ny = new Ps_Table_BuildPro(); ny.ID = child; Common.Services.BaseService.Delete(ny); } } else return; }
public void AddChildVol(Ps_Table_BuildPro child,bool bAdd) { Ps_Table_BuildPro pare = Common.Services.BaseService.GetOneByKey<Ps_Table_BuildPro>(child.ParentID); IList<Ps_Table_BuildPro> list = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", " ParentID='" + child.ParentID + "'"); for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++) { double tempdb = 0; foreach (Ps_Table_BuildPro ptb in list) { tempdb += double.Parse(ptb.GetType().GetProperty("y" + i.ToString()).GetValue(ptb, null).ToString()); } pare.GetType().GetProperty("y" + i.ToString()).SetValue(pare, tempdb, null); } Common.Services.BaseService.Update<Ps_Table_BuildPro>(pare); // IList<string> list=new List<string>(); // list.Add("Length");list.Add("Volumn");//list.Add("AllVolumn");list.Add("BefVolumn"); //// list.Add("AftVolumn"); //// for (int i = 2008; i <= yAnge.StartYear + 5; i++) //// list.Add("y" + i.ToString()); // double old=0.0,cld=0.0; //// foreach (string str in list) // for(int i=yAnge.BeginYear;i<=yAnge.EndYear;i++) // { // old=double.Parse(pare.GetType().GetProperty("y"+i.ToString()).GetValue(pare,null).ToString()); // cld = double.Parse(child.GetType().GetProperty("y" + i.ToString()).GetValue(child, null).ToString()); // if (bAdd) // pare.GetType().GetProperty("y" + i.ToString()).SetValue(pare, old + cld, null); // else // pare.GetType().GetProperty("y" + i.ToString()).SetValue(pare, old - cld, null); // } // Common.Services.BaseService.Update<Ps_Table_BuildPro>(pare); }
private bool SaveCellValue(string year, string typeID, double value) { Ps_Table_BuildPro psp = new Ps_Table_BuildPro(); Ps_Table_BuildPro old = Common.Services.BaseService.GetOneByKey<Ps_Table_BuildPro>(typeID); psp = (Ps_Table_BuildPro)old.Clone(); psp.GetType().GetProperty(year).SetValue(psp, Math.Round(value,1),null); try { Common.Services.BaseService.Update<Ps_Table_BuildPro>(psp); } catch(Exception ex) { MsgBox.Show("保存数据出错:" + ex.Message); return false; } return true; }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } Ps_YearRange range = yAnge; TreeListNode focusedNode = treeList1.FocusedNode; //if (focusedNode == null) //{ // return; //} FrmAddBuild frm = new FrmAddBuild(); frm.Conn = tong + "ParentID='0' and ProjectID='" + GetProjectID + "' and FromID="; if (frm.ShowDialog() == DialogResult.OK) { Ps_Table_BuildPro table_yd = new Ps_Table_BuildPro(); table_yd.ID += "|" + GetProjectID; table_yd.Title = frm.ParentName; table_yd.ParentID = "0"; table_yd.Sort = OperTable.GetBuildProMaxSort() + 1; table_yd.ProjectID = GetProjectID; table_yd.Col2 = frm.ParentName; table_yd.Col4 = g_col4; table_yd.FromID = frm.GetV; try { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table_yd); } catch (Exception ex) { MsgBox.Show("增加分类出错:" + ex.Message); } this.Cursor = Cursors.WaitCursor; treeList1.BeginUpdate(); //treeList1.ExpandAll(); LoadData1(); FoucsLocation(table_yd.ID, treeList1.Nodes); treeList1.EndUpdate(); this.Cursor = Cursors.Default; } }
public void AddTotalRow(ref IList list) { //合计 string conn = tong + "ParentID='0' and ProjectID='" + GetProjectID + "'"; int[] year = GetYears(); Ps_Table_BuildPro parent = new Ps_Table_BuildPro(); parent.ID += "|" + GetProjectID; parent.ParentID = "0"; parent.Title = "合计"; parent.Sort = 10000;// OperTable.GetMaxSort() + 1; // IList<Ps_Table_BuildPro> teList = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn); double old=0.0,te=0.0; //for (int i = 0; i < teList.Count; i++) //{ // parent.AllVolumn += teList[i].AllVolumn; // parent.BefVolumn += teList[i].BefVolumn; // parent.AftVolumn += teList[i].AftVolumn; // //for (int j = yAnge.StartYear + 1; j <= yAnge.StartYear + 5; j++) // //{ // // old=double.Parse(parent.GetType().GetProperty("y"+j.ToString()).GetValue(parent,null).ToString()); // // te = double.Parse(teList[i].GetType().GetProperty("y"+j.ToString()).GetValue(teList[i],null).ToString()); // // parent.GetType().GetProperty("y" + j.ToString()).SetValue(parent, old + te, null); // //} //} list.Add(parent); }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } //FindNodes(treeList1.FocusedNode); string parentid = treeList1.FocusedNode["ParentID"].ToString(); if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (parentid == "0") { FrmAddBuild frm = new FrmAddBuild(); //frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString(); frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString(); frm.Text = "修改分类名"; frm.SetLabelName = "分类名称"; frm.GetV = treeList1.FocusedNode.GetValue("FromID").ToString(); frm.Conn = tong + "ParentID='0' and ProjectID='" + GetProjectID + "' and FromID="; frm.BEdit = true; if (frm.ShowDialog() == DialogResult.OK) { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1 = Common.Services.BaseService.GetOneByKey<Ps_Table_BuildPro>(treeList1.FocusedNode.GetValue("ID")); table1.Title = frm.ParentName; table1.FromID = frm.GetV; table1.Col2 = "no"; try { Common.Services.BaseService.Update<Ps_Table_BuildPro>(table1); treeList1.FocusedNode.SetValue("Title", frm.ParentName); } catch { } //catch(Exception ex) //{ // MsgBox.Show("修改出错:" + ex.Message); //} } } else { FrmAddTzgsBBPW frm = new FrmAddTzgsBBPW(); frm.buildprortzgsflag = false; Ps_Table_BuildPro table = new Ps_Table_BuildPro(); table = Common.Services.BaseService.GetOneByKey<Ps_Table_BuildPro>(treeList1.FocusedNode.GetValue("ID")); frm.StrType = table.Col4; frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString(); frm.operatorflag = false; try { frm.V = int.Parse(treeList1.FocusedNode.GetValue("FromID").ToString()); } catch { } frm.AreaName = treeList1.FocusedNode.GetValue("AreaName").ToString(); frm.ProjectID = ProjectUID; if (treeList1.FocusedNode.GetValue("Col4") != null) { if (treeList1.FocusedNode.GetValue("Col4").ToString() == "line") frm.Line = true; } frm.Text = "修改工程"; frm.Stat = treeList1.FocusedNode.ParentNode.GetValue("Col2").ToString(); frm.BianInfo = table.BianInfo; frm.LineInfo = table.LineInfo; frm.StartYear = table.BuildYear; frm.FinishYear = table.BuildEd; frm.LineLen = table.Length; frm.BieZhu = table.Col1; frm.Col3 = table.Col3; frm.Vol = table.Volumn; frm.TzgsXs = double.Parse(yAngeXs.Col1); if (frm.ShowDialog() == DialogResult.OK) { AddChildVol(table, false); table.Title = frm.ParentName; table.BuildYear = frm.StartYear; table.BuildEd = frm.FinishYear; table.Length = frm.LineLen; table.Volumn = frm.Vol; double temp = frm.AllVol - table.AllVolumn; table.AllVolumn = frm.AllVol; table.AftVolumn += temp; for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++) { table.GetType().GetProperty("y" + i).SetValue(table, 0, null); } double temp1 = 0.0; if (g_col4 == "bian") temp1 = frm.Vol; else if (g_col4 == "line") temp1 = frm.LineLen; table.GetType().GetProperty("y" + Convert.ToString(frm.StartYear)).SetValue(table, temp1, null); table.Col1 = frm.BieZhu; table.Col3 = frm.Col3; table.BianInfo = frm.BianInfo; table.LineInfo = frm.LineInfo; table.Flag = frm.GetFlag; table.FromID = frm.GetFromID; table.AreaName = frm.AreaName; try { Common.Services.BaseService.Update<Ps_Table_BuildPro>(table); AddChildVol(table, true); LoadData1(); FoucsLocation(table.ID, treeList1.Nodes); } catch { } } } }
private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } if (!base.DeleteRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } string nodestr = treeList1.FocusedNode.GetValue("Col1").ToString(); string parentid = treeList1.FocusedNode["ParentID"].ToString(); if (treeList1.FocusedNode.HasChildren) { MsgBox.Show("此工程下有子工程,请先删除子工程!"); return; } if (treeList1.FocusedNode.GetValue("ParentID").ToString() == "0") { MsgBox.Show("此工程是分类,请用“删除分类”功能!"); return; } if (MsgBox.ShowYesNo("是否删除工程 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes) { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); // Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode); table1.ID = treeList1.FocusedNode.GetValue("ID").ToString(); try { //DeletePSP_ValuesByType里面删除数据和分类 TreeListNode node1 = treeList1.FocusedNode.NextNode; string teID = ""; if (node1 != null) teID = node1.GetValue("ID").ToString(); AddChildVol(Common.Services.BaseService.GetOneByKey<Ps_Table_BuildPro>(table1.ID), false); Common.Services.BaseService.Delete <Ps_Table_BuildPro>(table1);//("DeletePs_Table_BuildPro", table1); treeList1.DeleteNode(treeList1.FocusedNode); LoadData1(); FoucsLocation(teID, treeList1.Nodes); } catch (Exception ex) { //MsgBox.Show("删除出错:" + ex.Message); this.Cursor = Cursors.WaitCursor; treeList1.BeginUpdate(); LoadData(); treeList1.EndUpdate(); this.Cursor = Cursors.Default; } } }
public void AddModelChild(string id,string pid) { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1.ID += "|" + GetProjectID; table1.Title = "其中:小水电"; table1.ParentID = id; table1.ProjectID = GetProjectID; table1.Col1 = "child"; table1.Col2 = "2"; table1.Col3 = "shui"; table1.Col4 = pid; table1.Sort = 0; Ps_Table_BuildPro table3 = new Ps_Table_BuildPro(); table3.ID += "|" + GetProjectID; table3.Title = "其它"; table3.Col1 = "child"; table3.Col2 = "2"; table3.ParentID = id; table3.ProjectID = GetProjectID; table3.Col3 = "other"; table3.Col4 = pid; table3.Sort = 2; Ps_Table_BuildPro table2 = new Ps_Table_BuildPro(); table2.ID += "|" + GetProjectID; table2.Title = "小火电"; table2.Col1 = "child"; table2.Col2 = "2"; table2.ParentID = id; table2.ProjectID = GetProjectID; table2.Col3 = "huo"; table2.Col4 = pid; table2.Sort = 1; Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table1); Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table3); Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table2); }
//更新线路 private void barButtonItem20_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Hashtable area_key_id = new Hashtable(); //初始化哈希表 string areaall = " ProjectID='" + GetProjectID + "'"; IList<PS_Table_AreaWH> tempPTA = Common.Services.BaseService.GetList<PS_Table_AreaWH>("SelectPS_Table_AreaWHByConn", areaall); if (tempPTA.Count != 0) { for (int i = 0; i < tempPTA.Count; i++) { area_key_id.Add(tempPTA[i].ID, tempPTA[i].Title); } } int year = yAnge.StartYear; string con = "Col4='line' and ProjectID='" + GetProjectID + "' and ParentID='0'"; IList list = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", con); DataTable dt = Itop.Common.DataConverter.ToDataTable(list, typeof(Ps_Table_BuildPro)); string con2 = "Col4='line' and ProjectID='" + GetProjectID + "'"; IList list2 = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", con2); DataTable dt2 = Itop.Common.DataConverter.ToDataTable(list2, typeof(Ps_Table_BuildPro)); WaitDialogForm wait = new WaitDialogForm("", "正在更新线路数据,请稍后..."); for (int i = 0; i < dt.Rows.Count; i++) { string parentid = dt.Rows[i]["ID"].ToString(); string dy = dt.Rows[i]["FromID"].ToString(); string connjz = " where ProjectID ='" + GetProjectID + "' and Type='05' and RateVolt=" + dy + " and Cast(Date1 as int)>" + year; IList<PSPDEV> listatt = Common.Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", connjz); int mm = 0; foreach (PSPDEV psi in listatt) { mm++; int perent = (i + 1) * 100 * mm / listatt.Count / dt.Rows.Count; wait.SetCaption(perent + "%"); Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1.ID += "|" + GetProjectID; table1.Title = psi.Name; table1.ParentID = parentid; table1.ProjectID = GetProjectID; table1.BuildYear = psi.Date1; table1.BuildEd = psi.OperationYear; table1.FromID = dy; table1.Length = psi.LineLength+psi.Length2; // table1.BefVolumn = frm.AllVol; table1.GetType().GetProperty("y" + psi.Date1).SetValue(table1, table1.Length, null); table1.Col4 = "line"; table1.Sort = OperTable.GetBuildProMaxSort() + 1; table1.Col10 = psi.SUID; table1.Col3 = "新建"; if (area_key_id[psi.AreaID]!=null) { table1.AreaName = area_key_id[psi.AreaID].ToString(); } try { if (DTHave(dt2, psi.SUID)) { UPDateOldXl(dt2, psi.SUID, table1); } else { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table1); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow())); AddChildVol(table1, true); } } catch (Exception ee) { wait.Close(); } } } LoadData1(); wait.Close(); }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FindNodes(treeList1.FocusedNode); string nodestr = treenode.GetValue("Title").ToString(); if ( focusedNode.GetValue("ParentID").ToString()!="0") { //MsgBox.Show( focusedNode.GetValue("Title").ToString()+"不允许添加子分类!"); //return; focusedNode = focusedNode.ParentNode; } FrmAddTzgsBBPW frm = new FrmAddTzgsBBPW(); frm.Text = "增加" + focusedNode.GetValue("Title") + "的变电工程"; frm.Stat = focusedNode.GetValue("Col2").ToString(); frm.buildprortzgsflag = false; frm.Line = false; frm.StrType = "bian"; frm.operatorflag = true; frm.TzgsXs = double.Parse(yAngeXs.Col1); frm.AreaName = focusedNode.GetValue("AreaName").ToString(); try { frm.V = int.Parse(focusedNode.GetValue("FromID").ToString()); } catch { } frm.ProjectID = ProjectUID; // frm.SetLabelName = "子分类名称"; if(frm.ShowDialog() == DialogResult.OK) { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1.ID += "|" + GetProjectID; table1.Title = frm.ParentName; table1.ParentID = focusedNode.GetValue("ID").ToString(); table1.ProjectID = GetProjectID; table1.BuildYear = frm.StartYear; table1.BuildEd = frm.FinishYear; table1.FromID = frm.GetFromID; table1.Length = frm.LineLen; table1.Volumn = frm.Vol; table1.AllVolumn = frm.AllVol; // table1.BefVolumn = frm.AllVol; table1.AftVolumn = frm.AllVol; table1.LineInfo = frm.LineInfo; table1.BianInfo = frm.BianInfo; table1.GetType().GetProperty("y" + Convert.ToString(frm.StartYear)).SetValue(table1, frm.Vol, null); table1.Col4 = "bian"; table1.Sort = OperTable.GetBuildProMaxSort()+1; table1.Col3 = frm.Col3; table1.Col1 = frm.BieZhu; table1.AreaName = frm.AreaName; try { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table1); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow())); AddChildVol(table1, true); LoadData1(); FoucsLocation(table1.ID, treeList1.Nodes); } catch (Exception ex) { MsgBox.Show("增加变电站出错:" + ex.Message); } } }
private void simpleButton3_Click(object sender, EventArgs e) { FrmProjTZEdit frm = new FrmProjTZEdit(); frm.Currentptb = Currentptb; spinEdit3.Text = Currentptb.AllVolumn.ToString(); if (frm.ShowDialog() == DialogResult.OK) { Currentptb = frm.Currentptb; ChangeStatetime = true; if (!Changetzflag) { switch (combState.Text) { case "可行性研究": sptz.Value = Changetz((Currentptb.Col6 == null || Currentptb.Col6 == "") ? "" : Currentptb.Col6); break; case "初步设计": sptz.Value = Changetz((Currentptb.Col7 == null || Currentptb.Col7 == "") ? "" : Currentptb.Col7); break; case "施工设计": sptz.Value = Changetz((Currentptb.Col8 == null || Currentptb.Col8 == "") ? "" : Currentptb.Col8); break; case "移交": sptz.Value = Changetz((Currentptb.Col9 == null || Currentptb.Col9 == "") ? "" : Currentptb.Col9); break; default: break; } } } }
private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } if (!base.DeleteRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (treeList1.FocusedNode.GetValue("ParentID").ToString() != "0") { MsgBox.Show("此分类不是总分类!"); return; } if (MsgBox.ShowYesNo("总分类及其下属分类都将删除,是否删除总分类 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes) { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); // Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode); table1.ID = treeList1.FocusedNode.GetValue("ID").ToString(); DelAll(table1.ID); try { //DeletePSP_ValuesByType里面删除数据和分类 Common.Services.BaseService.Delete<Ps_Table_BuildPro>(table1);//("DeletePs_Table_BuildPro", table1); treeList1.DeleteNode(treeList1.FocusedNode); //treeList1.ExpandAll(); //删除后,如果同级还有其它分类,则重新计算此类的所有年份数据 } catch (Exception ex) { //MsgBox.Show("删除出错:" + ex.Message); this.Cursor = Cursors.WaitCursor; treeList1.BeginUpdate(); LoadData(); treeList1.EndUpdate(); this.Cursor = Cursors.Default; } } }
private void simpleButton3_Click_1(object sender, EventArgs e) { FrmProjTimeEdit frm = new FrmProjTimeEdit(); frm.Currentptb = Currentptb; if (frm.ShowDialog() == DialogResult.OK) { Currentptb = frm.Currentptb; ChangeStatetime = true; switch (combState.Text) { case "规划审查": dateStateTime.Value = ChangeTime((Currentptb.Stime1 == null || Currentptb.Stime1 == "") ? "" : Currentptb.Stime1); Currentptb.Stime1 = dateStateTime.Value.ToShortDateString(); break; case "可行性研究": dateStateTime.Value = ChangeTime((Currentptb.Stime2 == null || Currentptb.Stime2 == "") ? "" : Currentptb.Stime2); Currentptb.Stime2 = dateStateTime.Value.ToShortDateString(); break; case "获取支持文件": dateStateTime.Value = ChangeTime((Currentptb.Stime3 == null || Currentptb.Stime3 == "") ? "" : Currentptb.Stime3); Currentptb.Stime3 = dateStateTime.Value.ToShortDateString(); break; case "初步设计": dateStateTime.Value = ChangeTime((Currentptb.Stime4 == null || Currentptb.Stime4 == "") ? "" : Currentptb.Stime4); Currentptb.Stime4 = dateStateTime.Value.ToShortDateString(); break; case "施工设计": dateStateTime.Value = ChangeTime((Currentptb.Stime5 == null || Currentptb.Stime5 == "") ? "" : Currentptb.Stime5); Currentptb.Stime5 = dateStateTime.Value.ToShortDateString(); break; case "施工": dateStateTime.Value = ChangeTime((Currentptb.Stime6 == null || Currentptb.Stime6 == "") ? "" : Currentptb.Stime6); Currentptb.Stime6 = dateStateTime.Value.ToShortDateString(); break; case "投产运行": dateStateTime.Value = ChangeTime((Currentptb.Stime7 == null || Currentptb.Stime7 == "") ? "" : Currentptb.Stime7); Currentptb.Stime7 = dateStateTime.Value.ToShortDateString(); break; case "移交": dateStateTime.Value = ChangeTime((Currentptb.Stime8 == null || Currentptb.Stime8 == "") ? "" : Currentptb.Stime8); Currentptb.Stime8 = dateStateTime.Value.ToShortDateString(); break; default: break; } ChangeStatetime = false; } }
//更新变电站 private void barButtonItem19_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int year = yAnge.StartYear; string con = "Col4='bian' and ProjectID='" + GetProjectID + "' and ParentID='0'"; IList list = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", con); DataTable dt = Itop.Common.DataConverter.ToDataTable(list, typeof(Ps_Table_BuildPro)); string con2 = "Col4='bian' and ProjectID='" + GetProjectID + "'"; IList list2 = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", con2); DataTable dt2 = Itop.Common.DataConverter.ToDataTable(list2, typeof(Ps_Table_BuildPro)); WaitDialogForm wait = new WaitDialogForm("", "正在更新变电站数据,请稍后..."); for (int i = 0; i < dt.Rows.Count; i++) { string parentid = dt.Rows[i]["ID"].ToString(); string dy = dt.Rows[i]["FromID"].ToString(); string conn1 = " AreaID='" + GetProjectID + "' and L1=" + dy; IList<PSP_Substation_Info> listbdz = Common.Services.BaseService.GetList<PSP_Substation_Info>("SelectPSP_Substation_InfoListByWhere", conn1); int mm = 0; foreach (PSP_Substation_Info psi in listbdz) { mm++; int perent=(i+1) * 100*mm/listbdz.Count / dt.Rows.Count; wait.SetCaption( perent+ "%"); string dyid = psi.UID; string connjz = " where SvgUID ='" + dyid + "' and Type='03'"; IList<PSPDEV> listatt = Common.Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", connjz); DataTable dataTable = Itop.Common.DataConverter.ToDataTable((IList)listatt, typeof(PSPDEV)); if (listatt.Count>0) { DataRow[] xyrow=dataTable.Select(" Date1<="+year); DataRow[] dyrow=dataTable.Select(" Date1>"+year ,"Date1"); if (dyrow.Length>0) { if (xyrow.Length>0) { int start=int.Parse(dyrow[0]["Date1"].ToString()); int end=int.Parse(dyrow[dyrow.Length-1]["Date1"].ToString()); //扩建 for (int j = start; j <= end; j++) { DataRow[] curow=dataTable.Select(" Date1="+j ); if (curow.Length==0) { continue; } Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1.ID += "|" + GetProjectID; table1.Title = psi.Title; table1.ParentID = parentid; table1.ProjectID = GetProjectID; table1.BuildYear =j.ToString(); table1.BuildEd = curow[0]["OperationYear"].ToString(); table1.FromID = dy; table1.Volumn = double .Parse( curow[0]["SiN"].ToString()); table1.Col4 = "bian"; table1.Sort = OperTable.GetBuildProMaxSort() + 1; table1.Col10 = curow[0]["SUID"].ToString(); table1.Col3="扩建"; table1.AreaName = psi.AreaName; for (int k = 1; k < curow.Length; k++) { table1.Volumn += double .Parse( curow[k]["SiN"].ToString()); } table1.GetType().GetProperty("y" + j).SetValue(table1, table1.Volumn, null); try { if (DTHave(dt2,curow[0]["SUID"].ToString())) { UPDateOldBDZ(dt2,curow[0]["SUID"].ToString(),table1); } else { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table1); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow())); AddChildVol(table1, true); } } catch (Exception ee) { wait.Close(); } } } else { //新建+扩建 int start=int.Parse(dyrow[0]["Date1"].ToString()); int end=int.Parse(dyrow[dyrow.Length-1]["Date1"].ToString()); for (int j = start; j <= end; j++) { DataRow[] curow=dataTable.Select(" Date1="+j ); if (curow.Length==0) { continue; } if (j==start)//只有第一年需要新建,其后的都是扩建 { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1.ID += "|" + GetProjectID; table1.Title = psi.Title; table1.ParentID = parentid; table1.ProjectID = GetProjectID; table1.BuildYear = j.ToString(); table1.BuildEd = curow[0]["OperationYear"].ToString(); table1.FromID = dy; table1.Volumn = double .Parse( curow[0]["SiN"].ToString()); table1.Col4 = "bian"; table1.Sort = OperTable.GetBuildProMaxSort() + 1; table1.Col10 = curow[0]["SUID"].ToString(); table1.Col3="新建"; table1.AreaName = psi.AreaName; for (int k = 1; k < curow.Length; k++) { table1.Volumn += double.Parse(curow[k]["SiN"].ToString()); } table1.GetType().GetProperty("y" + j).SetValue(table1, table1.Volumn, null); try { if (DTHave(dt2,curow[0]["SUID"].ToString())) { UPDateOldBDZ(dt2,curow[0]["SUID"].ToString(),table1); } else { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table1); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow())); AddChildVol(table1, true); } } catch (Exception ee) { wait.Close(); } } else { Ps_Table_BuildPro table2 = new Ps_Table_BuildPro(); table2.ID += "|" + GetProjectID; table2.Title = psi.Title; table2.ParentID = parentid; table2.ProjectID = GetProjectID; table2.BuildYear = j.ToString(); table2.BuildEd = curow[0]["OperationYear"].ToString(); table2.FromID = dy; table2.Volumn = double .Parse( curow[0]["SiN"].ToString()); table2.Col4 = "bian"; table2.Sort = OperTable.GetBuildProMaxSort() + 1; table2.Col10 = curow[0]["SUID"].ToString(); table2.Col3="扩建"; table2.AreaName = psi.AreaName; for (int k = 1; k < curow.Length; k++) { table2.Volumn += double .Parse( curow[k]["SiN"].ToString()); } table2.GetType().GetProperty("y" + j).SetValue(table2, table2.Volumn, null); try { if (DTHave(dt2,curow[0]["SUID"].ToString())) { UPDateOldBDZ(dt2,curow[0]["SUID"].ToString(),table2); } else { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table2); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table2, dataTable.NewRow())); AddChildVol(table2, true); } } catch (Exception ee) { wait.Close(); } } } } } } else { int curyear = 0; int.TryParse(psi.L28, out curyear); if (curyear> year) { Ps_Table_BuildPro table1 = new Ps_Table_BuildPro(); table1.ID += "|" + GetProjectID; table1.Title = psi.Title; table1.ParentID = parentid; table1.ProjectID = GetProjectID; table1.BuildYear = psi.L28; table1.BuildEd = psi.S2; table1.FromID = dy; table1.Volumn = psi.L2; // table1.BefVolumn = frm.AllVol; table1.GetType().GetProperty("y" + psi.L28).SetValue(table1, psi.L2, null); table1.Col4 = "bian"; table1.Sort = OperTable.GetBuildProMaxSort() + 1; table1.Col10 = psi.UID; table1.Col3="新建"; table1.AreaName = psi.AreaName; try { if (DTHave(dt2,psi.UID)) { UPDateOldBDZ(dt2,psi.UID,table1); } else { Common.Services.BaseService.Create("InsertPs_Table_BuildPro", table1); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow())); AddChildVol(table1, true); } } catch (Exception ee) { wait.Close(); } } } } } LoadData1(); wait.Close(); }