Пример #1
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;
            }
            FindNodes(treeList1.FocusedNode);
            string nodestr = treenode.GetValue("Title").ToString();
            if (treeList1.FocusedNode.GetValue("Col1").ToString() == "no" || focusedNode.GetValue("ParentID").ToString()=="0")
            {
                MsgBox.Show( focusedNode.GetValue("Title").ToString()+"不允许添加子分类!");
                return;
            }

            FrmAddPN frm = new FrmAddPN();
            frm.Text = "增加" + focusedNode.GetValue("Title") + "的子分类";
            frm.SetLabelName = "子分类名称";
            if (focusedNode.GetValue("Title").ToString() == "二、220千伏直供负荷")
                frm.SetCheckVisible();
            if(frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_500Result table1 = new Ps_Table_500Result();
                table1.ID += "|" + GetProjectID;
                table1.Title = frm.ParentName;
                table1.ParentID = focusedNode.GetValue("ID").ToString();
                table1.ProjectID = GetProjectID;
                table1.Col1 = "child";
                table1.Col2 = treeList1.FocusedNode.GetValue("Col1").ToString();
                table1.Sort = OperTable.Get500ResultMaxSort()+1;
                if (frm.BCheck == true)
                    table1.Col3 = "check";
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_500Result", table1);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow()));
                }
                catch(Exception ex)
                {
                    MsgBox.Show("增加子分类出错:" + ex.Message);
                }
            }
        }
Пример #2
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;
            //}

            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;
            }
        }
Пример #3
0
        //添加地区
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            TreeListNode focusedNode = treeList1.FocusedNode;
            FrmAddPN frm = new FrmAddPN();
            frm.SetCheckVisible();
            frm.SetCheckText("不计特殊");
            frm.checkEdit1.Visible = false;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                string title = frm.ParentName;
                string connstr=" Title='"+title+"' and ProjectID='"+GetProjectID+"'";
                IList templist = Common.Services.BaseService.GetList("SelectPs_Table_100PHListByConn", connstr);
                if (templist.Count>0)
                {
                    MessageBox.Show(title + " 地区已存在!", "提示");
                    return;
                }
                Ps_Table_100PH table_yd = new Ps_Table_100PH();
                table_yd.ID += "|" + GetProjectID;
                table_yd.Title = frm.ParentName;
                table_yd.ParentID = "0";
                table_yd.Sort = OperTable.Get100MaxSort() + 1;
                table_yd.ProjectID = GetProjectID;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_100PH", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                    return;
                }
                string[] lei = new string[14] { "分区综合最高负荷", "本区220kV主变35kV侧可供负荷", "本区35kV及以下小电源直接供电负荷", "110kV用户专变负荷", "需110kV降压供电负荷", "本区现有110kV降压变电容量", "本区110kV容载比", "本区需110kV变电容量", "本区变电容量盈亏", "目前已立项的变电容量", "规划新增变电容量", "变电容量合计", "容载比", "备注" };
                for (int i = 0; i < lei.Length; i++)
                {
                    string parentID = "";
                    Ps_Table_100PH table1 = new Ps_Table_100PH();
                    table1.ID += "|" + GetProjectID;
                    parentID = table1.ID;
                    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_100PH", table1);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.Show("增加项目出错:" + ex.Message);
                        return;
                    }
                    if (lei[i].ToString() == "目前已立项的变电容量")
                    {
                        //根据地区计算相应结果填入
                        IList yllist = Common.Services.BaseService.GetList("SelectPs_Table_100PHListByConn", " ID='" + table1.ID + "' and ProjectID='" + GetProjectID + "'");
                        Ps_Table_100PH psr = yllist[0] as Ps_Table_100PH;
                        string AreaName = title;
                        for (int j = yAnge.BeginYear; j <= yAnge.EndYear; j++)
                        {
                            string year=j.ToString();
                             string con = "and a.BuildEd='" + year + "' and a.ProjectID='" + ProjectUID + "' and a.AreaName='" + AreaName + "' and substring(a.BianInfo,1,charindex('@',a.BianInfo,0)-1)='110'";
                             double vol = Convert.ToDouble(Common.Services.BaseService.GetObject("SelectTZGSsubLL", con));
                            psr.GetType().GetProperty("y" + j.ToString()).SetValue(psr, Math.Round(vol, 2), null);
                        }
                        try
                        {
                            Common.Services.BaseService.Update<Ps_Table_100PH>(psr);
                        }
                        catch (Exception ex)
                        {
                            MsgBox.Show("计算已立项的变电容量出错:" + ex.Message);
                            return;
                        }
                    }
                }
                //UpdateFuHe(table_yd.Title, table_yd.ID,"yf");
                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                LoadData();
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();

                this.Cursor = Cursors.Default;
            }
        }
Пример #4
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;
            //}

            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;
            }
        }