コード例 #1
0
ファイル: FrmPsEdit.cs プロジェクト: EdgarEDT/myitoppsp
        //增加
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (comboBoxEdit3.Text == "")
            {
                MessageBox.Show("竣工年份不能为空"); return;
            }
            if (comboBoxEdit1.Text != "已有" && comboBoxEdit2.Text!="")
            {
                if (int.Parse(comboBoxEdit3.Text) < int.Parse(comboBoxEdit2.Text))
                {
                    MessageBox.Show("竣工年必须大于开工年!"); return;
                }

            }
               // DialogResult = DialogResult.OK;
            Ps_Table_Edit edit = new Ps_Table_Edit();
            edit.ID += "|" + GetProject;
            edit.ParentID = parentid;
            edit.StartYear = comboBoxEdit1.Text == "已有" ? "" : comboBoxEdit2.Text;
            edit.FinishYear = comboBoxEdit1.Text == "已有" ? "" : comboBoxEdit3.Text;
            edit.Status = comboBoxEdit1.Text;
            edit.Volume = this.spinEdit1.Text;
            edit.ProjectID = GetProject;
            edit.Col4 = mark;
            try
            {
                edit.Sort = OperTable.GetChildMaxSort()+1;
            }
            catch { edit.Sort = 4; }
            if (edit.Sort < 4)
                edit.Sort = 4;
            Common.Services.BaseService.Create("InsertPs_Table_Edit", edit);
            strResult.Add(textEdit1.Text);
            strResult.Add(comboBoxEdit3.Text);
            strResult.Add(spinEdit1.Value.ToString());
            string conn = "ParentID='" + parentid + "'";
            list = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
            if (typeTable == "500")
            {
                Ps_Table_500PH table = new Ps_Table_500PH();
                table = Common.Services.BaseService.GetOneByKey<Ps_Table_500PH>(parentid);
                if (comboBoxEdit1.Text == "扩建/改造")
                {

                    for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                    {
                        string a = table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString();

                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) + Convert.ToDouble(spinEdit1.Text), null);
                    }
                    Common.Services.BaseService.Update("UpdatePs_Table_500PH", table);
                }
            }
            else if (typeTable == "200")
            {
                Ps_Table_200PH table = new Ps_Table_200PH();
                table = Common.Services.BaseService.GetOneByKey<Ps_Table_200PH>(parentid);
                if (comboBoxEdit1.Text == "扩建/改造")
                {

                    for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                    {
                        string a = table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString();
                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) + Convert.ToDouble(spinEdit1.Text), null);
                    }
                    Common.Services.BaseService.Update("UpdatePs_Table_200PH", table);
                }
            }
            else if (typeTable == "100")
            {
                Ps_Table_100PH table = new Ps_Table_100PH();
                table = Common.Services.BaseService.GetOneByKey<Ps_Table_100PH>(parentid);
                if (comboBoxEdit1.Text == "扩建/改造")
                {

                    for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                    {
                        string a = table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString();
                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) + Convert.ToDouble(spinEdit1.Text), null);
                    }
                    Common.Services.BaseService.Update("UpdatePs_Table_100PH", table);
                }
            }

            LoadGridData();
            label7.Text = GetCurVolumn();
        }
コード例 #2
0
ファイル: FrmPsEdit.cs プロジェクト: EdgarEDT/myitoppsp
        //删除
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (gridView1.FocusedRowHandle < 0)
            {
                MessageBox.Show("请选择一条记录!"); return;
            }
            string id = this.gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ID").ToString();

            Ps_Table_Edit edit = Common.Services.BaseService.GetOneByKey<Ps_Table_Edit>(id);

            if (edit.Status == "扩建/改造" || edit.Status == "拆除")
            {
                if (MessageBox.Show("确定删除这条记录吗?", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Common.Services.BaseService.Delete<Ps_Table_Edit>(edit);
                    string conn = "ParentID='" + parentid + "'";
                    list = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
                    LoadGridData();
                    label7.Text = GetCurVolumn();
                    if (typeTable == "500")
                    {
                        Ps_Table_500PH table = new Ps_Table_500PH();
                        table = Common.Services.BaseService.GetOneByKey<Ps_Table_500PH>(parentid);
                        if (comboBoxEdit1.Text == "扩建/改造")
                        {

                            string a = table.GetType().GetProperty("y" + comboBoxEdit3.Text).GetValue(table, null).ToString();
                            for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                            {
                                table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) - Convert.ToDouble(spinEdit1.Text), null);
                            }
                            Common.Services.BaseService.Update("UpdatePs_Table_500PH", table);
                        }
                    }
                    else if (typeTable == "200")
                    {
                        Ps_Table_200PH table = new Ps_Table_200PH();
                        table = Common.Services.BaseService.GetOneByKey<Ps_Table_200PH>(parentid);
                        if (comboBoxEdit1.Text == "扩建/改造")
                        {

                            string a = table.GetType().GetProperty("y" + comboBoxEdit3.Text).GetValue(table, null).ToString();
                            for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                            {
                                table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) - Convert.ToDouble(spinEdit1.Text), null);
                            }
                            Common.Services.BaseService.Update("UpdatePs_Table_200PH", table);
                        }
                    }
                    else if (typeTable == "100")
                    {
                        Ps_Table_100PH table = new Ps_Table_100PH();
                        table = Common.Services.BaseService.GetOneByKey<Ps_Table_100PH>(parentid);
                        if (comboBoxEdit1.Text == "扩建/改造")
                        {

                            string a = table.GetType().GetProperty("y" + comboBoxEdit3.Text).GetValue(table, null).ToString();
                            for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                            {
                                table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) - Convert.ToDouble(spinEdit1.Text), null);
                            }
                            Common.Services.BaseService.Update("UpdatePs_Table_100PH", table);
                        }
                    }

                }
            }
            else
                MessageBox.Show("只能删除扩建/改造或拆除的记录。");
        }
