Ejemplo n.º 1
0
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }
            Ps_YearRange range = yAnge;
            TreeListNode focusedNode = treeList1.FocusedNode;

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

            FrmAddPN frm = new FrmAddPN();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Ps_Table_TZGS table_yd = new Ps_Table_TZGS();
                table_yd.ID += "|" + GetProjectID;
                table_yd.Title = frm.ParentName;
                table_yd.ParentID = "0";
                table_yd.Sort = OperTable.GetTZGSMaxSort() + 1;
                table_yd.ProjectID = GetProjectID;
                table_yd.Col2 = frm.ParentName;
                try
                {
                    Common.Services.BaseService.Create("InsertPs_Table_TZGS", table_yd);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加分类出错:" + ex.Message);
                }

                this.Cursor = Cursors.WaitCursor;
                treeList1.BeginUpdate();
                //treeList1.ExpandAll();
                LoadData1();
                FoucsLocation(table_yd.ID, treeList1.Nodes);
                treeList1.EndUpdate();
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回每个电压等级的容量
        /// </summary>
        /// <param name="list"></param>
        private void ReturnVoltage(IList list, string strType,string strTitle)
        {
            Ps_Table_TZGS pTT = new Ps_Table_TZGS();
            if (strTitle == "新建")
            {
                HP.INewVolume = new IList[list.Count];
                for (int i = 0; i < list.Count; ++i)
                {
                    pTT = (Ps_Table_TZGS)list[i];
                    SelectVoltageVolume(pTT.ID, strType, i,HP.INewVolume);
                }

            }
            if (strTitle == "扩建")
            {
                HP.IExtendsVolume = new IList[list.Count];
                for (int i = 0; i < list.Count; ++i)
                {
                    pTT = (Ps_Table_TZGS)list[i];
                    SelectVoltageVolume(pTT.ID, strType, i,HP.IExtendsVolume );
                }
            }
            if (strTitle == "改造")
            {
                HP.IRebuildVolume = new IList[list.Count];
                for (int i = 0; i < list.Count; ++i)
                {
                    pTT = (Ps_Table_TZGS)list[i];
                    SelectVoltageVolume(pTT.ID, strType, i,HP.IRebuildVolume);
                }
            }
        }
Ejemplo n.º 3
0
 public void AddModelChild(string id,string pid)
 {
     Ps_Table_TZGS table1 = new Ps_Table_TZGS();
     table1.ID += "|" + GetProjectID;
     table1.Title = "其中:小水电";
     table1.ParentID = id;
     table1.ProjectID = GetProjectID;
     table1.Col1 = "child";
     table1.Col2 = "2";
     table1.Col3 = "shui";
     table1.Col4 = pid;
     table1.Sort = 0;
     Ps_Table_TZGS table3 = new Ps_Table_TZGS();
     table3.ID += "|" + GetProjectID;
     table3.Title = "其它";
     table3.Col1 = "child";
     table3.Col2 = "2";
     table3.ParentID = id;
     table3.ProjectID = GetProjectID;
     table3.Col3 = "other";
     table3.Col4 = pid;
     table3.Sort = 2;
     Ps_Table_TZGS table2 = new Ps_Table_TZGS();
     table2.ID += "|" + GetProjectID;
     table2.Title = "小火电";
     table2.Col1 = "child";
     table2.Col2 = "2";
     table2.ParentID = id;
     table2.ProjectID = GetProjectID;
     table2.Col3 = "huo";
     table2.Col4 = pid;
     table2.Sort = 1;
     Common.Services.BaseService.Create("InsertPs_Table_TZGS", table1);
     Common.Services.BaseService.Create("InsertPs_Table_TZGS", table3);
     Common.Services.BaseService.Create("InsertPs_Table_TZGS", table2);
 }
Ejemplo n.º 4
0
 public void UpdateFuHe(string pid,string col1,Ps_Table_TZGS oldrs,Ps_Table_TZGS newrs)
 {
     string conn = "ProjectID='" + GetProjectID + "' and Col1='"+col1+"' and ParentID='"+pid+"'";
     IList list = Common.Services.BaseService.GetList("SelectPs_Table_TZGSByConn", conn);
     if (list.Count > 0)
     {
         for(int i=yAnge.BeginYear;i<=yAnge.EndYear;i++)
         {
             double oldyf = double.Parse(oldrs.GetType().GetProperty("yf"+i.ToString()).GetValue(oldrs,null).ToString());
             double oldyk = double.Parse(oldrs.GetType().GetProperty("yk" + i.ToString()).GetValue(oldrs, null).ToString());
             double newyf = double.Parse(newrs.GetType().GetProperty("yf" + i.ToString()).GetValue(newrs, null).ToString());
             double newyk = double.Parse(newrs.GetType().GetProperty("yk" + i.ToString()).GetValue(newrs, null).ToString());
             double myyf = double.Parse(list[0].GetType().GetProperty("yf" + i.ToString()).GetValue(list[0], null).ToString());
             double myyk = double.Parse(list[0].GetType().GetProperty("yk" + i.ToString()).GetValue(list[0], null).ToString());
             list[0].GetType().GetProperty("yf" + i.ToString()).SetValue(list[0], Math.Round(myyf - oldyf + newyf,1), null);
             list[0].GetType().GetProperty("yk" + i.ToString()).SetValue(list[0], Math.Round(myyk - oldyk + newyk,1), null);
         }
         Common.Services.BaseService.Update<Ps_Table_TZGS>((Ps_Table_TZGS)list[0]);
     }
 }
Ejemplo n.º 5
0
 public void AddChildVol(Ps_Table_TZGS child,bool bAdd)
 {
     Ps_Table_TZGS pare = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(child.ParentID);
     IList<string> list=new List<string>();
     list.Add("Length");list.Add("Volumn");list.Add("AllVolumn");list.Add("BefVolumn");
     list.Add("AftVolumn");
     for (int i = 2008; i <= yAnge.StartYear + 5; i++)
         list.Add("y" + i.ToString());
     double old=0.0,cld=0.0;
     foreach (string str in list)
     {
         old=double.Parse(pare.GetType().GetProperty(str).GetValue(pare,null).ToString());
         cld=double.Parse(child.GetType().GetProperty(str).GetValue(child,null).ToString());
         if (bAdd)
             pare.GetType().GetProperty(str).SetValue(pare, old + cld, null);
         else
             pare.GetType().GetProperty(str).SetValue(pare, old - cld, null);
     }
     Common.Services.BaseService.Update<Ps_Table_TZGS>(pare);
 }
Ejemplo n.º 6
0
        private bool SaveCellValue(string year, string typeID, double value)
        {
            Ps_Table_TZGS psp = new Ps_Table_TZGS();
            Ps_Table_TZGS old = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(typeID);
            psp = (Ps_Table_TZGS)old.Clone();
            psp.GetType().GetProperty(year).SetValue(psp, Math.Round(value,1),null);

            try
            {
                Common.Services.BaseService.Update<Ps_Table_TZGS>(psp);
            }
            catch(Exception ex)
            {
                MsgBox.Show("保存数据出错:" + ex.Message);
                return false;
            }
            return true;
        }
