Exemplo n.º 1
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmAddTzgsWH2pw frm = new FrmAddTzgsWH2pw();

            frm.Text = "增加";
            // frm.Stat = focusedNode.GetValue("Col2").ToString();
            // frm.SetLabelName = "子分类名称";
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_TZGS table1 = new Ps_Table_TZGS();
                table1.ID   += "|" + GetProjectID;
                frm.tzgspwid = table1.ID;

                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.AllVolumn = 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;
                table1.Col4     = "pw";
                frm.StrType     = "pw";
                table1.Amount   = frm.Amount;
                try
                {
                    string pid = table1.ID;
                    string tit = table1.Title;

                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
                    frm.StrType  = "pw-pb";
                    table1.Title = tit + "-配变";
                    table1.Col4  = "pw-pb";
                    //table1.Volumn = frm.Vol;
                    table1.ParentID = pid;
                    table1.ID       = Guid.NewGuid().ToString();
                    table1.Num1     = frm.Num1;
                    table1.Num2     = frm.Num2;
                    table1.Num3     = frm.Num3;
                    table1.Num4     = frm.Num4;
                    table1.Num5     = frm.Num5;
                    table1.Num6     = frm.Num6;
                    table1.Amount   = frm.Amount;
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
                    frm.StrType     = "pw-kg";
                    table1.Title    = tit + "-开关";
                    table1.Col4     = "pw-kg";
                    table1.ParentID = pid;
                    table1.ID       = Guid.NewGuid().ToString();
                    table1.Num1     = frm.Num1;
                    table1.Num2     = frm.Num2;
                    table1.Num3     = frm.Num3;
                    table1.Num4     = frm.Num4;
                    table1.Amount   = frm.Amount;
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
                    frm.StrType     = "pw-line";
                    table1.Title    = tit + "-线路";
                    table1.Col4     = "pw-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.Num3     = frm.Num3;
                    table1.Num4     = frm.Num4;
                    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);
                }
            }
        }