コード例 #3
0
ファイル: FrmPHReport.cs プロジェクト: EdgarEDT/myitoppsp
 public string RongZai(Ps_Table_500PH cur)
 {
     if (cur == null || cur.BuildYear == null || cur.BuildYear == "")
         return rongZai220;
     return cur.BuildYear;
 }
コード例 #4
0
ファイル: FrmPHReport.cs プロジェクト: EdgarEDT/myitoppsp
        public void AddRows(ref IList list, string con)
        {
            //IList list = new List<Ps_Table_500PH>();
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";

            int[] year = GetYears();
            IList pareList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", con);
            try
            {
                for (int i = 0; i < pareList.Count; i++)
                {
                    Ps_Table_500PH ps_table1 = new Ps_Table_500PH();
                    //Ps_Table_500PH con = new Ps_Table_500PH();
                    //con.Col4 = rongZai220;
                    //con.Title = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='0'";
                    //IList childList1 = Common.Services.BaseService.GetList("SelectPs_Table_500PHJiByConn", con);
                    //CaleHeTable(ref childList1);
                    //ps_table1 = (Ps_Table_500PH)childList1[0];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "0")
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                ps_table1.GetType().GetProperty("y" + k).SetValue(ps_table1, Math.Round(double.Parse(((Ps_Table_500PH)list[j]).GetType().GetProperty("y" + k).GetValue(((Ps_Table_500PH)list[j]), null).ToString()) * double.Parse(RongZai((Ps_Table_500PH)pareList[i])), 1), null);
                            }
                        }
                    }
                    ps_table1.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table1.ID = Guid.NewGuid().ToString();
                    ps_table1.ID += "|" + GetProjectID;
                    ps_table1.Sort = 2;
                    ps_table1.Col1 = "no";
                    ps_table1.Title = "500千伏需要容量(" + RongZai((Ps_Table_500PH)pareList[i]) + ")";
                    list.Add(ps_table1);

                    Ps_Table_500PH ps_table = new Ps_Table_500PH();

                    //conn = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='1'";
                    //IList childList = Common.Services.BaseService.GetList("SelectPs_Table_500PHSumByConn", conn);
                    //CaleHeTable(ref childList);
                    //ps_table = (Ps_Table_500PH)childList[0];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "1")
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                ps_table.GetType().GetProperty("y" + k).SetValue(ps_table, double.Parse(ps_table.GetType().GetProperty("y" + k).GetValue(ps_table, null).ToString()) + double.Parse(((Ps_Table_500PH)list[j]).GetType().GetProperty("y" + k).GetValue(((Ps_Table_500PH)list[j]), null).ToString()), null);
                            }
                        }
                    }
                    ps_table.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table.ID = Guid.NewGuid().ToString();
                    ps_table.ID += "|" + GetProjectID;
                    ps_table.Sort = 3;
                    ps_table.Col1 = "no";
                    ps_table.Title = "500千伏公用变电站总容量";
                    list.Add(ps_table);

                    // conn = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='0'";
                    Ps_Table_500PH temp = new Ps_Table_500PH();// (Ps_Table_500PH)Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn)[0];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "0")
                        {
                            temp = (Ps_Table_500PH)list[j];
                        }
                    }
                    Ps_Table_500PH ps_table2 = new Ps_Table_500PH();
                    for (int j = year[1]; j <= year[2]; j++)
                    {
                        double d = (double)temp.GetType().GetProperty("y" + j).GetValue(temp, null);
                        if (d != 0.0)
                        {
                            double chu = (double)ps_table.GetType().GetProperty("y" + j).GetValue(ps_table, null);
                            ps_table2.GetType().GetProperty("y" + j).SetValue(ps_table2, Math.Round(chu / d, 1), null);
                        }
                    }
                    ps_table2.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table2.ID = Guid.NewGuid().ToString();
                    ps_table2.ID += "|" + GetProjectID;
                    ps_table2.Sort = 1000;
                    ps_table2.Col1 = "no";
                    ps_table2.Title = "500千伏容载比";
                    list.Add(ps_table2);
                }

                //  CalcTotal(ref list);
            }
            catch (Exception e) { MessageBox.Show(e.Message); }
            //return list;
        }
