Beispiel #1
0
        //添加父分类
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            TreeListNode focusedNode = treeList1.FocusedNode;
            if (focusedNode == null)
            {
                return;
            }
            //if (focusedNode == null)
            //{
            //    return;
            //}
            if (focusedNode.GetValue("Title").ToString() != "地方电源建设规划")
            {
                MessageBox.Show("只能在“地方电源建设规划”分类下添加城区!");
                return;
            }

            FrmAddPN frm = new FrmAddPN();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_PowerBuild table_yd = new Ps_PowerBuild();
                table_yd.ID = table_yd.ID + "|" + GetProjectID;
                table_yd.Title = frm.ParentName;
                table_yd.ParentID = focusedNode.GetValue("ID").ToString();
                table_yd.Sort = OperTable.GetPowerBuildMaxSort() + 1;
                table_yd.ProjectID = GetProjectID;
                table_yd.Col1 = "che";
                table_yd.Col2 = "no";
                try
                {
                    Common.Services.BaseService.Create("InsertPs_PowerBuild", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                }

                Ps_PowerBuild table1 = new Ps_PowerBuild();
                table1.ID += "|" + GetProjectID;
                table1.Title = "年末装机容量";
                table1.Type = "水电";
                table1.ParentID = table_yd.ID;
                table1.ProjectID = GetProjectID;
                table1.Col1 = "sc";
                table1.Col2 = "no";
                table1.Sort = 1;
                Ps_PowerBuild table2 = new Ps_PowerBuild();
                table2.ID += "|" + GetProjectID;
                table2.Title = "年末装机容量";
                table2.Type = "火电";
                table2.ParentID = table_yd.ID;
                table2.ProjectID = GetProjectID;
                table2.Col1 = "hc";
                table2.Col2 = "no";
                table2.Sort = 2;
                Ps_PowerBuild table3 = new Ps_PowerBuild();
                table3.ID += "|" + GetProjectID;
                table3.Title = "已建项目小计";
                table3.ParentID = table_yd.ID;
                table3.ProjectID = GetProjectID;
                table3.Col1 = "yhe";
                table3.Col2 = "no";
                table3.Sort = 3;
                Ps_PowerBuild table4 = new Ps_PowerBuild();
                table4.ID += "|" + GetProjectID;
                table4.Title = "在建及新建项目小计";
                table4.ParentID = table_yd.ID;
                table4.ProjectID = GetProjectID;
                table4.Col1 = "xhe";
                table4.Col2 = "no";
                table4.Sort = 4;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_PowerBuild", table1);
                    Common.Services.BaseService.Create("InsertPs_PowerBuild", table2);
                    Common.Services.BaseService.Create("InsertPs_PowerBuild", table3);
                    Common.Services.BaseService.Create("InsertPs_PowerBuild", table4);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                LoadData1(table_yd.ID);
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #2
0
        //删除
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (!base.DeleteRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            if (treeList1.FocusedNode.GetValue("Col1").ToString() == "child" )
            {
                if (MsgBox.ShowYesNo("是否删除 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
                {
                    try
                    {
                        Ps_PowerBuild ny = new Ps_PowerBuild();
                        ny.ID = treeList1.FocusedNode.GetValue("ID").ToString();
                        string pare = treeList1.FocusedNode.ParentNode.GetValue("Title").ToString();
                        Common.Services.BaseService.Delete(ny);
                      //  DelAll(ny.ID);
                        if (pare != "大型电源建设规划")
                            LoadData1(treeList1.FocusedNode.ParentNode.GetValue("ParentID").ToString());// 1(ny.ParentID);
                        else
                            LoadData2(ny.ParentID);
                    }
                    catch { }
                }
            }
            else if (treeList1.FocusedNode.GetValue("Col1").ToString() == "che")
            {
                if (MsgBox.ShowYesNo("是否删除 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
                {
                    try
                    {
                        Ps_PowerBuild ny = new Ps_PowerBuild();
                        ny.ID = treeList1.FocusedNode.GetValue("ID").ToString();
                        string pare = treeList1.FocusedNode.GetValue("Title").ToString();
                        Common.Services.BaseService.Delete(ny);
                        DelAll(ny.ID);
                       LoadData1(treeList1.FocusedNode.GetValue("ID").ToString());// 1(ny.ParentID);
                       // treeList1.FocusedNode.
                    }
                    catch { }
                }
            }
            else
                MessageBox.Show("不能删除此行!");
        }
Beispiel #3
0
        public void AddRows(ref IList list)
        {
            //IList list = new List<Ps_PowerBuild>();
            string conn = "ParentID='0' and Title='地方电源建设规划' and ProjectID='" + GetProjectID + "'";

            int[] year = GetYears();
            IList pareList = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
            if (pareList.Count == 0)
                return;
            try
            {
                conn = "ProjectID='" + GetProjectID + "' and Col1='sc'";
                IList list1 = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
                conn = "ProjectID='" + GetProjectID + "' and Col1='hc'";
                IList list2 = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
                conn = "ProjectID='" + GetProjectID + "' and Col1='xhe'";
                IList list3 = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
                Ps_PowerBuild ps_tablehe = new Ps_PowerBuild();
                ps_tablehe.ID += "|" + GetProjectID;
                ps_tablehe.Title = "市合计";
                ps_tablehe.ParentID = ((Ps_PowerBuild)pareList[0]).ID;
                ps_tablehe.Sort = 1;
                ps_tablehe.Col1 = "dhe";
                Ps_PowerBuild table1 = new Ps_PowerBuild();
                table1.ID += "|" + GetProjectID;
                table1.Title = "年末装机容量";
                table1.Type = "水电";
                table1.ParentID = ps_tablehe.ID;
                table1.ProjectID = GetProjectID;
                table1.Col1 = "sc";
                table1.Col2 = "no";
                table1.Sort = 1;
                Ps_PowerBuild table2 = new Ps_PowerBuild();
                table2.ID += "|" + GetProjectID;
                table2.Title = "年末装机容量";
                table2.Type = "火电";
                table2.ParentID = ps_tablehe.ID;
                table2.ProjectID = GetProjectID;
                table2.Col1 = "hc";
                table2.Col2 = "no";
                table2.Sort = 2;
                Ps_PowerBuild table3 = new Ps_PowerBuild();
                table3.ID += "|" + GetProjectID;
                table3.Title = "在建及新建项目小计";
                table3.ParentID = ps_tablehe.ID;
                table3.ProjectID = GetProjectID;
                table3.Col1 = "xhe";
                table3.Col2 = "no";
                table3.Sort = 3;
                for (int i = yAnge.StartYear; i <= yAnge.FinishYear; i++)
                {
                    for (int j = 0; j < list1.Count; j++)
                    {
                        table1.GetType().GetProperty("y" + i.ToString()).SetValue(table1, double.Parse(table1.GetType().GetProperty("y" + i.ToString()).GetValue(table1, null).ToString()) + double.Parse(list1[j].GetType().GetProperty("y" + i.ToString()).GetValue(list1[j], null).ToString()), null);
                    }
                    for (int j = 0; j < list1.Count; j++)
                    {
                        table2.GetType().GetProperty("y" + i.ToString()).SetValue(table2, double.Parse(table2.GetType().GetProperty("y" + i.ToString()).GetValue(table2, null).ToString()) + double.Parse(list2[j].GetType().GetProperty("y" + i.ToString()).GetValue(list2[j], null).ToString()), null);
                    }
                    for (int j = 0; j < list1.Count; j++)
                    {
                        table3.GetType().GetProperty("y" + i.ToString()).SetValue(table3, double.Parse(table3.GetType().GetProperty("y" + i.ToString()).GetValue(table3, null).ToString()) + double.Parse(list3[j].GetType().GetProperty("y" + i.ToString()).GetValue(list3[j], null).ToString()), null);
                    }
                    ps_tablehe.GetType().GetProperty("y" + i.ToString()).SetValue(ps_tablehe, double.Parse(table1.GetType().GetProperty("y" + i.ToString()).GetValue(table1, null).ToString()) + double.Parse(table2.GetType().GetProperty("y" + i.ToString()).GetValue(table2, null).ToString()) + double.Parse(table3.GetType().GetProperty("y" + i.ToString()).GetValue(table3, null).ToString()), null);
                }
                list.Add(ps_tablehe);
                list.Add(table1);
                list.Add(table2);
                list.Add(table3);
                //  CalcTotal(ref list);
            }
            catch (Exception e) { MessageBox.Show(e.Message); }
            //return list;
        }
Beispiel #4
0
 private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     string conn = "ParentID='0' and ProjectID='"+GetProjectID+"' and (Title='大型电源建设规划' or Title='地方电源建设规划')";
     IList list = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
     if (list.Count > 0)
     {
         MessageBox.Show("已经有固定列!");
         return;
     }
     Ps_PowerBuild table1 = new Ps_PowerBuild();
     table1.ID += "|" + GetProjectID;
     table1.Title = "大型电源建设规划";
     table1.ParentID = "0";
     table1.ProjectID = GetProjectID;
     table1.Sort = 1;
     Ps_PowerBuild table2 = new Ps_PowerBuild();
     table2.ID += "|" + GetProjectID;
     table2.Title = "地方电源建设规划";
     table2.ParentID = "0";
     table2.ProjectID = GetProjectID;
     table2.Sort = 2;
     Common.Services.BaseService.Create<Ps_PowerBuild>(table1);
     Common.Services.BaseService.Create<Ps_PowerBuild>(table2);
     LoadData();
 }
Beispiel #5
0
        //增加项目
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            if (focusedNode.GetValue("Col1").ToString() != "xhe" && focusedNode.GetValue("Col1").ToString() != "yhe" && focusedNode.GetValue("Title").ToString() != "大型电源建设规划")
            {
                MessageBox.Show("不能在此分类下添加变电站");
                return;
            }

            Ps_YearRange range = oper.GetYearRange("Col5='" + GetProjectID + "' and Col4='" + OperTable.power + "'");
            Ps_PowerBuild table = new Ps_PowerBuild();
            table.ID += "|" + GetProjectID;
            FrmPowerNew frm = new FrmPowerNew();
            frm.GetProject = GetProjectID;
            frm.ParentID = table.ID;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                table.Title = frm.GetTitle;
                //if (focusedNode.GetValue("ParentID").ToString() == "0")
                //{
                //    table.ParentID = focusedNode.GetValue("ID").ToString();
                //}
                //else
                    table.ParentID = focusedNode.GetValue("ID").ToString();
                table.Type = frm.PowerType;
                table.BuildFac = frm.GetVolumn;
                table.BuildYear = frm.GetYear1;
                table.BuildEd = frm.GetYear2;
                table.Col1 = "child";
                table.Col2 = focusedNode.GetValue("Col1").ToString();
                if(focusedNode.ParentNode!=null)
                    table.Col3 = focusedNode.GetValue("ParentID").ToString();
                table.ProjectID = GetProjectID;
                table.Sort = OperTable.GetPowerBuildMaxSort() + 1;
                if (table.Sort < 4)
                    table.Sort = 4;
                int sYear = int.Parse(frm.GetYear2);
                for (int i = sYear; i <= range.EndYear; i++)
                {
                    table.GetType().GetProperty("y" + i.ToString()).SetValue(table, double.Parse(frm.GetVolumn), null);
                }
                try
                {
                    Common.Services.BaseService.Create("InsertPs_PowerBuild", table);
                    //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table, dataTable.NewRow()));
                    if (focusedNode.ParentNode != null)
                        LoadData1(focusedNode.GetValue("ParentID").ToString());
                    else
                        LoadData2(table.ParentID);

                    FoucsLocation(table.ID, treeList1.Nodes);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
        }
Beispiel #6
0
        public void EditPsTable()
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            if (!base.EditRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            Ps_YearRange range = oper.GetYearRange("Col5='" + GetProjectID + "' and Col4='" + OperTable.power + "'");
            if (focusedNode.GetValue("Col1") != null && focusedNode.GetValue("Col1").ToString() == "0")
            {
                FrmChangeBian frm = new FrmChangeBian();
                frm.GetProject = GetProjectID;
                frm.Mark = OperTable.power;
                frm.Text = "修改" + focusedNode.GetValue("Title");
                Hashtable ht = new Hashtable();
                for (int i = range.StartYear; i <= range.FinishYear; i++)
                {
                    ht.Add("y" + i.ToString(), focusedNode.GetValue("y" + i.ToString()).ToString());
                }
                frm.TextAttr = ht;
                frm.Title = focusedNode.GetValue("Title").ToString();
                if (focusedNode.GetValue("Col1").ToString() == "0")
                {
                    frm.SetEnable();
                    frm.BFuHe = true;
                }
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Ps_PowerBuild table = new Ps_PowerBuild();
                    table.ID = focusedNode.GetValue("ID").ToString();
                    table.Title = frm.Title;
                    table.ParentID = focusedNode.GetValue("ParentID").ToString();
                    for (int i = range.StartYear; i <= range.FinishYear; i++)
                    {
                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(frm.TextAttr["y" + i.ToString()]), null);
                    }
                    double end = Convert.ToDouble(frm.TextAttr["y" + range.FinishYear.ToString()]);
                    for (int j = range.FinishYear + 1; j <= range.EndYear; j++)
                    {
                        table.GetType().GetProperty("y" + j.ToString()).SetValue(table, end, null);
                    }
                    table.Col1 = focusedNode.GetValue("Col1").ToString();
                    table.ProjectID = GetProjectID;
                    table.Sort = int.Parse(focusedNode.GetValue("Sort").ToString());
                    try
                    {
                        Common.Services.BaseService.Update("UpdatePs_PowerBuild", table);
                        LoadData1(table.ParentID);
                        FoucsLocation(table.ID, treeList1.Nodes);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("修改项目出错:" + ex.Message);
                    }
                }
            }
            else if (focusedNode.GetValue("Col1") != null && focusedNode.GetValue("Col1").ToString() == "child")
            {
                string conn = "ParentID='" + focusedNode.GetValue("ID").ToString() + "'";
                IList<Ps_Table_Edit> eList = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);

                FrmPsEdit frm = new FrmPsEdit();
                frm.GetProject = GetProjectID;
                frm.Mark = OperTable.power;
                frm.GridData = eList;
                frm.Title = focusedNode.GetValue("Title").ToString();
                frm.ParentID = focusedNode.GetValue("ID").ToString();
                string curVolumn = focusedNode.GetValue("y" + range.EndYear).ToString();
                frm.CurVolumn = curVolumn;
                frm.TypeTable = "power";
                frm.MaxYear = GetChildMaxYear(conn);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Ps_PowerBuild table = new Ps_PowerBuild();
                    eList = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn1", conn);
                    table = Common.Services.BaseService.GetOneByKey<Ps_PowerBuild>(focusedNode.GetValue("ID"));
                    //table.ID = focusedNode.GetValue("ID").ToString();
                    table.Title = frm.Title;
                    if (eList.Count > 0)
                    {
                        table.BuildFac = eList[0].Volume;
                        table.BuildYear = eList[0].StartYear;
                        table.BuildEd = eList[0].FinishYear;
                    }
                    try
                    {
                        Common.Services.BaseService.Update("UpdatePs_PowerBuild", table);
                        if (focusedNode.ParentNode.GetValue("Title").ToString() == "大型电源建设规划")
                            LoadData2(table.ParentID);
                        else
                            LoadData1(focusedNode.ParentNode.GetValue("ParentID").ToString());
                        FoucsLocation(table.ID, treeList1.Nodes);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("修改项目出错:" + ex.Message);
                    }
                }
            }
            else if (focusedNode.GetValue("Col1").ToString() == "che")
            {
                FrmAddPN frm = new FrmAddPN();
                frm.ParentName = focusedNode.GetValue("Title").ToString();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Ps_PowerBuild table1 = new Ps_PowerBuild();
                    table1.ID = focusedNode.GetValue("ID").ToString();
                    Ps_PowerBuild te = Common.Services.BaseService.GetOneByKey<Ps_PowerBuild>(table1.ID);
                    table1 = te;
                    table1.ParentID = focusedNode.GetValue("ParentID").ToString();
                    table1.Sort = int.Parse(focusedNode.GetValue("Sort").ToString());
                    table1.Title = frm.ParentName;
                    table1.ProjectID = GetProjectID;
                    try
                    {
                        Common.Services.BaseService.Update("UpdatePs_PowerBuild", table1);
                        LoadData2(table1.ID);
                        FoucsLocation(table1.ID, treeList1.Nodes);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("修改分类出错:" + ex.Message);
                    }
                }
            }
            else
                MsgBox.Show("不能修改此行");
        }
