Пример #1
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmAddTzgsWH2 frm   = new FrmAddTzgsWH2();
            Ps_Table_TZGS table = new Ps_Table_TZGS();

            table          = Common.Services.BaseService.GetOneByKey <Ps_Table_TZGS>(FocusedObject.ID);
            frm.TZGSID     = table.ID;
            frm.ParentName = table.Title; //treeList1.FocusedNode.GetValue("Title").ToString();
            frm.Text       = "修改工程";
            //frm.Stat = treeList1.FocusedNode.ParentNode.GetValue("Col2").ToString();
            frm.StrType    = "";
            frm.AreaName   = table.AreaName;
            frm.BianInfo   = table.BianInfo;
            frm.LineInfo   = table.LineInfo;
            frm.LineLen    = table.Length;
            frm.Vol        = table.Volumn;
            frm.StartYear  = table.BuildYear;
            frm.FinishYear = table.BuildEd;
            frm.LineLen    = table.Length;
            frm.LineLen2   = table.Length2;
            frm.BieZhu     = table.Col1;
            frm.Col3       = table.Col3;
            frm.StrType    = table.Col4;
            frm.JGNum      = table.JGNum;
            frm.Amount     = table.Amount;
            frm.ProgType   = table.ProgType;
            frm.WGNum      = table.WGNum;
            frm.DQ         = table.DQ;
            frm.Num6       = table.Num6;
            frm.StrType    = "bian";
            Ps_Table_TZGS t1   = new Ps_Table_TZGS();
            string        sql1 = " ParentID='" + table.ID + "' and Col4='bian'";

            t1          = (Ps_Table_TZGS)Common.Services.BaseService.GetObject("SelectPs_Table_TZGSByConn", sql1);
            frm.Num1    = t1.Num1;
            frm.Num2    = t1.Num2;
            frm.Num5    = t1.Num5;
            frm.Amount  = t1.Amount;
            frm.StrType = "line";
            Ps_Table_TZGS t2   = new Ps_Table_TZGS();
            string        sql2 = " ParentID='" + table.ID + "' and Col4='line'";

            t2           = (Ps_Table_TZGS)Common.Services.BaseService.GetObject("SelectPs_Table_TZGSByConn", sql2);
            frm.Num1     = t2.Num1;
            frm.Num2     = t2.Num2;
            frm.Num5     = t2.Num5;
            frm.Num6     = t2.Num6;
            frm.Amount   = t2.Amount;
            frm.LineLen  = t2.Length;
            frm.LineLen2 = t2.Length2;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                //AddChildVol(table, false);
                frm.StrType     = "";
                table.Title     = frm.ParentName;
                table.BuildYear = frm.StartYear;
                table.BuildEd   = frm.FinishYear;
                table.Length    = frm.LineLen;
                table.Length2   = frm.LineLen2;
                table.Volumn    = frm.Vol;
                double temp = frm.AllVol - table.AllVolumn;
                table.AllVolumn  = frm.AllVol;
                table.AftVolumn += temp;
                //table.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(table, temp + double.Parse(table.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(table, null).ToString()), null);
                table.Col1     = frm.BieZhu;
                table.Col3     = frm.Col3;
                table.Col4     = "";//frm.StrType;
                table.BianInfo = frm.BianInfo;
                table.LineInfo = frm.LineInfo;
                table.JGNum    = frm.JGNum;
                table.Amount   = frm.Amount;
                table.ProgType = frm.ProgType;
                table.AreaName = frm.AreaName;
                table.WGNum    = frm.WGNum;
                table.DQ       = frm.DQ;
                frm.StrType    = "bian";
                t1.Num1        = frm.Num1;
                t1.Num2        = frm.Num2;
                t1.Num5        = frm.Num5;
                t1.WGNum       = frm.WGNum;
                t1.AreaName    = frm.AreaName;
                t1.Col3        = frm.Col3;
                t1.DQ          = frm.DQ;
                t1.ProgType    = frm.ProgType;
                t1.BuildYear   = frm.StartYear;
                t1.BuildEd     = frm.FinishYear;
                t1.Amount      = frm.Amount;
                t1.Volumn      = frm.Vol;
                frm.StrType    = "line";
                t2.Num1        = frm.Num1;
                t2.Num2        = frm.Num2;
                t2.Num5        = frm.Num5;
                t2.Num6        = frm.Num6;
                t2.Length      = frm.LineLen;
                t2.Length2     = frm.LineLen2;
                t2.AreaName    = frm.AreaName;
                t2.Col3        = frm.Col3;
                t2.DQ          = frm.DQ;
                t2.ProgType    = frm.ProgType;
                t2.BuildYear   = frm.StartYear;
                t2.BuildEd     = frm.FinishYear;
                t2.Amount      = frm.Amount;
                try
                {
                    Common.Services.BaseService.Update <Ps_Table_TZGS>(table);
                    Common.Services.BaseService.Update <Ps_Table_TZGS>(t1);
                    Common.Services.BaseService.Update <Ps_Table_TZGS>(t2);

                    LoadData();
                }
                catch { }
            }
        }