コード例 #5
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ClearNoBuild();
            Ps_YearRange range = oper.GetYearRange("Col5='" + GetProjectID + "' and Col4='" + OperTable.ph500 + "'");
            string conn = "ProjectID='" + GetProjectID + "' and ParentID='0'";
            IList pList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
            for (int i = 0; i < pList.Count; i++)
            {

                //从变电站情况表里读

                conn = "AreaID='" + GetProjectID + "' and L1='500'";
                IList pspList = Common.Services.BaseService.GetList("SelectSubstation_InfoByCon", conn);
                for (int j = 0; j < pspList.Count; j++)
                {
                    conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ((Ps_Table_500PH)pList[i]).ID + "' and Title='" + ((Substation_Info)pspList[j]).Title + "'";
                    IList oldList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                    Ps_Table_500PH ps = new Ps_Table_500PH();
                    if (oldList.Count > 0)
                    {
                        ps = oldList[0] as Ps_Table_500PH;
                    }
                    else
                    {
                        ps.ID += "|" + ProjectUID;
                        ps.ParentID = ((Ps_Table_500PH)pList[i]).ID;
                        ps.ProjectID = ProjectUID;
                        ps.Sort = OperTable.Get500MaxSort() + 1;
                        ps.Title = ((Substation_Info)pspList[j]).Title;
                        ps.Col1 = "1";
                        if (ps.Sort < 4)
                            ps.Sort = 4;
                        ps.Col3 = ((Substation_Info)pspList[j]).UID;
                    }
                    for (int k = range.StartYear; k <= range.EndYear; k++)
                    {
                        ps.GetType().GetProperty("y" + k.ToString()).SetValue(ps, ((Substation_Info)pspList[j]).L2, null);
                    }
                    try
                    {
                        if (oldList.Count == 0)
                        {
                            Common.Services.BaseService.Create("InsertPs_Table_500PH", ps);
                            CreateEdit(ps.ID, "", Convert.ToString(range.StartYear - 1), "新建", ((Substation_Info)pspList[j]).L2.ToString(), OperTable.ph500, ((Substation_Info)pspList[j]).UID);
                        }
                        else
                        {
                            Common.Services.BaseService.Update("UpdatePs_Table_500PH", ps);
                            ChangeEdit(ps.ID, "", Convert.ToString(range.StartYear - 1), "新建", ((Substation_Info)pspList[j]).L2.ToString(), OperTable.ph500, ((Substation_Info)pspList[j]).UID);
                        }
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("更新变电站出错:" + ps.Title + ex.Message);
                    }
                }
                //从建设项目表中读
                conn = "ProjectID='" + GetProjectID + "' and FromID='500'";
                IList buildList = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", conn);
                for (int j = 0; j < buildList.Count; j++)
                {
                    if (((Ps_Table_BuildPro)buildList[j]).Col3 == "新建")
                    {
                        conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ((Ps_Table_500PH)pList[i]).ID + "' and Title='" + ((Ps_Table_BuildPro)buildList[j]).Title + "'";
                        IList oldList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                        Ps_Table_500PH ps = new Ps_Table_500PH();
                        if (oldList.Count > 0)
                        {
                            ps = oldList[0] as Ps_Table_500PH;
                        }
                        else
                        {
                            ps.ID += "|" + ProjectUID;
                            ps.ParentID = ((Ps_Table_500PH)pList[i]).ID;
                            ps.ProjectID = ProjectUID;
                            ps.Sort = OperTable.Get500MaxSort() + 1;
                            ps.Title = ((Ps_Table_BuildPro)buildList[j]).Col2;
                            ps.Col1 = "1";
                            if (ps.Sort < 4)
                                ps.Sort = 4;
                            ps.Col3 = ((Ps_Table_BuildPro)buildList[j]).ID;
                        }
                        int bYear = range.StartYear;
                        int.TryParse(((Ps_Table_BuildPro)buildList[j]).BuildEd, out bYear);
                        for (int k = bYear; k <= range.EndYear; k++)
                        {
                            ps.GetType().GetProperty("y" + k.ToString()).SetValue(ps, ((Ps_Table_BuildPro)buildList[j]).Volumn, null);
                        }
                        try
                        {
                            if (oldList.Count == 0)
                            {
                                Common.Services.BaseService.Create("InsertPs_Table_500PH", ps);
                                CreateEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), "新建", ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                            else
                            {
                                Common.Services.BaseService.Update("UpdatePs_Table_500PH", ps);
                                ChangeEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), "新建", ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                        }
                        catch (Exception ex)
                        {
                            MsgBox.Show("更新变电站出错:" + ps.Title + ex.Message);
                        }
                    }
                    else if (((Ps_Table_BuildPro)buildList[j]).Col3 == "扩建" || ((Ps_Table_BuildPro)buildList[j]).Col3 == "改造")
                    {
                        conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ((Ps_Table_500PH)pList[i]).ID + "' and Title='" + ((Ps_Table_BuildPro)buildList[j]).Title + "'";
                        IList oldList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                        Ps_Table_500PH ps = new Ps_Table_500PH();
                        if (oldList.Count > 0)
                        {
                            ps = oldList[0] as Ps_Table_500PH;
                            int bYear = range.StartYear;
                            int.TryParse(((Ps_Table_BuildPro)buildList[j]).BuildEd, out bYear);
                            conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ps.ID + "' and Col5='" + ((Ps_Table_BuildPro)buildList[j]).ID + "'";
                            IList list = Common.Services.BaseService.GetList("SelectPs_Table_EditListByConn", conn);
                            if (list.Count > 0)
                            {
                                ChangeEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), ((Ps_Table_BuildPro)buildList[j]).Col3, ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                            else
                            {
                                CreateEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), ((Ps_Table_BuildPro)buildList[j]).Col3, ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                        }
                        else
                            continue;

                    }
                }
            }
            Loaddata2();
        }