Ejemplo n.º 7
0
 public Ps_Table_TZGS GetTZGSParent(string type)
 {
     try
     {
         IList list = Common.Services.BaseService.GetList("SelectPs_Table_TZGSByConn", "Col2='"+type+"' and ProjectID='"+GetProjectID+"' and ParentID='0'");
         Ps_Table_TZGS guid = new Ps_Table_TZGS();
         guid = null;
         if (list.Count > 0)
             guid = (Ps_Table_TZGS)list[0];
         return guid;
     }
     catch { return null; }
 }
Ejemplo n.º 8
0
        public void RefreshData(string type)
        {
            string n = "";
            string conn = "COL4='"+type+"' and ProjectID='" + GetProjectID + "'  and ID not in (Select ID from Ps_Table_TZGS where ProjectID = '" + GetProjectID + "')";
            IList<Ps_Table_BuildPro> list = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn);
            Ps_Table_TZGS pare110 = GetTZGSParent("110",type);
            Ps_Table_TZGS pare220 = GetTZGSParent("220", type);
            Ps_Table_TZGS pare500 = GetTZGSParent("500", type);

            for (int i = 0; i < list.Count; i++)
            {
                n = "";
                Ps_Table_BuildPro table = list[i];
               // if (list[i].Col4 == OperTable.ph110)
               // {
                    if (table != null)
                    {
                        Ps_Table_TZGS tzgs = new Ps_Table_TZGS();
                        tzgs.ID = table.ID;
                        tzgs.FromID = table.ID;
                        tzgs.ProjectID = GetProjectID;
                        tzgs.ParentID = table.ParentID;
                        tzgs.Sort = table.Sort;
                        tzgs.Title = table.Title;// +"工程";
                        tzgs.BuildYear = list[i].BuildYear;
                        tzgs.BuildEd = list[i].BuildEd;
                        tzgs.Volumn = list[i].Volumn;
                        tzgs.Col3 = list[i].Col3;
                        tzgs.AftVolumn = list[i].AftVolumn;
                        if (list[i].Col4=="bian")
                        {
                            if (list[i].Col5 != null && list[i].Col5!="")
                            {
                                tzgs.Num1 = Convert.ToDouble(list[i].Col5);
                            }
                        }
                        else if (list[i].Col4 == "line")
                        {
                            tzgs.Length = list[i].Length;
                        }
                        else if (list[i].Col4 == "sbd")
                        {
                            if (list[i].Col5 != null && list[i].Col5 != "")
                            {
                                tzgs.Num1 = Convert.ToDouble(list[i].Col5);
                            }

                            tzgs.Length = list[i].Length;
                        }
                        tzgs.BianInfo = list[i].BianInfo;
                        tzgs.LineInfo = list[i].LineInfo;
                        tzgs.AllVolumn = list[i].AllVolumn;
                        tzgs.Col1 = list[i].Col1;
                        tzgs.FromID = list[i].FromID;
                        tzgs.Col4 = list[i].Col4;
                        if (tzgs.GetType().GetProperty("y" + Convert.ToString(list[i].BuildYear)) != null)
                            tzgs.GetType().GetProperty("y" + Convert.ToString(list[i].BuildYear)).SetValue(tzgs, tzgs.AllVolumn, null);
                        if (pare110 != null && table.ParentID==pare110.ID)
                        {
                            pare110.AftVolumn += tzgs.AftVolumn;
                            pare110.AllVolumn += tzgs.AllVolumn;
                            pare110.Length += tzgs.Length;
                            pare110.Volumn += tzgs.Volumn;
                            pare110.Num1 += tzgs.Num1;
                            pare110.GetType().GetProperty("y" + Convert.ToString(list[i].BuildYear)).SetValue(pare110, double.Parse(pare110.GetType().GetProperty("y" + Convert.ToString(list[i].BuildEd)).GetValue(pare110, null).ToString()) + tzgs.AllVolumn, null);
                            Common.Services.BaseService.Update<Ps_Table_TZGS>(pare110);
                        }
                        else if (pare220 != null && table.ParentID == pare220.ID)
                        {
                            pare220.AftVolumn += tzgs.AftVolumn;
                            pare220.AllVolumn += tzgs.AllVolumn;
                            pare220.Length += tzgs.Length;
                            pare220.Volumn += tzgs.Volumn;
                            pare220.Num1 += tzgs.Num1;
                            pare220.GetType().GetProperty("y" + Convert.ToString(list[i].BuildYear)).SetValue(pare220, double.Parse(pare220.GetType().GetProperty("y" + Convert.ToString(list[i].BuildEd)).GetValue(pare220, null).ToString()) + tzgs.AllVolumn, null);
                            Common.Services.BaseService.Update<Ps_Table_TZGS>(pare220);
                        }
                        else if (pare500 != null && table.ParentID == pare500.ID)
                        {
                            pare500.AftVolumn += tzgs.AftVolumn;
                            pare500.AllVolumn += tzgs.AllVolumn;
                            pare500.Length += tzgs.Length;
                            pare500.Volumn += tzgs.Volumn;
                            pare500.Num1 += tzgs.Num1;
                            pare500.GetType().GetProperty("y" + Convert.ToString(list[i].BuildYear)).SetValue(pare500, double.Parse(pare500.GetType().GetProperty("y" + Convert.ToString(list[i].BuildEd)).GetValue(pare500, null).ToString()) + tzgs.AllVolumn, null);
                            Common.Services.BaseService.Update<Ps_Table_TZGS>(pare500);

                        }
                        //  Common.Services.BaseService.Update<Ps_Table_TZGS>(pare);
                        Common.Services.BaseService.Create<Ps_Table_TZGS>(tzgs);
                    }
               // }

            }
            if (pare110 == null)
            {
                pare110 = GetTZGSParent("110",type);
                if (pare110 != null)
                {
                    pare110.AllVolumn = 0;
                    pare110.AftVolumn = 0;
                    pare110.Length = 0;
                    pare110.Volumn = 0;
                    pare110.Num1 = 0;
                    conn = "ProjectID='" + GetProjectID + "'  and ParentID = '"+pare110.ID+"'";
                    IList<Ps_Table_TZGS> listt = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", conn);
                    foreach (Ps_Table_TZGS t in listt)
                    {
                        pare110.Length += t.Length;
                        pare110.Volumn += t.Volumn;
                        pare110.AftVolumn += t.AftVolumn;
                        pare110.AllVolumn += t.AllVolumn;
                        pare110.Num1 += t.Num1;
                        for (int i = yAnge.StartYear + 1; i <= yAnge.StartYear + 5; i++)
                        {
                            double temp = double.Parse(t.GetType().GetProperty("y" + i.ToString()).GetValue(t, null).ToString());
                            double old = double.Parse(pare110.GetType().GetProperty("y" + Convert.ToString(i)).GetValue(pare110, null).ToString());
                            pare110.GetType().GetProperty("y" + Convert.ToString(i)).SetValue(pare110, old+temp, null);
                        }
                    }

                    Common.Services.BaseService.Update<Ps_Table_TZGS>(pare110);

                }
            }
            if (pare220 == null)
            {
                pare220 = GetTZGSParent("220", type);
                if (pare220 != null)
                {
                    pare220.AllVolumn = 0;
                    pare220.AftVolumn = 0;
                    pare220.Length = 0;
                    pare220.Volumn = 0;
                    pare220.Num1 = 0;
                    conn = "ProjectID='" + GetProjectID + "'  and ParentID = '" + pare220.ID + "'";
                    IList<Ps_Table_TZGS> listt = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", conn);
                    foreach (Ps_Table_TZGS t in listt)
                    {
                        pare220.Length += t.Length;
                        pare220.Volumn += t.Volumn;
                        pare220.AftVolumn += t.AftVolumn;
                        pare220.AllVolumn += t.AllVolumn;
                        pare220.Num1 += t.Num1;
                        for (int i = yAnge.StartYear + 1; i <= yAnge.StartYear + 5; i++)
                        {
                            double temp = double.Parse(t.GetType().GetProperty("y" + i.ToString()).GetValue(t, null).ToString());
                            double old = double.Parse(pare220.GetType().GetProperty("y" + Convert.ToString(i)).GetValue(pare220, null).ToString());
                            pare220.GetType().GetProperty("y" + Convert.ToString(i)).SetValue(pare220, old + temp, null);
                        }
                    }
                   // pare220.GetType().GetProperty("y" + Convert.ToString(list[i].BuildEd)).SetValue(pare220, pare220.AllVolumn, null);
                    Common.Services.BaseService.Update<Ps_Table_TZGS>(pare220);
                }
            }
            if (pare500 == null)
            {
                pare500 = GetTZGSParent("500", type);
                if (pare500 != null)
                {
                    pare500.AllVolumn = 0;
                    pare500.AftVolumn = 0;
                    pare500.Length = 0;
                    pare500.Volumn = 0;
                    pare500.Num1 = 0;
                    conn = "ProjectID='" + GetProjectID + "'  and ParentID = '" + pare500.ID + "'";
                    IList<Ps_Table_TZGS> listt = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", conn);
                    foreach (Ps_Table_TZGS t in listt)
                    {
                        pare500.Length += t.Length;
                        pare500.Volumn += t.Volumn;
                        pare500.AftVolumn += t.AftVolumn;
                        pare500.AllVolumn += t.AllVolumn;
                        pare500.Num1 += t.Num1;
                        for (int i = yAnge.StartYear + 1; i <= yAnge.StartYear + 5; i++)
                        {
                            double temp = double.Parse(t.GetType().GetProperty("y" + i.ToString()).GetValue(t, null).ToString());
                            double old = double.Parse(pare500.GetType().GetProperty("y" + Convert.ToString(i)).GetValue(pare500, null).ToString());
                            pare500.GetType().GetProperty("y" + Convert.ToString(i)).SetValue(pare500, old + temp, null);
                        }
                    }
                   // pare500.GetType().GetProperty("y" + Convert.ToString(list[i].BuildEd)).SetValue(pare500, pare500.AllVolumn, null);
                    Common.Services.BaseService.Update<Ps_Table_TZGS>(pare500);
                }
            }

            LoadData1();
            //string con = "ProjectID='" + GetProjectID + "'";
            //IList<Ps_Table_TZGS> list2 = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", con);
            //for (int i = 0; i < list1.Count; i++)
            //{
            //    for (int j = 0; j < list2.Count; j++)
            //    {

            //    }
            //}
        }