Пример #2
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            //FindNodes(treeList1.FocusedNode);

            string parentid = treeList1.FocusedNode["ParentID"].ToString();

            if (!base.EditRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            if (parentid == "0")
            {
                FrmAddPN frm = new FrmAddPN();
                //frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
                frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString();
                frm.Text = "修改分类名";
                frm.SetLabelName = "分类名称";
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Ps_Table_TZGS table1 = new Ps_Table_TZGS();
                    table1 = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(treeList1.FocusedNode.GetValue("ID"));
                    table1.Title = frm.ParentName;
                    table1.Col2 = "no";
                    try
                    {
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(table1);
                        treeList1.FocusedNode.SetValue("Title", frm.ParentName);
                    }
                    catch { }
                    //catch(Exception ex)
                    //{
                    //    MsgBox.Show("修改出错:" + ex.Message);
                    //}
                }
            }
            else
            {
                FrmAddTzgsWH2 frm = new FrmAddTzgsWH2();
                Ps_Table_TZGS table = new Ps_Table_TZGS();
                table = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(treeList1.FocusedNode.GetValue("ID"));
                frm.ParentName = table.Title; //treeList1.FocusedNode.GetValue("Title").ToString();
                frm.Text = "修改工程";
                frm.Stat = treeList1.FocusedNode.ParentNode.GetValue("Col2").ToString();

                frm.AreaName = table.AreaName;
                frm.BianInfo = table.BianInfo;
                frm.LineInfo = table.LineInfo;
                frm.LineLen = table.Length;
                frm.Vol = table.Volumn;
                frm.StartYear = table.BuildYear;
                frm.FinishYear = table.BuildEd;
                frm.LineLen = table.Length;
                frm.BieZhu = table.Col1;
                frm.Col3 = table.Col3;
                frm.StrType = table.Col4;
                frm.JGNum = table.JGNum;
                frm.Amount = table.Amount;
                frm.ProgType = table.ProgType;
                frm.WGNum = table.WGNum;
                //frm.TzgsXs = double.Parse(yAngeXs.Col1);
                frm.DQ = table.DQ;

                frm.StrType = "bian";
                Ps_Table_TZGS t1 = new Ps_Table_TZGS();
                string sql1 = " ParentID='" + table.ID + "' and Col4='bian'";
                t1 =(Ps_Table_TZGS) Common.Services.BaseService.GetObject("SelectPs_Table_TZGSByConn", sql1);
                frm.Num1 = t1.Num1;
                frm.Num2 = t1.Num2;
                frm.Num5 = t1.Num5;
                frm.StrType = "line";
                Ps_Table_TZGS t2 = new Ps_Table_TZGS();
                string sql2 = " ParentID='" + table.ID + "' and Col4='line'";
                t2 = (Ps_Table_TZGS)Common.Services.BaseService.GetObject("SelectPs_Table_TZGSByConn", sql2);
                frm.Num1 = t2.Num1;
                frm.Num2 = t2.Num2;
                frm.Num5 = t2.Num5;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    AddChildVol(table, false);
                    table.Title = frm.ParentName;
                    table.BuildYear = frm.StartYear;
                    table.BuildEd = frm.FinishYear;
                    table.Length = frm.LineLen;
                    table.Volumn = frm.Vol;
                    double temp = frm.AllVol - table.AllVolumn;
                    table.AllVolumn = frm.AllVol;
                    table.AftVolumn += temp;
                    table.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(table, temp + double.Parse(table.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(table,null).ToString()), null);
                    table.Col1 = frm.BieZhu;
                    table.Col3 = frm.Col3;
                    table.Col4 = frm.StrType;
                    table.BianInfo = frm.BianInfo;
                    table.LineInfo = frm.LineInfo;
                    table.JGNum =frm.JGNum;
                    table.Amount=frm.Amount;
                    table.ProgType=frm.ProgType;
                    table.WGNum = frm.WGNum;
                    table.DQ = frm.DQ;
                    frm.StrType = "bian";
                    t1.Num1 = frm.Num1;
                    t1.Num2 = frm.Num2;
                    t1.Num5 = frm.Num5;
                    t1.WGNum = frm.WGNum;
                    frm.StrType = "line";
                    t2.Num1 = frm.Num1;
                    t2.Num2 = frm.Num2;
                    t2.Num5 = frm.Num5;
                    try
                    {
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(table);
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(t1);
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(t2);
                        AddChildVol(table, true);
                        LoadData1();
                        FoucsLocation(table.ID, treeList1.Nodes);
                    }
                    catch { }
                }
            }
        }