コード例 #6
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        private void barButtonItem15_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ClearChen();
            UpdateChen();
            IList pareList = Common.Services.BaseService.GetList("SelectPS_Table_AreaWHByConn", "ProjectID='" + GetProjectID +
                "' and ID not in (Select Col4 From Ps_Table_500PH where ProjectID='" +
                GetProjectID + "' and ParentID='0') order by sort");
            for (int i = 0; i < pareList.Count; i++)
            {
                Ps_Table_500PH table_yd = new Ps_Table_500PH();
                table_yd.ID = table_yd.ID + "|" + GetProjectID;
                table_yd.Title = ((PS_Table_AreaWH)pareList[i]).Title;
                table_yd.ParentID = "0";
                table_yd.Sort = OperTable.Get500MaxSort() + 1;
                table_yd.ProjectID = GetProjectID;
                table_yd.Col4 = ((PS_Table_AreaWH)pareList[i]).ID;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_500PH", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                }

                Ps_Table_500PH table1 = new Ps_Table_500PH();
                table1.ID += "|" + GetProjectID;
                table1.Title = "500千伏公用变电站供电负荷";
                table1.ParentID = table_yd.ID;
                table1.ProjectID = GetProjectID;
                table1.Col1 = "0";
                table1.Sort = 1;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_500PH", table1);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
                UpdateFuHe(table_yd.Title, table_yd.ID,"yf");
                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                LoadData1(table_yd.ID);
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();
                this.Cursor = Cursors.Default;
            }
        }
コード例 #7
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
 //删除所有
 public void DelAll(string suid)
 {
     string conn = "ParentId='" + suid + "'";
     IList<Ps_Table_500PH> list = Common.Services.BaseService.GetList<Ps_Table_500PH>("SelectPs_Table_500PHListByConn", conn);
     if (list.Count > 0)
     {
         foreach (Ps_Table_500PH var in list)
         {
             string child = var.ID;
             //if (var.Sort != "1")
             //    DelAll(child);
             Ps_Table_500PH ny = new Ps_Table_500PH();
             ny.ID = child;
             Common.Services.BaseService.Delete(ny);
         }
     }
 }
コード例 #8
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        public void EditPsTable()
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

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

            Ps_YearRange range = yAnge;
            if (focusedNode.GetValue("Col1") != null && focusedNode.GetValue("Col1").ToString() == "0")
            {
                FrmChangeBian frm = new FrmChangeBian();
                frm.GetProject = GetProjectID;
                frm.Mark = OperTable.ph500;
                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_Table_500PH table = new Ps_Table_500PH();
                    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_Table_500PH", 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() == "1")
            {
                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.ph500;
                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.MaxYear = GetChildMaxYear(conn);
                frm.TypeTable = "500";
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Ps_Table_500PH table = new Ps_Table_500PH();
                    table = Common.Services.BaseService.GetOneByKey<Ps_Table_500PH>(focusedNode.GetValue("ID"));
                    //table.ID = focusedNode.GetValue("ID").ToString();
                    //table.Title = frm.Title;
                    //table.ParentID = focusedNode.GetValue("ParentID").ToString();
                    //table.Col1 = focusedNode.GetValue("Col1").ToString();
                    //table.Sort = int.Parse(focusedNode.GetValue("Sort").ToString());
                    //table.Title = frm.StrResult[0];
                    //if (frm.GetStatus == "已有")
                    //{
                    //    for (int i = range.BeginYear; i <= range.EndYear; i++)
                    //    {
                    //        if (table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString() == curVolumn)
                    //            table.GetType().GetProperty("y" + i.ToString()).SetValue(table, double.Parse(frm.StrResult[2]), null);
                    //    }
                    //}
                    //else if (frm.GetStatus == "扩建/改造")
                    //{
                    //    for (int i = 0; i < frm.list.Count; i++)
                    //    {
                    //        Ps_Table_Edit pn = frm.list[i];
                    //        if (pn.Status=="")
                    //        {
                    //        }
                    //    }
                    //    //for (int i = int.Parse(frm.StrResult[1]); i <= range.EndYear; i++)
                    //    //{
                    //    //    table.GetType().GetProperty("y" + i.ToString()).SetValue(table, double.Parse(frm.StrResult[2]), null);
                    //    //}
                    //}
                    //else if (frm.GetStatus == "拆除")
                    //{
                    //    for (int i = int.Parse(frm.StrResult[1]); i <= range.EndYear; i++)
                    //    {
                    //        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, 0.0, null);
                    //    }
                    //    table.ParentID = "-1";
                    //}
                    try
                    {
                        //Common.Services.BaseService.Update("UpdatePs_Table_500PH", table);
                        LoadData1(table.ParentID);
                        FoucsLocation(table.ID, treeList1.Nodes);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("修改项目出错:" + ex.Message);
                    }
                }
            }
            else if (focusedNode.GetValue("ParentID").ToString() == "0")
            {
                FrmAddPN frm = new FrmAddPN();
                frm.ParentName = focusedNode.GetValue("Title").ToString();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Ps_Table_500PH table1 = new Ps_Table_500PH();
                    //table1 = focusedNode.TreeList.GetDataRecordByNode(focusedNode) as Ps_Table_500PH;
                    table1.ID = focusedNode.GetValue("ID").ToString();
                    table1.ParentID = focusedNode.GetValue("ParentID").ToString();
                    table1.Sort = int.Parse(focusedNode.GetValue("Sort").ToString());
                    table1.Title = frm.ParentName;
                    table1.ProjectID = GetProjectID;
                    table1.BuildYear = focusedNode.GetValue("BuildYear").ToString();
                    table1.Col1 = focusedNode.GetValue("Col1").ToString();
                    try
                    {
                        Common.Services.BaseService.Update("UpdatePs_Table_500PH", table1);
                        LoadData1(table1.ID);

                        FoucsLocation(table1.ID, treeList1.Nodes);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("修改分类出错:" + ex.Message);
                    }
                }
            }
            else
                MsgBox.Show("不能修改此行");
        }