Beispiel #7
0
 //删除所有
 public void DelAll(string suid)
 {
     string conn = "ParentId='" + suid + "'";
     IList<Ps_PowerBuild> list = Common.Services.BaseService.GetList<Ps_PowerBuild>("SelectPs_PowerBuildByConn", conn);
     if (list.Count > 0)
     {
         foreach (Ps_PowerBuild var in list)
         {
             string child = var.ID;
             DelAll(child);
             Ps_PowerBuild ny = new Ps_PowerBuild();
             ny.ID = child;
             Common.Services.BaseService.Delete(ny);
         }
     }
 }
Beispiel #8
0
 public void CaleF(ref IList list)
 {
     int he = 0;
     Ps_PowerBuild pb = new Ps_PowerBuild();
     for (int i = 0; i < list.Count; i++)
     {
         if (((Ps_PowerBuild)list[i]).Title == "大型电源建设规划")
         {
             he = i;
         }
         else if (((Ps_PowerBuild)list[i]).Col1 == "child")
         {
             for (int j = yAnge.StartYear; j <= yAnge.EndYear; j++)
             {
                 pb.GetType().GetProperty("y" + j.ToString()).SetValue(pb, double.Parse(pb.GetType().GetProperty("y" + j.ToString()).GetValue(pb, null).ToString()) + double.Parse(((Ps_PowerBuild)list[i]).GetType().GetProperty("y" + j.ToString()).GetValue(((Ps_PowerBuild)list[i]), null).ToString()), null);
             }
         }
     }
     for (int j = yAnge.BeginYear; j <= yAnge.EndYear; j++)
     {
         list[he].GetType().GetProperty("y" + j.ToString()).SetValue(list[he], double.Parse(pb.GetType().GetProperty("y" + j.ToString()).GetValue(pb, null).ToString()), null);
     }
     Common.Services.BaseService.Update<Ps_PowerBuild>((Ps_PowerBuild)list[he]);
 }