Пример #3
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmAddTzgsWH2 frm = new FrmAddTzgsWH2();

            frm.Text = "增加";
            // frm.Stat = focusedNode.GetValue("Col2").ToString();
            // frm.SetLabelName = "子分类名称";
            Ps_Table_TZGS table1 = new Ps_Table_TZGS();

            table1.ID += "|" + GetProjectID;
            frm.TZGSID = table1.ID;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                table1.Title     = frm.ParentName;
                table1.ParentID  = "0";// focusedNode.GetValue("ID").ToString();
                table1.ProjectID = GetProjectID;
                table1.BuildYear = frm.StartYear;
                table1.BuildEd   = frm.FinishYear;
                table1.FromID    = "0";
                //table1.Length = frm.LineLen;
                //table1.Volumn = frm.Vol;
                table1.AllVolumn = frm.AllVol;
                //  table1.BefVolumn = frm.AllVol;
                table1.AftVolumn = frm.AllVol;
                table1.LineInfo  = frm.LineInfo;
                table1.BianInfo  = frm.BianInfo;
                table1.AreaName  = frm.AreaName;
                table1.Length    = frm.LineLen;
                table1.Length2   = frm.LineLen2;
                table1.Sort      = OperTable.GetTZGSMaxSort() + 1;
                table1.Col3      = frm.Col3;
                table1.Col1      = frm.BieZhu;
                table1.DQ        = frm.DQ;
                table1.JGNum     = frm.JGNum;
                table1.WGNum     = frm.WGNum;
                table1.ProgType  = frm.ProgType;
                table1.Amount    = frm.Amount;
                table1.Num6      = frm.Num6;

                try
                {
                    string pid = table1.ID;
                    string tit = table1.Title;
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
                    frm.StrType     = "bian";
                    table1.Title    = tit + "-变电";
                    table1.Col4     = "bian";
                    table1.Volumn   = frm.Vol;
                    table1.ParentID = pid;
                    table1.ID       = Guid.NewGuid().ToString();
                    table1.BianInfo = frm.BianInfo;
                    table1.Num1     = frm.Num1;
                    table1.Num2     = frm.Num2;
                    table1.Num5     = frm.Num5;
                    table1.Amount   = frm.Amount;
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);

                    frm.StrType     = "line";
                    table1.Title    = tit + "-线路";
                    table1.Col4     = "line";
                    table1.Length   = frm.LineLen;
                    table1.ParentID = pid;
                    table1.ID       = Guid.NewGuid().ToString();
                    table1.LineInfo = frm.LineInfo;
                    table1.Num1     = frm.Num1;
                    table1.Num2     = frm.Num2;
                    table1.Num5     = frm.Num5;
                    table1.Num6     = frm.Num6;
                    table1.Length   = frm.LineLen;
                    table1.Length2  = frm.LineLen2;
                    table1.Amount   = frm.Amount;
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);

                    LoadData();
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加工程出错:" + ex.Message);
                }
            }
        }