コード例 #9
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        //添加父分类
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            TreeListNode focusedNode = treeList1.FocusedNode;

            //if (focusedNode == null)
            //{
            //    return;
            //}

            FrmAddPN frm = new FrmAddPN();
            frm.SetCheckVisible();
            frm.SetCheckText("不计特殊");
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_500PH table_yd = new Ps_Table_500PH();
                table_yd.ID += "|" + GetProjectID;
                table_yd.Title = frm.ParentName;
                table_yd.ParentID = "0";
                table_yd.Sort = OperTable.Get500MaxSort() + 1;
                table_yd.ProjectID = GetProjectID;

                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_500PH", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                }
                string[] lei = new string[6] { "地区最大负荷", "接入地区220千伏及以下电网装机容量", "220kV联络线与区外交换电力", "电源满发供电出力", "高峰电力盈亏", "停一台最大单机后供电出力" };

                for (int i = 0; i < lei.Length; i++)
                {
                    Ps_Table_500PH table1 = new Ps_Table_500PH();
                    table1.ID += "|" + GetProjectID;
                    table1.Title = lei[i];
                    table1.ParentID = table_yd.ID;
                    table1.ProjectID = GetProjectID;
                    table1.Col1 = "0";
                    if (frm.BCheck)
                        table1.Col2 = "no";
                    else
                        table1.Col2 = "no1";
                    table1.Sort = i+1;
                    try
                    {
                        Common.Services.BaseService.Create("InsertPs_Table_500PH", table1);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("增加项目出错:" + ex.Message);
                    }
                }
                UpdateFuHe(table_yd.Title, table_yd.ID,"yf");
                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                LoadData1(table_yd.ID);
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();
                this.Cursor = Cursors.Default;
            }
        }