Beispiel #9
0
        public void CalcXian(ref IList list)
        {
            int sx = 0, hx = 0, xx = 0, yx = 0, he = 0;
            Ps_PowerBuild sbuild = new Ps_PowerBuild();
            Ps_PowerBuild hbuild = new Ps_PowerBuild();
            Ps_PowerBuild ybuild = new Ps_PowerBuild();
            Ps_PowerBuild xbuild = new Ps_PowerBuild();
            //Ps_PowerBuild he = new Ps_PowerBuild();
            for (int i = 0; i < list.Count; i++)
            {
                if (((Ps_PowerBuild)list[i]).Col1 == "sc")
                {
                    sx = i;
                }
                else if (((Ps_PowerBuild)list[i]).Col1 == "hc")// && ((Ps_PowerBuild)list[i]).Type == "火电")
                {
                    hx = i;
                }
                else if (((Ps_PowerBuild)list[i]).Col1 == "yhe")
                {
                    yx = i;
                }
                else if (((Ps_PowerBuild)list[i]).Col1 == "xhe")
                {
                    xx = i;
                }
                else if (((Ps_PowerBuild)list[i]).Col1 == "che")
                {
                    he = i;
                }
                else if(((Ps_PowerBuild)list[i]).Col1=="child")
                {
                    for (int j = yAnge.BeginYear; j <= yAnge.EndYear; j++)
                    {
                        if (((Ps_PowerBuild)list[i]).Type == "水电")
                        {
                            sbuild.GetType().GetProperty("y" + j.ToString()).SetValue(sbuild, double.Parse(sbuild.GetType().GetProperty("y" + j.ToString()).GetValue(sbuild, null).ToString()) + double.Parse(((Ps_PowerBuild)list[i]).GetType().GetProperty("y" + j.ToString()).GetValue(((Ps_PowerBuild)list[i]), null).ToString()), null);
                        }
                        else if (((Ps_PowerBuild)list[i]).Type == "火电")
                        {
                            hbuild.GetType().GetProperty("y" + j.ToString()).SetValue(hbuild, double.Parse(hbuild.GetType().GetProperty("y" + j.ToString()).GetValue(hbuild, null).ToString()) + double.Parse(((Ps_PowerBuild)list[i]).GetType().GetProperty("y" + j.ToString()).GetValue(((Ps_PowerBuild)list[i]), null).ToString()), null);
                        }
                        if(((Ps_PowerBuild)list[i]).Col2 == "yhe")
                        {
                            ybuild.GetType().GetProperty("y" + j.ToString()).SetValue(ybuild, double.Parse(ybuild.GetType().GetProperty("y" + j.ToString()).GetValue(ybuild, null).ToString()) + double.Parse(((Ps_PowerBuild)list[i]).GetType().GetProperty("y" + j.ToString()).GetValue(((Ps_PowerBuild)list[i]), null).ToString()), null);
                        }
                        else if (((Ps_PowerBuild)list[i]).Col2 == "xhe")
                        {
                            xbuild.GetType().GetProperty("y" + j.ToString()).SetValue(xbuild, double.Parse(xbuild.GetType().GetProperty("y" + j.ToString()).GetValue(xbuild, null).ToString()) + double.Parse(((Ps_PowerBuild)list[i]).GetType().GetProperty("y" + j.ToString()).GetValue(((Ps_PowerBuild)list[i]), null).ToString()), null);
                        }
                    }
                }
            }
            //sbuild.ID = ((Ps_PowerBuild)list[sx]).ID;
            //sbuild.ParentID = ((Ps_PowerBuild)list[sx]).ParentID;
            //sbuild.ProjectID = ((Ps_PowerBuild)list[sx]).ProjectID;
            //sbuild.Sort = ((Ps_PowerBuild)list[sx]).Sort;
            //sbuild.Title = ((Ps_PowerBuild)list[sx]).Title;
            //sbuild.Type = ((Ps_PowerBuild)list[sx]).Type;
            //sbuild.Col1 = ((Ps_PowerBuild)list[sx]).Col1;
            //sbuild.Col2 = ((Ps_PowerBuild)list[sx]).Col2;
            //sbuild.BuildEd = ((Ps_PowerBuild)list[sx]).BuildEd;
            //sbuild.BuildFac = ((Ps_PowerBuild)list[sx]).BuildFac;
            //sbuild.BuildYear = ((Ps_PowerBuild)list[sx]).BuildYear;
            //hbuild.ID = ((Ps_PowerBuild)list[hx]).ID;
            //hbuild.ParentID = ((Ps_PowerBuild)list[hx]).ParentID;
            //hbuild.ProjectID = ((Ps_PowerBuild)list[hx]).ProjectID;
            //hbuild.Sort = ((Ps_PowerBuild)list[hx]).Sort;
            //hbuild.Title = ((Ps_PowerBuild)list[hx]).Title;
            //hbuild.Type = ((Ps_PowerBuild)list[hx]).Type;
            //hbuild.Col1 = ((Ps_PowerBuild)list[hx]).Col1;
            //hbuild.Col2 = ((Ps_PowerBuild)list[hx]).Col2;
            //hbuild.BuildEd = ((Ps_PowerBuild)list[hx]).BuildEd;
            //hbuild.BuildFac = ((Ps_PowerBuild)list[hx]).BuildFac;
            //hbuild.BuildYear = ((Ps_PowerBuild)list[hx]).BuildYear;

            //ybuild.ID = ((Ps_PowerBuild)list[yx]).ID;
            //ybuild.ParentID = ((Ps_PowerBuild)list[yx]).ParentID;
            //ybuild.ProjectID = ((Ps_PowerBuild)list[yx]).ProjectID;
            //ybuild.Sort = ((Ps_PowerBuild)list[yx]).Sort;
            //ybuild.Title = ((Ps_PowerBuild)list[yx]).Title;
            //ybuild.Type = ((Ps_PowerBuild)list[yx]).Type;
            //ybuild.Col1 = ((Ps_PowerBuild)list[yx]).Col1;
            //ybuild.Col2 = ((Ps_PowerBuild)list[yx]).Col2;
            //ybuild.BuildEd = ((Ps_PowerBuild)list[yx]).BuildEd;
            //ybuild.BuildFac = ((Ps_PowerBuild)list[yx]).BuildFac;
            //ybuild.BuildYear = ((Ps_PowerBuild)list[yx]).BuildYear;

            //xbuild.ID = ((Ps_PowerBuild)list[xx]).ID;
            //xbuild.ParentID = ((Ps_PowerBuild)list[xx]).ParentID;
            //xbuild.ProjectID = ((Ps_PowerBuild)list[xx]).ProjectID;
            //xbuild.Sort = ((Ps_PowerBuild)list[xx]).Sort;
            //xbuild.Title = ((Ps_PowerBuild)list[xx]).Title;
            //xbuild.Type = ((Ps_PowerBuild)list[xx]).Type;
            //xbuild.Col1 = ((Ps_PowerBuild)list[xx]).Col1;
            //xbuild.Col2 = ((Ps_PowerBuild)list[xx]).Col2;
            //xbuild.BuildEd = ((Ps_PowerBuild)list[xx]).BuildEd;
            //xbuild.BuildFac = ((Ps_PowerBuild)list[xx]).BuildFac;
            //xbuild.BuildYear = ((Ps_PowerBuild)list[xx]).BuildYear;
            //Common.Services.BaseService.Update<Ps_PowerBuild>(sbuild);
            //Common.Services.BaseService.Update<Ps_PowerBuild>(hbuild);
            //Common.Services.BaseService.Update<Ps_PowerBuild>(ybuild);
            //Common.Services.BaseService.Update<Ps_PowerBuild>(xbuild);

            for (int j = yAnge.BeginYear; j <= yAnge.EndYear; j++)
            {
                list[sx].GetType().GetProperty("y" + j.ToString()).SetValue(list[sx], double.Parse(sbuild.GetType().GetProperty("y" + j.ToString()).GetValue(sbuild, null).ToString()), null);
                list[hx].GetType().GetProperty("y" + j.ToString()).SetValue(list[hx], double.Parse(hbuild.GetType().GetProperty("y" + j.ToString()).GetValue(hbuild, null).ToString()), null);
                list[yx].GetType().GetProperty("y" + j.ToString()).SetValue(list[yx], double.Parse(ybuild.GetType().GetProperty("y" + j.ToString()).GetValue(ybuild, null).ToString()), null);
                list[xx].GetType().GetProperty("y" + j.ToString()).SetValue(list[xx], double.Parse(xbuild.GetType().GetProperty("y" + j.ToString()).GetValue(xbuild, null).ToString()), null);
                list[he].GetType().GetProperty("y" + j.ToString()).SetValue(list[he], double.Parse(list[sx].GetType().GetProperty("y" + j.ToString()).GetValue(list[sx], null).ToString()) + double.Parse(list[hx].GetType().GetProperty("y" + j.ToString()).GetValue(list[hx], null).ToString()), null);
            }
            Common.Services.BaseService.Update<Ps_PowerBuild>((Ps_PowerBuild)list[sx]);
            Common.Services.BaseService.Update<Ps_PowerBuild>((Ps_PowerBuild)list[hx]);
            Common.Services.BaseService.Update<Ps_PowerBuild>((Ps_PowerBuild)list[yx]);
            Common.Services.BaseService.Update<Ps_PowerBuild>((Ps_PowerBuild)list[xx]);
            Common.Services.BaseService.Update<Ps_PowerBuild>((Ps_PowerBuild)list[he]);
        }