Ejemplo n.º 9
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmAddTzgsAHTL frm = new FrmAddTzgsAHTL();
            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.LineVol+frm.BianVol;
                //  table1.BefVolumn = frm.AllVol;
                //table1.AftVolumn = frm.LineVol + frm.BianVol;
                table1.LineInfo = frm.LineInfo;
                table1.BianInfo = frm.BianInfo;
                table1.AreaName = frm.AreaName;
                //用y1990存放线路长度
                table1.y1990= frm.LineLen + frm.LineLen2;
                //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.AllVolumn = frm.Amount;
                    //  table1.BefVolumn = frm.AllVol;
                    //table1.AftVolumn = frm.BianVol;
                    table1.Length = 0;
                    table1.Length2 = 0;
                    table1.y1990 = 0;
                    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.Volumn = 0;
                    table1.AllVolumn = frm.Amount;
                    //  table1.BefVolumn = frm.AllVol;
                    //table1.AftVolumn = frm.LineVol;
                    table1.y1990 = frm.LineLen + frm.LineLen2;
                    table1.Length = frm.LineLen;
                    table1.Length2 = frm.LineLen2;

                    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);
                }
            }
        }
Ejemplo n.º 10
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 { }
                }
            }
        }
Ejemplo n.º 11
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")
            {
                FrmAddBuild frm = new FrmAddBuild();
                //frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
                frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString();
                frm.Text = "修改分类名";
                frm.SetLabelName = "分类名称";
                frm.GetV = treeList1.FocusedNode.GetValue("FromID").ToString();
                frm.Conn = tong + "ParentID='0' and ProjectID='" + GetProjectID + "' and FromID=";
                frm.BEdit = true;

                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.FromID = frm.GetV;
                    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
            {
                FrmAddTzgsBBPW frm = new FrmAddTzgsBBPW();
                Ps_Table_TZGS table = new Ps_Table_TZGS();
                table = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(treeList1.FocusedNode.GetValue("ID"));
               // frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString();

                try
                {
                    frm.V = int.Parse(treeList1.FocusedNode.GetValue("FromID").ToString());
                }
                catch { }
                frm.AreaName = treeList1.FocusedNode.GetValue("AreaName").ToString();
                frm.ProjectID = ProjectUID;
                if (treeList1.FocusedNode.GetValue("Col4") != null)
                {
                    if (treeList1.FocusedNode.GetValue("Col4").ToString() == "line")
                        frm.Line = true;
                }
                frm.Text = "修改工程";
                frm.StrType = table.Col4;

                frm.ParentName = table.Title;
                if (treeList1.FocusedNode.ParentNode!=null)
                {
                    frm.Stat = treeList1.FocusedNode.ParentNode.GetValue("Col2").ToString();
                }

                frm.BianInfo = table.BianInfo;
                frm.LineInfo = table.LineInfo;
                frm.StartYear = table.BuildYear;
                frm.FinishYear = table.BuildEd;
                frm.LineLen = table.Length;
                frm.BieZhu = table.Col1;
                frm.Col3 = table.Col3;
                frm.Vol = table.Volumn;
                frm.TzgsXs = double.Parse(yAngeXs.Col1);
                frm.DQ = table.DQ;
                frm.Num1 = table.Num1;
                frm.Num2 = table.Num2;
                frm.uid = table.ID;
                frm.operatorflag = false;
                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;
                    for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                    {
                        table.GetType().GetProperty("y" + i).SetValue(table, 0, null);
                    }
                    table.GetType().GetProperty("y" + Convert.ToString(frm.FinishYear)).SetValue(table, table.AftVolumn, null);
                    table.Col1 = frm.BieZhu;
                    table.Col3 = frm.Col3;
                    //table.Col4 = frm.StrType;
                    table.BianInfo = frm.BianInfo;
                    table.LineInfo = frm.LineInfo;
                    table.DQ = frm.DQ;
                    table.Num1 = frm.Num1;
                    table.Num2 = frm.Num2;
                    try
                    {
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(table);
                        AddChildVol(table, true);
                        LoadData1();
                        FoucsLocation(table.ID, treeList1.Nodes);
                    }
                    catch { }
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 写入低压数据
        /// </summary>
        /// <param name="FB"></param>
        /// <param name="obj"></param>
        /// <param name="IntRow"></param>
        /// <param name="IntCol"></param>
        private void WriteLowData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol)
        {
            Ps_Table_TZGS pTT = new Ps_Table_TZGS();
            Ps_Table_TZGS pTT1 = new Ps_Table_TZGS();
            Ps_Table_TZGS pTT2 = new Ps_Table_TZGS();
            string VolatageClass = null;
            string UnitTemp=null;
            string strTitle = null;
            IList listKG = null;
            IList listPB = null;
            for (int i = 0; i < LP.ILow.Count; ++i)
            {
                pTT = (Ps_Table_TZGS)LP.ILow[i];
                VolatageClass = ReturnLowVoltageClass("b", pTT.Title);
                listKG = ReturnLowRows("d");//开关
                listPB = ReturnLowRows("c");//配变
                pTT1 = (Ps_Table_TZGS)listPB[i];
                pTT2 = (Ps_Table_TZGS)listKG[i];
                for (int j = 0; j < LowPressure.IntCount; ++j)
                {
                    if(j==0||j==1)
                    {
                        UnitTemp = strUnit + strUnit1;
                        PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                        PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT.Length.ToString());//
                        ReturnFabricationCost(LP.strType[j], VolatageClass);
                        if(LP.list!=null)
                        {
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                            obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                        }
                        obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 5, UnitTemp);
                    }
                    else if (j == 2 || j == 3 || j == 4)//开关站,箱式变电站,配电室
                    {
                        UnitTemp = strUnit + strUnit2;
                        obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 5, UnitTemp);
                    }
                    else if (j == 5 || j == 6 || j == 7)//环网柜,柱上变,电缆分支箱
                    {
                        UnitTemp = strUnit + strUnit3;
                        obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 5, UnitTemp);
                    }
                    if (j == LowPressure.IntCount-2||j==LowPressure.IntCount-1)//最后一行
                    {
                        for (int col = 2; col < obj.ColumnCount; ++col)
                        {
                            //obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), col,"kk");
                            obj.Cells[(IntRow + 1 + j + i * LowPressure.IntCount), col].Locked = false;//手写
                        }
                    }
                    if(j==LowPressure.IntCount-1)
                    {
                        //鼠标右键点击出现菜单

                    }

                    strTitle = (string)PF.ReturnStr(obj, (IntRow + 1 + j + i * LowPressure.IntCount), 1);
                    switch (strTitle)
                    {
                        case "开关站":
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT2.Num1.ToString());//
                            ReturnFabricationCostTitle("常规", VolatageClass, strTitle);
                            if (LP.list == null)
                            {
                                //MessageBox.Show(strTitle + "没有数据!!!");
                            }
                            else
                            {
                                PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                                obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                            }
                            break;
                        case "箱式变电站":
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT1.Num3.ToString());//
                            ReturnFabricationCostTitle("常规", VolatageClass, strTitle);
                            if (LP.list == null)
                            {
                                //MessageBox.Show(strTitle + "没有数据!!!");
                            }
                            else
                            {
                                PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                                obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                            }
                            break;
                        case "配电室":
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT1.Num1.ToString());//
                            ReturnFabricationCostTitle("常规", VolatageClass, strTitle);
                            if(LP.list==null)
                            {
                                //MessageBox.Show(strTitle + "没有数据!!!");
                            }else
                            {
                                PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                                obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                            }
                            break;
                        case "环网柜":
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT2.Num2.ToString());//
                            ReturnFabricationCostTitle("常规", VolatageClass, strTitle);
                            if (LP.list == null)
                            {
                                //MessageBox.Show(strTitle + "没有数据!!!");
                            }
                            else
                            {
                                PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                                obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                            }
                            break;
                        case "柱上变":
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT1.Num5.ToString());//
                            ReturnFabricationCostTitle("常规", VolatageClass, strTitle);
                            if (LP.list == null)
                            {
                                //MessageBox.Show(strTitle + "没有数据!!!");
                            }
                            else
                            {
                                PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                                obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                            }
                            break;
                        case "电缆分支箱":
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 2, VolatageClass);//
                            PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 3, pTT2.Num4.ToString());//
                            ReturnFabricationCostTitle("常规", VolatageClass, strTitle);
                            if (LP.list == null)
                            {
                                //MessageBox.Show(strTitle + "没有数据!!!");
                            }
                            else
                            {
                                PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + j + i * LowPressure.IntCount), 4, LP.list.Num.ToString());//
                                obj.SetValue((IntRow + 1 + j + i * LowPressure.IntCount), 6, LP.list.L4);
                            }
                            break;

                        default:
                            break;
                    }
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 写入高压数据
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="IntRow"></param>
        /// <param name="IntCol"></param>
        private void WriteHeightData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol)
        {
            int RowTemp = IntRow;
            double Amount = 0;
            IList list = null;
            Ps_Table_TZGS pTT = new Ps_Table_TZGS();
            Ps_Table_TZMX pTT1 = new Ps_Table_TZMX();
            //IList list = null;
            //list = SelectVoltageClass(FB, "新建");
            for (int i = 0; i < HP.INew.Count; i++)
            {
                pTT = (Ps_Table_TZGS)HP.INew[i];
                PF.CreateSheetView(obj, HP.INewVolume[i].Count, 1, RowTemp, 2, pTT.BianInfo);//新建
                list = HP.INewVolume[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    PF.CreateSheetView(obj, 1, 1, (RowTemp + j), 3, pTT1.Vol.ToString() + unit);//新建
                    Amount = ReturnAmount(pTT1, pTT, "sub");
                    obj.SetValue(RowTemp, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp,5,strUnit+unit);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
                if (HP.INewVolume[i].Count == 0)
                {
                    RowTemp += 1;
                }
                else
                {
                    RowTemp += HP.INewVolume[i].Count;
                }
            }
            //list = SelectVoltageClass(FB, "扩建");
            for (int i = 0; i < HP.IExtends.Count; i ++)
            {
                pTT = (Ps_Table_TZGS)HP.IExtends[i];
                PF.CreateSheetView(obj, HP.IExtendsVolume[i].Count, 1, RowTemp , 2, pTT.BianInfo);//扩建
                list = HP.IExtendsVolume[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    PF.CreateSheetView(obj, 1, 1, (RowTemp + j), 3, pTT1.Vol.ToString() + unit);//扩建

                    Amount = ReturnAmount(pTT1, pTT, "sub");
                    obj.SetValue(RowTemp, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + unit);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
                if (HP.IExtendsVolume[i].Count==0)
                {
                    RowTemp += 1;
                }
                else
                {
                    RowTemp += HP.IExtendsVolume[i].Count;
                }
            }
            //list = SelectVoltageClass(FB, "改造");
            for (int i = 0; i < HP.IRebuild.Count; i ++)
            {
                pTT = (Ps_Table_TZGS)HP.IRebuild[i];
                PF.CreateSheetView(obj, HP.IRebuildVolume[i].Count, 1, RowTemp , 2, pTT.BianInfo);//改造
                list = HP.IRebuildVolume[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    PF.CreateSheetView(obj, 1, 1, (RowTemp + j), 3, pTT1.Vol.ToString() + unit);//改造

                    Amount = ReturnAmount(pTT1, pTT, "sub");
                    obj.SetValue(RowTemp, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + unit);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
                if (HP.IRebuildVolume[i].Count==0)
                {
                    RowTemp += 1;
                }
                else
                {
                    RowTemp += HP.IRebuildVolume[i].Count;
                }
            }
            //架空线路
            for(int i=0;i<HP.INew.Count;++i)
            {
                pTT = (Ps_Table_TZGS)HP.INew[i];
                ////if (HP.Length[i].Count == 0 || HP.Length[i] == null)
                ////{
                ////    intTemp = 1;
                ////}
                ////else
                ////{
                ////    intTemp = HP.Length[i].Count;
                ////}

                PF.CreateSheetView(obj, 1, 1, RowTemp +i, 2, pTT.BianInfo);//新建架空电压等级
                PF.CreateSheetView(obj, 1, 1, RowTemp+i, 3, pTT.Length.ToString());//新建架空线路
                list = HP.Length[i];
                for (int j = 0; j < list.Count;++j )
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    Amount = ReturnAmount(pTT1, pTT, "line");
                    obj.SetValue(RowTemp + i, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + strUnit1);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }

            }
            RowTemp += HP.INew.Count;
            //新建电缆线路
            for(int i=0;i<HP.INew.Count;++i)
            {
                pTT = (Ps_Table_TZGS)HP.INew[i];
                ////if (HP.Length[i].Count == 0 || HP.Length[i] == null)
                ////{
                ////    intTemp = 1;
                ////}
                ////else
                ////{
                ////    intTemp = HP.Length[i].Count;
                ////}
                PF.CreateSheetView(obj, 1, 1, RowTemp+i , 2, pTT.BianInfo);//新建电缆电压等级
                PF.CreateSheetView(obj, 1, 1, RowTemp+i, 3, pTT.Length2.ToString());//新建电缆线路
                list = HP.Length[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];

                    Amount = ReturnAmount(pTT1, pTT, "line");

                    obj.SetValue(RowTemp + i, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + strUnit1);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
            }
            RowTemp += HP.INew.Count;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 左侧标题
 /// </summary>
 private void SetLeftTitle(FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol)
 {
     PF.CreateSheetView(obj, HP.RowsCount, 1, IntRow, 0, "高压配电网");
     PF.CreateSheetView(obj, LP.RowsCount, 1, (IntRow + HP.RowsCount), 0, "中低压配电网");
     PF.CreateSheetView(obj, 1, 1, (IntRow + HP.RowsCount + LP.RowsCount), 0, "其它");
     /*高压部分*******************************************************************************************/
     PF.CreateSheetView(obj, HP.Volume[0], 1, IntRow, 1, HP.strTitle[0]);//新建
         PF.CreateSheetView(obj, HP.Volume[1], 1, IntRow += HP.Volume[0], 1, HP.strTitle[1]);//扩建
         PF.CreateSheetView(obj, HP.Volume[2], 1, IntRow += HP.Volume[1], 1, HP.strTitle[2]);//改造
         PF.CreateSheetView(obj, HP.INew.Count, 1, IntRow += HP.Volume[2], 1, HP.strTitle[3]);//新建架空
         PF.CreateSheetView(obj, HP.INew.Count, 1, IntRow += HP.INew.Count, 1, HP.strTitle[4]);//新建电缆
     /* ********************************************************************************************************************** */
     /** 低压部分***********************************************************************************************************/
         Ps_Table_TZGS pTT = new Ps_Table_TZGS();
     for(int i=0;i<LP.ILow.Count;++i)
     {
         pTT = (Ps_Table_TZGS)LP.ILow[i];
         for(int j=0;j<LowPressure.IntCount;++j)
         {
             if(j==0)
             {
                 PF.CreateSheetView(obj, 1, obj.ColumnCount, (5+HP.RowsCount  + j + i * LowPressure.IntCount), 1, pTT.Title);//标题
             }
             else
             {
                 PF.CreateSheetView(obj, 1, 1, (5 + HP.RowsCount + j + i * LowPressure.IntCount), 1, LP.strTitle[j - 1]);//
             }
         }
     }
 }
Ejemplo n.º 15
0
        private void barButtonItem9_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")
            {
                MsgBox.Show("此分类不是总分类!");
                return;
            }

            if (MsgBox.ShowYesNo("总分类及其下属分类都将删除,是否删除总分类 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {
                Ps_Table_TZGS table1 = new Ps_Table_TZGS();
                // Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode);
                table1.ID = treeList1.FocusedNode.GetValue("ID").ToString();
                DelAll(table1.ID);
                try
                {
                    //DeletePSP_ValuesByType里面删除数据和分类
                    Common.Services.BaseService.Delete<Ps_Table_TZGS>(table1);//("DeletePs_Table_TZGS", table1);

                    treeList1.DeleteNode(treeList1.FocusedNode);
                    //treeList1.ExpandAll();
                    //删除后,如果同级还有其它分类,则重新计算此类的所有年份数据

                }
                catch (Exception ex)
                {
                    //MsgBox.Show("删除出错:" + ex.Message);
                    this.Cursor = Cursors.WaitCursor;
                    treeList1.BeginUpdate();
                    LoadData();
                    treeList1.EndUpdate();
                    this.Cursor = Cursors.Default;
                }
            }
        }
Ejemplo n.º 16
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmAddTzgsAHTL frm = new FrmAddTzgsAHTL();
            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;

                table.AllVolumn = frm.Amount;
                //  table1.BefVolumn = frm.AllVol;
                //table.AftVolumn = frm.LineVol + frm.BianVol;

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

                //用y1990存放线路长度
                table.y1990 = frm.LineLen + frm.LineLen2;

                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;
                t1.AllVolumn = frm.Amount;
                //  table1.BefVolumn = frm.AllVol;
                //t1.AftVolumn = frm.BianVol;
                t1.y1990 = 0;

                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;
                t2.AllVolumn = frm.Amount;
                //  table1.BefVolumn = frm.AllVol;
                //t2.AftVolumn = frm.LineVol;
                t2.y1990 = frm.LineLen + frm.LineLen2;

                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 { }
            }
        }
Ejemplo n.º 17
0
 public void AddTotalRow(ref IList list)
 {
     //合计
     string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";
     int[] year = GetYears();
     Ps_Table_TZGS parent = new Ps_Table_TZGS();
     parent.ID += "|" + GetProjectID;
     parent.ParentID = "0"; parent.Title = "合计"; parent.Sort = 10000;// OperTable.GetMaxSort() + 1;
     //
     IList<Ps_Table_TZGS> teList = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", conn);
     double old=0.0,te=0.0;
     for (int i = 0; i < teList.Count; i++)
     {
         parent.AllVolumn += teList[i].AllVolumn;
         parent.BefVolumn += teList[i].BefVolumn;
         parent.AftVolumn += teList[i].AftVolumn;
         for (int j = yAnge.StartYear + 1; j <= yAnge.StartYear + 5; j++)
         {
             old=double.Parse(parent.GetType().GetProperty("y"+j.ToString()).GetValue(parent,null).ToString());
             te = double.Parse(teList[i].GetType().GetProperty("y"+j.ToString()).GetValue(teList[i],null).ToString());
             parent.GetType().GetProperty("y" + j.ToString()).SetValue(parent, old + te, null);
         }
     }
     list.Add(parent);
 }
Ejemplo n.º 18
0
 private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (FocusedObject == null) return;
     if (!base.DeleteRight)
     {
         MsgBox.Show("您没有权限进行此项操作!");
         return;
     }
     if (MsgBox.ShowYesNo("是否删除选中的工程?") == DialogResult.Yes)
     {
         Ps_Table_TZGS table1 = new Ps_Table_TZGS();
         table1.ID = FocusedObject.ID;
         Services.BaseService.Update("DeletePs_Table_TZGS", table1);
     }
     LoadData();
 }