コード例 #10
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        private void CalcTotal(ref IList list)
        {
            //合计
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";

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

            Ps_Table_500PH table1 = new Ps_Table_500PH();
            // Ps_Table_500PH con1 = new Ps_Table_500PH();
            // con1.Col4 = rongZai220;
            conn = "Col1='0' and ProjectID='" + GetProjectID + "'";// con1.Title = "Col1='0'";
            //IList child1 = Common.Services.BaseService.GetList("SelectPs_Table_500PHSumByConn", conn);
            table1 = (Ps_Table_500PH)tablex.Clone();// (Ps_Table_500PH)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 = "500千伏需主变容量(" + rongZai220 + ")";
            list.Add(table1);

            Ps_Table_500PH table = new Ps_Table_500PH();
            //conn = "Col1='1'";
            //IList child = Common.Services.BaseService.GetList("SelectPs_Table_500PHSumByConn", conn);
            //table = (Ps_Table_500PH)child[0];
            for (int j = 0; j < list.Count; j++)
            {
                if (((Ps_Table_500PH)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_Table_500PH)list[j]).GetType().GetProperty("y" + k).GetValue(((Ps_Table_500PH)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 = "500千伏主变总容量";
            list.Add(table);

            //IList allChild = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
            for (int k = 0; k < list.Count; k++)
            {
                if (((Ps_Table_500PH)list[k]).Col1 == "1")
                {
                    Ps_Table_500PH ps1 = new Ps_Table_500PH();
                    ps1 = (Ps_Table_500PH)((Ps_Table_500PH)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_Table_500PH temp1 = (Ps_Table_500PH)Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn)[0];
            Ps_Table_500PH table2 = new Ps_Table_500PH();
            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 = "500千伏容载比";
            list.Add(table2);
        }
コード例 #11
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        //删除
        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("ParentID").ToString() == "0")
            {
                string conn = "ParentID='" + treeList1.FocusedNode.GetValue("ID").ToString() + "' and Col1='1'";
                IList list = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                if (list.Count > 0)
                {
                    MsgBox.Show("这条记录下面有子记录,请先删除子记录!");
                    return;
                }
            }
            if (treeList1.FocusedNode.GetValue("Col1").ToString() == "no")
            {
                MsgBox.Show("不能删除此行!");
                return;
            }

            if (MsgBox.ShowYesNo("是否删除 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {
                try
                {
                    Ps_Table_500PH ny = new Ps_Table_500PH();
                    ny.ID = treeList1.FocusedNode.GetValue("ID").ToString();
                    string teID="";
                    try
                    {
                        teID = treeList1.FocusedNode.NextNode.GetValue("ID").ToString();
                    }
                    catch { }
                    string pare = treeList1.FocusedNode.GetValue("ParentID").ToString();
                    Common.Services.BaseService.Delete(ny);
                    DelAll(ny.ID);
                    if (pare != "0")
                        LoadData1(pare);// 1(ny.ParentID);
                    else
                        LoadData1(ny.ID);

                    FoucsLocation(teID, treeList1.Nodes);
                }
                catch { }
            }
        }
コード例 #12
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        //增加项目
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

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

            Ps_YearRange range = yAnge;
            Ps_Table_500PH table = new Ps_Table_500PH();
            table.ID += "|" + GetProjectID;
            FrmPsNew frm = new FrmPsNew();
            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("ParentID").ToString();
                table.Col1 = "1";
                table.ProjectID = GetProjectID;
                table.Sort = OperTable.Get500MaxSort() + 1;
                if (table.Sort < 4)
                    table.Sort = 4;
                int sYear = int.Parse(frm.GetYear);
                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_Table_500PH", table);
                    //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table, dataTable.NewRow()));
                    LoadData1(table.ParentID);
                    FoucsLocation(table.ID, treeList1.Nodes);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
            //FrmChangeBian frm = new FrmChangeBian();
            //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;
            //if(frm.ShowDialog() == DialogResult.OK)
            //{
            //    Ps_Table_500PH table = new Ps_Table_500PH();
            //    table.Title = frm.Title;
            //    table.ParentID = focusedNode.GetValue("ID").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 = "1";
            //    table.Sort = OperTable.GetMaxSort() + 1;
            //    try
            //    {
            //        Common.Services.BaseService.Create("InsertPs_Table_500PH", table);
            //        //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table, dataTable.NewRow()));
            //        LoadData();
            //    }
            //    catch(Exception ex)
            //    {
            //        MsgBox.Show("增加项目出错:" + ex.Message);
            //    }
            //}
        }
コード例 #13
0
ファイル: Frm500PHTableBB.cs プロジェクト: EdgarEDT/myitoppsp
        //private Dictionary<string, double> dict = new Dictionary<string, double>();
        //public Dictionary<string, double> Dict
        //{
        //    get { return dict; }
        //    set { dict = value; }
        //}
        public void AddRows(ref IList list, string con)
        {
            //IList list = new List<Ps_Table_500PH>();
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";

            int[] year = GetYears();
            IList pareList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", con);
            try
            {
                for (int i = 0; i < pareList.Count; i++)
                {
                    Ps_Table_500PH ps_table3 = new Ps_Table_500PH();
                    //Ps_Table_500PH con = new Ps_Table_500PH();
                    //con.Col4 = rongZai220;
                    //con.Title = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='0'";
                    //IList childList1 = Common.Services.BaseService.GetList("SelectPs_Table_500PHJiByConn", con);
                    //CaleHeTable(ref childList1);
                    //ps_table1 = (Ps_Table_500PH)childList1[0];
                    double[] dl500 = new double[year[2]-year[1]+1];
                    foreach (Ps_Table_500PH pt in list)
                    {
                        if (pt.Sort==1)
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                dl500[k-year[1]] += double.Parse(pt.GetType().GetProperty("y" + k).GetValue(pt, null).ToString());
                            }
                        }
                        else if (pt.Sort==3)
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                dl500[k - year[1]] -= double.Parse(pt.GetType().GetProperty("y" + k).GetValue(pt, null).ToString());
                            }
                        }
                        else if (pt.Sort==6)
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                dl500[k - year[1]] -= double.Parse(pt.GetType().GetProperty("y" + k).GetValue(pt, null).ToString());
                            }
                        }
                    }
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "0")
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                ps_table3.GetType().GetProperty("y" + k).SetValue(ps_table3, dl500[k - year[1]], null);
                            }
                        }
                    }
                    ps_table3.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table3.ID = Guid.NewGuid().ToString();
                    ps_table3.ID += "|" + GetProjectID;
                    ps_table3.Sort = 7;
                    ps_table3.Col1 = "no";
                    ps_table3.Title = "需从500kV电网受进电力";
                    list.Add(ps_table3);

                    Ps_Table_500PH ps_table1 = new Ps_Table_500PH();
                    //Ps_Table_500PH con = new Ps_Table_500PH();
                    //con.Col4 = rongZai220;
                    //con.Title = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='0'";
                    //IList childList1 = Common.Services.BaseService.GetList("SelectPs_Table_500PHJiByConn", con);
                    //CaleHeTable(ref childList1);
                    //ps_table1 = (Ps_Table_500PH)childList1[0];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "0")
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                ps_table1.GetType().GetProperty("y" + k).SetValue(ps_table1, dl500[k - year[1]]*1.8, null);
                            }
                        }
                    }
                    ps_table1.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table1.ID = Guid.NewGuid().ToString();
                    ps_table1.ID += "|" + GetProjectID;
                    ps_table1.Sort = 8;
                    ps_table1.Col1 = "no";
                    ps_table1.Title = "需500kV变电容量";
                    list.Add(ps_table1);

                    Ps_Table_500PH ps_table = new Ps_Table_500PH();

                    //conn = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='1'";
                    //IList childList = Common.Services.BaseService.GetList("SelectPs_Table_500PHSumByConn", conn);
                    //CaleHeTable(ref childList);
                    //ps_table = (Ps_Table_500PH)childList[0];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "1")
                        {
                            for (int k = year[1]; k <= year[2]; k++)
                            {
                                ps_table.GetType().GetProperty("y" + k).SetValue(ps_table, double.Parse(ps_table.GetType().GetProperty("y" + k).GetValue(ps_table, null).ToString()) + double.Parse(((Ps_Table_500PH)list[j]).GetType().GetProperty("y" + k).GetValue(((Ps_Table_500PH)list[j]), null).ToString()), null);
                            }
                        }
                    }
                    ps_table.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table.ID = Guid.NewGuid().ToString();
                    ps_table.ID += "|" + GetProjectID;
                    ps_table.Sort = 9;
                    ps_table.Col1 = "no";
                    ps_table.Title = "安排500kV变电容量";
                    list.Add(ps_table);

                    // conn = "ParentID='" + ((Ps_Table_500PH)pareList[i]).ID + "' and Col1='0'";
                    Ps_Table_500PH temp = new Ps_Table_500PH();// (Ps_Table_500PH)Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn)[0];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (((Ps_Table_500PH)list[j]).ParentID == ((Ps_Table_500PH)pareList[i]).ID && ((Ps_Table_500PH)list[j]).Col1 == "0")
                        {
                            temp = (Ps_Table_500PH)list[j];
                        }
                    }
                    Ps_Table_500PH ps_table2 = new Ps_Table_500PH();
                    for (int j = year[1]; j <= year[2]; j++)
                    {
                        double d = (double)temp.GetType().GetProperty("y" + j).GetValue(temp, null);
                        if (d != 0.0)
                        {
                            double chu = (double)ps_table.GetType().GetProperty("y" + j).GetValue(ps_table, null);
                            ps_table2.GetType().GetProperty("y" + j).SetValue(ps_table2, Math.Round(double.Parse(ps_table.GetType().GetProperty("y"+j).GetValue(ps_table, null).ToString()) / dl500[j - year[1]], 1), null);
                        }
                    }
                    ps_table2.ParentID = ((Ps_Table_500PH)pareList[i]).ID;
                    ps_table2.ID = Guid.NewGuid().ToString();
                    ps_table2.ID += "|" + GetProjectID;
                    ps_table2.Sort = 1000;
                    ps_table2.Col1 = "no";
                    ps_table2.Title = "500kV变电容载比";
                    list.Add(ps_table2);
                }

                //  CalcTotal(ref list);
            }
            catch (Exception e) { MessageBox.Show(e.Message); }
            //return list;
        }