Пример #4
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 ( focusedNode.GetValue("ParentID").ToString()!="0")
            {
                //MsgBox.Show( focusedNode.GetValue("Title").ToString()+"不允许添加子分类!");
                // return;
                focusedNode = focusedNode.ParentNode;
            }

            FrmAddTzgsWH2 frm = new FrmAddTzgsWH2();
            frm.Text = "增加" + focusedNode.GetValue("Title") + "的子分类";
            frm.Stat = focusedNode.GetValue("Col2").ToString();
               // frm.SetLabelName = "子分类名称";
            if(frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_TZGS table1 = new Ps_Table_TZGS();
                table1.ID += "|" + GetProjectID;
                table1.Title = frm.ParentName;
                table1.ParentID = focusedNode.GetValue("ID").ToString();
                table1.ProjectID = GetProjectID;
                table1.BuildYear = frm.StartYear;
                table1.BuildEd = frm.FinishYear;
                table1.FromID = "0";
                //table1.Length = frm.LineLen;
                //table1.Volumn = frm.Vol;
                table1.AllVolumn = frm.AllVol;
              //  table1.BefVolumn = frm.AllVol;
                table1.AftVolumn = frm.AllVol;
                table1.LineInfo = frm.LineInfo;
                table1.BianInfo = frm.BianInfo;
                table1.AreaName = frm.AreaName;

                table1.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(table1, frm.AllVol, null);
                //table1.Col2 = treeList1.FocusedNode.GetValue("Col1").ToString();
                table1.Sort = OperTable.GetTZGSMaxSort()+1;
                table1.Col3 = frm.Col3;
                table1.Col1 = frm.BieZhu;
                table1.DQ = frm.DQ;
                table1.JGNum = frm.JGNum;
                table1.WGNum = frm.WGNum;
                table1.ProgType = frm.ProgType;
                table1.Amount = frm.Amount;
                //table1.Num1 = frm.Num1;
                //table1.Num2 = frm.Num2;
                //table1.Num3 = frm.Num3;
                //table1.Num4 = frm.Num4;

                try
                {
                    string pid = table1.ID;
                    string tit = table1.Title;
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow()));
                    frm.StrType = "bian";
                    table1.Title = tit+"-变电";
                    table1.Col4 = "bian";
                    table1.Volumn = frm.Vol;
                    table1.ParentID =pid;
                    table1.ID = Guid.NewGuid().ToString();
                    table1.BianInfo = frm.BianInfo;
                    table1.Num1 = frm.Num1;
                    table1.Num2 = frm.Num2;
                    table1.Num5 = frm.Num5;

                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow()));
                    frm.StrType = "line";
                    table1.Title = tit + "-线路";
                    table1.Col4 = "line";
                    table1.Length = frm.LineLen;
                    table1.ParentID = pid;
                    table1.ID = Guid.NewGuid().ToString();
                    table1.LineInfo = frm.LineInfo;
                    table1.Num1 = frm.Num1;
                    table1.Num2 = frm.Num2;
                    table1.Num5 = frm.Num5;

                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);

                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(table1, dataTable.NewRow()));
                    AddChildVol(table1, true);
                    LoadData1();
                    FoucsLocation(table1.ID, treeList1.Nodes);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加工程出错:" + ex.Message);
                }
            }
        }