Ejemplo n.º 19
0
 public void DelAll(string suid)
 {
     string conn = "ParentId='" + suid + "'";
     IList<Ps_Table_TZGS> list = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", conn);
     if (list.Count > 0)
     {
         foreach (Ps_Table_TZGS var in list)
         {
             string child = var.ID;
             DelAll(child);
             Ps_Table_TZGS ny = new Ps_Table_TZGS();
             ny.ID = child;
             Common.Services.BaseService.Delete(ny);
         }
     }
     else
         return;
 }
Ejemplo n.º 20
0
        public void RefreshData()
        {
            string n = "";
            string conn = "ProjectID='" + GetProjectID + "'  and ID not in (Select FromID from Ps_Table_TZGS where ProjectID = '" + GetProjectID + "')";
            IList<Ps_Table_BuildPro> list = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn);
            Ps_Table_TZGS pare110 = GetTZGSParent("110");
            Ps_Table_TZGS pare220 = GetTZGSParent("220");
            Ps_Table_TZGS pare500 = GetTZGSParent("500");

            for (int i = 0; i < list.Count; i++)
            {
                n = "";
                Ps_Table_BuildPro table = list[i];
               // if (list[i].Col4 == OperTable.ph110)
               // {
                    if (table != null)
                    {
                        Ps_Table_TZGS tzgs = new Ps_Table_TZGS();
                        tzgs.ID = table.ID;
                        tzgs.FromID = table.ID;
                        tzgs.ProjectID = GetProjectID;
                        tzgs.ParentID = table.ParentID;
                        tzgs.Sort = table.Sort;
                        tzgs.Title = table.Title;// +"工程";
                        tzgs.BuildYear = list[i].BuildYear;
                        tzgs.BuildEd = list[i].BuildEd;
                        tzgs.Volumn = list[i].Volumn;
                        tzgs.Col3 = list[i].Col3;
                        tzgs.AftVolumn = list[i].AftVolumn;
                        tzgs.Length = list[i].Length;
                        tzgs.BianInfo = list[i].BianInfo;
                        tzgs.AllVolumn = list[i].AllVolumn;
                        tzgs.Col1 = list[i].Col1;
                        tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null);
                        if (pare110 != null && table.ParentID==pare110.ID)
                        {
                            pare110.AftVolumn += tzgs.AftVolumn;
                            pare110.AllVolumn += tzgs.AllVolumn;
                            pare110.Length += tzgs.Length;
                            pare110.Volumn += tzgs.Volumn;
                            pare110.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare110, double.Parse(pare110.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare110, null).ToString()) + tzgs.AllVolumn, null);
                            Common.Services.BaseService.Update<Ps_Table_TZGS>(pare110);
                        }
                        else if (pare220 != null && table.ParentID == pare220.ID)
                        {
                            pare220.AftVolumn += tzgs.AftVolumn;
                            pare220.AllVolumn += tzgs.AllVolumn;
                            pare220.Length += tzgs.Length;
                            pare220.Volumn += tzgs.Volumn;
                            pare220.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare220, double.Parse(pare220.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare220, null).ToString()) + tzgs.AllVolumn, null);
                            Common.Services.BaseService.Update<Ps_Table_TZGS>(pare220);
                        }
                        else if (pare500 != null && table.ParentID == pare500.ID)
                        {
                            pare500.AftVolumn += tzgs.AftVolumn;
                            pare500.AllVolumn += tzgs.AllVolumn;
                            pare500.Length += tzgs.Length;
                            pare500.Volumn += tzgs.Volumn;
                            pare500.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare500, double.Parse(pare500.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare500, null).ToString()) + tzgs.AllVolumn, null);
                            Common.Services.BaseService.Update<Ps_Table_TZGS>(pare500);

                        }
                        //  Common.Services.BaseService.Update<Ps_Table_TZGS>(pare);
                        Common.Services.BaseService.Create<Ps_Table_TZGS>(tzgs);
                    }
               // }

            }
            if (pare110 == null)
            {
                pare110 = GetTZGSParent("110");
                if (pare110 != null)
                {
                    pare110.AllVolumn = 0;
                    pare110.AftVolumn = 0;
                    conn = "ProjectID='" + GetProjectID + "'  and ParentID = '"+pare110.ID+"'";
                    IList<Ps_Table_BuildPro> listt = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn);
                    foreach (Ps_Table_BuildPro t in listt)
                    {
                        pare110.AftVolumn += t.AftVolumn;
                        pare110.AllVolumn += t.AllVolumn;
                    }
                    pare110.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare110, pare110.AllVolumn, null);

                }
                Common.Services.BaseService.Update<Ps_Table_TZGS>(pare110);
            }
            if (pare220 == null)
            {
                pare220 = GetTZGSParent("220");
                if (pare110 != null)
                {
                    pare220.AllVolumn = 0;
                    pare220.AftVolumn = 0;
                    conn = "ProjectID='" + GetProjectID + "'  and ParentID = '" + pare220.ID + "'";
                    IList<Ps_Table_BuildPro> listt = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn);
                    foreach (Ps_Table_BuildPro t in listt)
                    {
                        pare220.AftVolumn += t.AftVolumn;
                        pare220.AllVolumn += t.AllVolumn;
                    }
                    pare220.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare220, pare220.AllVolumn, null);
                }
                Common.Services.BaseService.Update<Ps_Table_TZGS>(pare220);
            }
            if (pare500 == null)
            {
                pare500 = GetTZGSParent("500");
                if (pare500 != null)
                {
                    pare500.AllVolumn = 0;
                    pare500.AftVolumn = 0;
                    conn = "ProjectID='" + GetProjectID + "'  and ParentID = '" + pare500.ID + "'";
                    IList<Ps_Table_BuildPro> listt = Common.Services.BaseService.GetList<Ps_Table_BuildPro>("SelectPs_Table_BuildProByConn", conn);
                    foreach (Ps_Table_BuildPro t in listt)
                    {
                        pare500.AftVolumn += t.AftVolumn;
                        pare500.AllVolumn += t.AllVolumn;
                    }
                    pare500.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare500, pare500.AllVolumn, null);
                }
                Common.Services.BaseService.Update<Ps_Table_TZGS>(pare500);
            }
            LoadData1();
            //string con = "ProjectID='" + GetProjectID + "'";
            //IList<Ps_Table_TZGS> list2 = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", con);
            //for (int i = 0; i < list1.Count; i++)
            //{
            //    for (int j = 0; j < list2.Count; j++)
            //    {

            //    }
            //}
        }