コード例 #14
0
ファイル: Frm500PHTableWH.cs プロジェクト: EdgarEDT/myitoppsp
        private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ClearNoBuild();
            Ps_YearRange range = oper.GetYearRange("Col5='" + GetProjectID + "' and Col4='" + OperTable.ph500 + "'");
            string conn = "ProjectID='" + GetProjectID + "' and ParentID='0'";
            IList pList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
            for (int i = 0; i < pList.Count; i++)
            {

                //从变电站情况表里读
                conn = "AreaID='" + GetProjectID + "' and L1='500'and (Flag='1' or Flag='2')";
                IList pspList = Common.Services.BaseService.GetList("SelectSubstation_InfoByCon2", conn);

                for (int j = 0; j < pspList.Count; j++)
                {
                    bool KGflag = false;
                    if (((Substation_Info)pspList[j]).Title.Contains("扩建")||((Substation_Info)pspList[j]).Title.Contains("改造"))
                    {
                        KGflag = true;
                        ((Substation_Info)pspList[j]).Title = ((Substation_Info)pspList[j]).Title.Replace("扩建", "");
                        ((Substation_Info)pspList[j]).Title = ((Substation_Info)pspList[j]).Title.Replace("改造", "");
                    }
                    conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ((Ps_Table_500PH)pList[i]).ID + "' and Title='" + ((Substation_Info)pspList[j]).Title + "'";
                    IList oldList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                    Ps_Table_500PH ps = new Ps_Table_500PH();
                    if (oldList.Count > 0)
                    {
                        ps = oldList[0] as Ps_Table_500PH;
                    }
                    else
                    {
                        ps.ID += "|" + ProjectUID;
                        ps.ParentID = ((Ps_Table_500PH)pList[i]).ID;
                        ps.ProjectID = ProjectUID;
                        ps.Sort = OperTable.Get500MaxSort() + 1;
                        ps.Title = ((Substation_Info)pspList[j]).Title;
                        ps.Col1 = "1";
                        if (ps.Sort < 4)
                            ps.Sort = 4;
                        ps.Col3 = ((Substation_Info)pspList[j]).UID;
                    }
                    // for (int k = range.StartYear; k <= range.EndYear; k++)  //原来
                    int year = DateTime.Now.Year;
                    if (((Substation_Info)pspList[j]).S2.Length>4)
                    {
                        string str = ((Substation_Info)pspList[j]).S2.Substring(0, 4);
                        int.TryParse(str, out year);
                    }
                    else
                    {
                        string str = ((Substation_Info)pspList[j]).S2.ToString();
                        int.TryParse(str, out year);
                    }
                     //year = Convert.ToInt32(((Substation_Info)pspList[j]).S2);
                    if (year <= range.EndYear)
                    {
                        if (year <= range.StartYear)
                        {
                            year = range.StartYear;
                        }
                        for (int k = year; k <= range.EndYear; k++)
                        {
                            if (KGflag)
                            {
                                double tempdb = 0;
                                string tempstr="0";
                                if (ps.GetType().GetProperty("y" + k.ToString())!=null)
                                {
                                    tempstr = ps.GetType().GetProperty("y" + k.ToString()).GetValue(ps,null).ToString();
                                }
                                double.TryParse(tempstr,out tempdb);
                                double tempdb2 = ((Substation_Info)pspList[j]).L2 / 10;
                                ps.GetType().GetProperty("y" + k.ToString()).SetValue(ps, tempdb+tempdb2, null);
                            }
                            else
                            {
                                ps.GetType().GetProperty("y" + k.ToString()).SetValue(ps, ((Substation_Info)pspList[j]).L2/10, null);

                            }
                        }
                    }
                    try
                    {
                        if (oldList.Count == 0)
                        {
                            Common.Services.BaseService.Create("InsertPs_Table_500PH", ps);
                            CreateEdit(ps.ID, "", Convert.ToString(range.StartYear - 1), "新建", ((Substation_Info)pspList[j]).L2.ToString(), OperTable.ph500, ((Substation_Info)pspList[j]).UID);
                        }
                        else
                        {
                            Common.Services.BaseService.Update("UpdatePs_Table_500PH", ps);
                            ChangeEdit(ps.ID, "", Convert.ToString(range.StartYear - 1), "新建", ((Substation_Info)pspList[j]).L2.ToString(), OperTable.ph500, ((Substation_Info)pspList[j]).UID);
                        }
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("更新变电站出错:" + ps.Title + ex.Message);
                    }
                }
                /*
                //从建设项目表中读
                conn = "ProjectID='" + GetProjectID + "' and FromID='500'";
                IList buildList = Common.Services.BaseService.GetList("SelectPs_Table_BuildProByConn", conn);
                for (int j = 0; j < buildList.Count; j++)
                {
                    if (((Ps_Table_BuildPro)buildList[j]).Col3 == "新建")
                    {
                        conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ((Ps_Table_500PH)pList[i]).ID + "' and Title='" + ((Ps_Table_BuildPro)buildList[j]).Title + "'";
                        IList oldList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                        Ps_Table_500PH ps = new Ps_Table_500PH();
                        if (oldList.Count > 0)
                        {
                            ps = oldList[0] as Ps_Table_500PH;
                        }
                        else
                        {
                            ps.ID += "|" + ProjectUID;
                            ps.ParentID = ((Ps_Table_500PH)pList[i]).ID;
                            ps.ProjectID = ProjectUID;
                            ps.Sort = OperTable.Get500MaxSort() + 1;
                            ps.Title = ((Ps_Table_BuildPro)buildList[j]).Title;
                            ps.Col1 = "1";
                            if (ps.Sort < 4)
                                ps.Sort = 4;
                            ps.Col3 = ((Ps_Table_BuildPro)buildList[j]).ID;
                        }
                        int bYear = range.StartYear;
                        int.TryParse(((Ps_Table_BuildPro)buildList[j]).BuildEd, out bYear);
                        for (int k = bYear; k <= range.EndYear; k++)
                        {
                            ps.GetType().GetProperty("y" + k.ToString()).SetValue(ps, ((Ps_Table_BuildPro)buildList[j]).Volumn, null);
                        }
                        try
                        {
                            if (oldList.Count == 0)
                            {
                                Common.Services.BaseService.Create("InsertPs_Table_500PH", ps);
                                CreateEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), "新建", ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                            else
                            {
                                Common.Services.BaseService.Update("UpdatePs_Table_500PH", ps);
                                ChangeEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), "新建", ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                        }
                        catch (Exception ex)
                        {
                            MsgBox.Show("更新变电站出错:" + ps.Title + ex.Message);
                        }
                    }
                    else if (((Ps_Table_BuildPro)buildList[j]).Col3 == "扩建" || ((Ps_Table_BuildPro)buildList[j]).Col3 == "改造")
                    {
                        conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ((Ps_Table_500PH)pList[i]).ID + "' and Title='" + ((Ps_Table_BuildPro)buildList[j]).Title + "'";
                        IList oldList = Common.Services.BaseService.GetList("SelectPs_Table_500PHListByConn", conn);
                        Ps_Table_500PH ps = new Ps_Table_500PH();
                        if (oldList.Count > 0)
                        {
                            ps = oldList[0] as Ps_Table_500PH;
                            int bYear = range.StartYear;
                            int.TryParse(((Ps_Table_BuildPro)buildList[j]).BuildEd, out bYear);
                            conn = "ProjectID='" + GetProjectID + "' and ParentID='" + ps.ID + "' and Col5='" + ((Ps_Table_BuildPro)buildList[j]).ID + "'";
                            IList list = Common.Services.BaseService.GetList("SelectPs_Table_EditListByConn", conn);
                            if (list.Count > 0)
                            {
                                ChangeEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), ((Ps_Table_BuildPro)buildList[j]).Col3, ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                            else
                            {
                                CreateEdit(ps.ID, ((Ps_Table_BuildPro)buildList[j]).BuildYear, bYear.ToString(), ((Ps_Table_BuildPro)buildList[j]).Col3, ((Ps_Table_BuildPro)buildList[j]).Volumn.ToString(), OperTable.ph500, ((Ps_Table_BuildPro)buildList[j]).ID);
                            }
                        }
                        else
                            continue;

                    }
                }
                */
            }
            Loaddata2();
        }