Beispiel #10
0
        private void CalcTotal(ref IList list)
        {
            //合计
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";

            int[] year = GetYears();
            Ps_PowerBuild parent = new Ps_PowerBuild();
            parent.ID = parent.ID + "|" + GetProjectID;
            parent.ParentID = "0"; parent.Title = "全网110千伏合计"; parent.Sort = 1000;// OperTable.GetMaxSort() + 1;
            list.Add(parent);
            totoalParent = parent.ID;
            Ps_PowerBuild tablex = new Ps_PowerBuild();
            conn = "Col1='0' and ProjectID='" + GetProjectID + "'";
            IList childx = Common.Services.BaseService.GetList("SelectPs_PowerBuildSumByConn", conn);
            tablex = (Ps_PowerBuild)childx[0];
            tablex.ParentID = parent.ID;
            tablex.ID = Guid.NewGuid().ToString();
            tablex.ID += "|" + GetProjectID;
            tablex.Sort = 1;
            tablex.Col1 = "no";
            tablex.Title = "110千伏主变供电负荷";
            list.Add(tablex);

            Ps_PowerBuild table1 = new Ps_PowerBuild();
            // Ps_PowerBuild con1 = new Ps_PowerBuild();
            // con1.Col4 = rongZai220;
            conn = "Col1='0' and ProjectID='" + GetProjectID + "'";// con1.Title = "Col1='0'";
            //IList child1 = Common.Services.BaseService.GetList("SelectPs_PowerBuildSumByConn", conn);
            table1 = (Ps_PowerBuild)tablex.Clone();// (Ps_PowerBuild)child1[0];
            for (int j = year[1]; j <= year[2]; j++)
            {
                double d = (double)table1.GetType().GetProperty("y" + j).GetValue(table1, null);
                table1.GetType().GetProperty("y" + j).SetValue(table1, Math.Round(double.Parse(rongZai220) * d, 1), null);

            }
            table1.ParentID = parent.ID;
            table1.ID = Guid.NewGuid().ToString();
            table1.ID += "|" + GetProjectID;
            table1.Sort = 2;
            table1.Col1 = "no";
            table1.Title = "110千伏需主变容量(" + rongZai220 + ")";
            list.Add(table1);

            Ps_PowerBuild table = new Ps_PowerBuild();
            //conn = "Col1='1'";
            //IList child = Common.Services.BaseService.GetList("SelectPs_PowerBuildSumByConn", conn);
            //table = (Ps_PowerBuild)child[0];
            for (int j = 0; j < list.Count; j++)
            {
                if (((Ps_PowerBuild)list[j]).Col1 == "1")
                {
                    for (int k = year[1]; k <= year[2]; k++)
                    {
                        table.GetType().GetProperty("y" + k).SetValue(table, double.Parse(table.GetType().GetProperty("y" + k).GetValue(table, null).ToString()) + double.Parse(((Ps_PowerBuild)list[j]).GetType().GetProperty("y" + k).GetValue(((Ps_PowerBuild)list[j]), null).ToString()), null);
                    }
                }
            }
            table.ParentID = parent.ID;
            table.ID = Guid.NewGuid().ToString();
            table.ID += "|" + GetProjectID;
            table.Sort = 3;
            table.Col1 = "no";
            table.Title = "110千伏主变总容量";
            list.Add(table);

            //IList allChild = Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn);
            for (int k = 0; k < list.Count; k++)
            {
                if (((Ps_PowerBuild)list[k]).Col1 == "1")
                {
                    Ps_PowerBuild ps1 = new Ps_PowerBuild();

                    ps1 = (Ps_PowerBuild)((Ps_PowerBuild)list[k]).Clone();
                    ps1.ID = Guid.NewGuid().ToString();
                    ps1.ID += "|" + GetProjectID;
                    ps1.ParentID = parent.ID;
                    ps1.Col1 = "no";
                    ps1.BuildEd = "total";
                    list.Add(ps1);
                }
            }

            //conn = "Col1='0'";
            //Ps_PowerBuild temp1 = (Ps_PowerBuild)Common.Services.BaseService.GetList("SelectPs_PowerBuildByConn", conn)[0];
            Ps_PowerBuild table2 = new Ps_PowerBuild();
            for (int j = year[1]; j <= year[2]; j++)
            {
                double d = (double)tablex.GetType().GetProperty("y" + j).GetValue(tablex, null);
                if (d != 0.0)
                {
                    double chu = (double)table.GetType().GetProperty("y" + j).GetValue(table, null);
                    table2.GetType().GetProperty("y" + j).SetValue(table2, Math.Round(chu / d, 1), null);
                }
            }
            table2.ParentID = parent.ID;
            table2.ID = Guid.NewGuid().ToString();
            table2.ID += "|" + GetProjectID;
            table2.Sort = 1000;
            table2.Col1 = "no";
            table2.Title = "110千伏容载比";
            list.Add(table2);
        }