Ejemplo n.º 21
0
        public void RefreshData()
        {
            string n = "";
            string conn = "ProjectID='" + GetProjectID + "' and Status!='拆除' and FinishYear>'" + Convert.ToString(yAnge.StartYear) + "' and FinishYear<'" + Convert.ToString(yAnge.StartYear + 6) + "' and (Col4='" + OperTable.ph110 + "' or Col4='" + OperTable.ph220 + "' or Col4='" + OperTable.ph500 + "') and ParentID not in (Select FromID from Ps_Table_TZGS where ProjectID = '" + GetProjectID + "')";
            IList<Ps_Table_Edit> list = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
            for (int i = 0; i < list.Count; i++)
            {
                n = "";
                if (list[i].Col4 == OperTable.ph110)
                {
                    Ps_Table_100PH table = Common.Services.BaseService.GetOneByKey<Ps_Table_100PH>(list[i].ParentID);
                    if (table != null)
                    {
                        Ps_Table_TZGS pare = new Ps_Table_TZGS();
                        pare = GetTZGSParent("110");
                        Ps_Table_TZGS tzgs = new Ps_Table_TZGS();
                        if (pare != null)
                            tzgs.ParentID = pare.ID;
                        else
                        {
                            pare = new Ps_Table_TZGS();
                            pare.ID += "|" + GetProjectID;
                            pare.Col2 = "110";
                            pare.Title = "110千伏送变电工程";
                            pare.ParentID = "0";
                            pare.ProjectID = GetProjectID;
                            pare.Sort = 2;
                            Common.Services.BaseService.Create<Ps_Table_TZGS>(pare);
                            tzgs.ParentID = pare.ID;
                        }
                        tzgs.ID += "|" + GetProjectID;
                        tzgs.FromID = table.ID;
                        tzgs.ProjectID = GetProjectID;
                        tzgs.Sort = OperTable.GetTZGSMaxSort() + 1;
                        tzgs.Title = table.Title+"工程";
                        tzgs.BuildYear = list[i].StartYear;
                        tzgs.BuildEd = list[i].FinishYear;
                        tzgs.Volumn = double.Parse(list[i].Volume);
                        tzgs.Col3 = list[i].Status;
                        tzgs.AftVolumn = GetBianQ(double.Parse(list[i].Volume), list[i].Status, "110",ref n);
                        tzgs.BianInfo = n;
                        tzgs.AllVolumn = tzgs.AftVolumn;
                        tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null);
                        pare.AftVolumn += tzgs.AftVolumn;
                        pare.AllVolumn += tzgs.AllVolumn;
                        pare.Length += tzgs.Length;
                        pare.Volumn += tzgs.Volumn;
                        pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare, double.Parse(pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare, null).ToString()) + tzgs.AllVolumn, null);
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(pare);
                        Common.Services.BaseService.Create<Ps_Table_TZGS>(tzgs);
                    }
                }
                else if (list[i].Col4 == OperTable.ph220)
                {
                    Ps_Table_200PH table = Common.Services.BaseService.GetOneByKey<Ps_Table_200PH>(list[i].ParentID);
                    if (table != null)
                    {
                        Ps_Table_TZGS pare = new Ps_Table_TZGS();
                        pare = GetTZGSParent("220");
                        Ps_Table_TZGS tzgs = new Ps_Table_TZGS();
                        if (pare != null)
                            tzgs.ParentID = pare.ID;
                        else
                        {
                            pare = new Ps_Table_TZGS();
                            pare.ID += "|" + GetProjectID;
                            pare.Col2 = "220";
                            pare.Title = "220千伏送变电工程";
                            pare.ParentID = "0";
                            pare.ProjectID = GetProjectID;
                            pare.Sort = 1;
                            Common.Services.BaseService.Create<Ps_Table_TZGS>(pare);
                            tzgs.ParentID = pare.ID;
                        }
                        tzgs.ID += "|" + GetProjectID;
                        tzgs.FromID = table.ID;
                        tzgs.ProjectID = GetProjectID;
                        tzgs.Sort = OperTable.GetTZGSMaxSort() + 1;
                        tzgs.Title = table.Title + "工程";
                        tzgs.BuildYear = list[i].StartYear;
                        tzgs.BuildEd = list[i].FinishYear;
                        tzgs.Volumn = double.Parse(list[i].Volume);
                        tzgs.Col3 = list[i].Status;
                        tzgs.AftVolumn = GetBianQ(double.Parse(list[i].Volume), list[i].Status, "220",ref n);
                        tzgs.AllVolumn = tzgs.AftVolumn;
                        tzgs.BianInfo = n;
                        tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null);
                        pare.AftVolumn += tzgs.AftVolumn;
                        pare.AllVolumn += tzgs.AllVolumn;
                        pare.Length += tzgs.Length;
                        pare.Volumn += tzgs.Volumn;
                        pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare, double.Parse(pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare, null).ToString()) + tzgs.AllVolumn, null);
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(pare);
                        Common.Services.BaseService.Create<Ps_Table_TZGS>(tzgs);
                    }
                }
                else if (list[i].Col4 == OperTable.ph500)
                {
                    Ps_Table_500PH table = Common.Services.BaseService.GetOneByKey<Ps_Table_500PH>(list[i].ParentID);
                    if (table != null)
                    {
                        Ps_Table_TZGS pare = new Ps_Table_TZGS();
                        pare = GetTZGSParent("500");
                        Ps_Table_TZGS tzgs = new Ps_Table_TZGS();
                        if (pare != null)
                            tzgs.ParentID = pare.ID;
                        else
                        {
                            pare = new Ps_Table_TZGS();
                            pare.ID += "|" + GetProjectID;
                            pare.Col2 = "500";
                            pare.Title = "500千伏送变电工程";
                            pare.ParentID = "0";
                            pare.ProjectID = GetProjectID;
                            pare.Sort = 0;
                            Common.Services.BaseService.Create<Ps_Table_TZGS>(pare);
                            tzgs.ParentID = pare.ID;
                        }
                        tzgs.ID += "|" + GetProjectID;
                        tzgs.FromID = table.ID;
                        tzgs.ProjectID = GetProjectID;
                        tzgs.Sort = OperTable.GetTZGSMaxSort()+1;
                        tzgs.Title = table.Title + "工程";
                        tzgs.BuildYear = list[i].StartYear;
                        tzgs.BuildEd = list[i].FinishYear;
                        tzgs.Volumn = double.Parse(list[i].Volume);
                        tzgs.Col3 = list[i].Status;
                        tzgs.AftVolumn = GetBianQ(double.Parse(list[i].Volume), list[i].Status, "500",ref n);
                        tzgs.AllVolumn = tzgs.AftVolumn;
                        tzgs.BianInfo = n;
                        tzgs.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(tzgs, tzgs.AllVolumn, null);
                        pare.AftVolumn += tzgs.AftVolumn;
                        pare.AllVolumn += tzgs.AllVolumn;
                        pare.Length += tzgs.Length;
                        pare.Volumn += tzgs.Volumn;
                        pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).SetValue(pare, double.Parse(pare.GetType().GetProperty("y" + Convert.ToString(yAnge.StartYear + 1)).GetValue(pare,null).ToString())+tzgs.AllVolumn, null);
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(pare);
                        Common.Services.BaseService.Create<Ps_Table_TZGS>(tzgs);
                    }
                }
            }
            LoadData1();
            //string con = "ProjectID='" + GetProjectID + "'";
            //IList<Ps_Table_TZGS> list2 = Common.Services.BaseService.GetList<Ps_Table_TZGS>("SelectPs_Table_TZGSByConn", con);
            //for (int i = 0; i < list1.Count; i++)
            //{
            //    for (int j = 0; j < list2.Count; j++)
            //    {

            //    }
            //}
        }