コード例 #15
0
ファイル: Frm500PHTableWH.cs プロジェクト: EdgarEDT/myitoppsp
        //添加父分类
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            TreeListNode focusedNode = treeList1.FocusedNode;

            //if (focusedNode == null)
            //{
            //    return;
            //}

            FrmAddPN frm = new FrmAddPN();
            frm.SetCheckVisible();
            frm.SetCheckText("不计特殊");
            frm.checkEdit1.Visible = false;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                for (int i = 0; i < treeList1.Nodes.Count; i++)
                {
                    if (treeList1.Nodes[i].GetValue("Title").ToString() == frm.ParentName && treeList1.Nodes[i].GetValue("ParentID").ToString() == "0")
                    {
                        MessageBox.Show(frm.ParentName + " 地区已存在!");
                        return;
                    }
                }
                Ps_Table_500PH table_yd = new Ps_Table_500PH();
                table_yd.ID += "|" + GetProjectID;
                table_yd.Title = frm.ParentName;
                table_yd.ParentID = "0";
                table_yd.Sort = OperTable.Get500MaxSort() + 1;
                table_yd.ProjectID = GetProjectID;

                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_500PH", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                }

                Ps_Table_500PH table1 = new Ps_Table_500PH();
                table1.ID += "|" + GetProjectID;
                table1.Title = "500千伏公用变电站供电负荷";
                table1.ParentID = table_yd.ID;
                table1.ProjectID = GetProjectID;
                table1.Col1 = "0";
                if (frm.BCheck)
                    table1.Col2 = "no";
                else
                    table1.Col2 = "no1";
                table1.Sort = 1;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_500PH", table1);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
                UpdateFuHe(table_yd.Title, table_yd.ID,"yf");
                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                LoadData1(table_yd.ID);
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();
                this.Cursor = Cursors.Default;
            }
        }