Ejemplo n.º 22
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
            {
                FrmAddTzgs frm = new FrmAddTzgs();
                Ps_Table_TZGS table = new Ps_Table_TZGS();
                table = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(treeList1.FocusedNode.GetValue("ID"));
                frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString();
                frm.Text = "修改工程";
                frm.Stat = treeList1.FocusedNode.ParentNode.GetValue("Col2").ToString();
                frm.BianInfo = table.BianInfo;
                frm.LineInfo = table.LineInfo;
                frm.StartYear = table.BuildYear;
                frm.FinishYear = table.BuildEd;
                frm.LineLen = table.Length;
                frm.BieZhu = table.Col1;
                frm.Col3 = table.Col3;
                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.BianInfo = frm.BianInfo;
                    table.LineInfo = frm.LineInfo;
                    try
                    {
                        Common.Services.BaseService.Update<Ps_Table_TZGS>(table);
                        AddChildVol(table, true);
                        LoadData1();
                        FoucsLocation(table.ID, treeList1.Nodes);
                    }
                    catch { }
                }
            }
        }
Ejemplo n.º 23
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;
            }

            FrmAddTzgs frm = new FrmAddTzgs();
            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.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;
                try
                {
                    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);
                }
            }
        }
Ejemplo n.º 24
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            if (!base.DeleteRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            string nodestr = treeList1.FocusedNode.GetValue("Col1").ToString();

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

            if (treeList1.FocusedNode.HasChildren)
            {
                MsgBox.Show("此工程下有子工程,请先删除子工程!");
                return;
            }
            if (treeList1.FocusedNode.GetValue("ParentID").ToString() == "0")
            {
                MsgBox.Show("此工程是分类,请用“删除分类”功能!");
                return;
            }
            if (MsgBox.ShowYesNo("是否删除工程 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes)
            {
                Ps_Table_TZGS table1 = new Ps_Table_TZGS();
               // Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode);
                table1.ID = treeList1.FocusedNode.GetValue("ID").ToString();

                try
                {
                    //DeletePSP_ValuesByType里面删除数据和分类
                    TreeListNode node1 = treeList1.FocusedNode.NextNode;
                    string teID = "";
                    if (node1 != null)
                        teID = node1.GetValue("ID").ToString();
                    AddChildVol(Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(table1.ID), false);
                    Common.Services.BaseService.Delete <Ps_Table_TZGS>(table1);//("DeletePs_Table_TZGS", table1);
                    treeList1.DeleteNode(treeList1.FocusedNode);
                    LoadData1();
                    FoucsLocation(teID, treeList1.Nodes);
                }
                catch (Exception ex)
                {
                    //MsgBox.Show("删除出错:" + ex.Message);
                    this.Cursor = Cursors.WaitCursor;
                    treeList1.BeginUpdate();
                    LoadData();
                    treeList1.EndUpdate();
                    this.Cursor = Cursors.Default;
                }
            }
        }
Ejemplo n.º 25
0
        public void InitSelectBox()
        {
            //IList list = Common.Services.BaseService.GetList("SelectPs_Table_TZGSByConn", "ProjectID='"+ProjectID+"' and ParentID='0' and Col4='bian'");

            //int x=10;
            //for (int i = 0; i < list.Count; i++)
            //{
            //    Ps_Table_TZGS tzgs=list[i] as Ps_Table_TZGS;
            //    CheckBox box = new CheckBox();
            //    box.Text = tzgs.FromID + "kV";

            //    box.Tag = tzgs;
            //    box.Checked = true;
            //    box.Size = new Size(60, 18);
            //    groupControl1.Controls.Add(box);
            //    box.Location = new Point(x + 100 * i, 35);
            //}
            //if (list.Count == 0)
            //    simpleButton4.Enabled = false;

            IList list = Common.Services.BaseService.GetList("SelectPs_Table_TZGSByConn", "ProjectID='" + ProjectID + "' and ParentID='0' ");

            DataTable dt = Itop.Common.DataConverter.ToDataTable((IList)list, typeof(Ps_Table_TZGS));

            IList listrust = new List<Ps_Table_TZGS>();
            int dy=500;
            DataRow[] dtrow500 = dt.Select(" FromID='" + dy + "'");
            dy = 220;
            DataRow[] dtrow220 = dt.Select(" FromID='" + dy + "'");
            dy = 110;
            DataRow[] dtrow110 = dt.Select(" FromID='" + dy + "'");

            if (dtrow500.Length>0)
            {
                Ps_Table_TZGS tzgs500 = new Ps_Table_TZGS();
                 tzgs500.FromID = "500";
                 for (int j = 1990; j < 2061; j++)
                 {

                     foreach (DataRow row in dtrow500)
                     {
                         double tempdb = double.Parse(tzgs500.GetType().GetProperty("y" + j).GetValue(tzgs500, null).ToString());
                         double tempdb2=double.Parse(row["y"+j].ToString());
                         tzgs500.GetType().GetProperty("y" + j).SetValue(tzgs500, tempdb + tempdb2, null);
                     }

                 }

                listrust.Add(tzgs500);
            }

            if (dtrow220.Length>0)
            {
                Ps_Table_TZGS tzgs220 = new Ps_Table_TZGS();
                tzgs220.FromID = "220";
                for (int j = 1990; j < 2061; j++)
                {

                    foreach (DataRow row in dtrow220)
                    {
                        double tempdb = double.Parse(tzgs220.GetType().GetProperty("y" + j).GetValue(tzgs220, null).ToString());
                        double tempdb2 = double.Parse(row["y" + j].ToString());
                        tzgs220.GetType().GetProperty("y" + j).SetValue(tzgs220, tempdb + tempdb2, null);
                    }

                }

                listrust.Add(tzgs220);
            }

            if (dtrow110.Length>0)
            {
                Ps_Table_TZGS tzgs110 = new Ps_Table_TZGS();
                tzgs110.FromID = "110";
                for (int j = 1990; j < 2061; j++)
                {

                    foreach (DataRow row in dtrow110)
                    {
                        double tempdb = double.Parse(tzgs110.GetType().GetProperty("y" + j).GetValue(tzgs110, null).ToString());
                        double tempdb2 = double.Parse(row["y" + j].ToString());
                        tzgs110.GetType().GetProperty("y" + j).SetValue(tzgs110, tempdb + tempdb2, null);
                    }

                }

                listrust.Add(tzgs110);
            }
            int x = 10;
            for (int i = 0; i < listrust.Count; i++)
            {
                Ps_Table_TZGS tzgs = listrust[i] as Ps_Table_TZGS;
                CheckBox box = new CheckBox();
                box.Text = tzgs.FromID + "kV";

                box.Tag = tzgs;
                box.Checked = true;
                box.Size = new Size(60, 18);
                groupControl1.Controls.Add(box);
                box.Location = new Point(x + 100 * i, 35);
            }
            if (list.Count == 0)
                simpleButton4.Enabled = false;
        }
Ejemplo n.º 26
0
 /// <summary>
 /// 返回单位工程综合造价
 /// </summary>
 /// <param name="pTT1"></param>
 /// <returns></returns>
 private double ReturnAmount(Ps_Table_TZMX pTT1, Ps_Table_TZGS pTT,string Typeqf)
 {
     string strTemp = null;
     int beginYear = 0;
     int EndYear = 0;
     int.TryParse(pTT1.BuildYear, out beginYear);
     int.TryParse(pTT1.BuildEnd, out EndYear);
     strTemp = null;
     for (int k = beginYear; k <= EndYear; ++k)
     {
         if (k == EndYear)
             strTemp += "y" + k;
         else
             strTemp += "y" + k + "+";
     }
     return  SelectAmount(strTemp, pTT.ID, "sub");
 }