Пример #1
0
 private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     //if (this.treeList1.FocusedNode != null)
     //{
     //    string nTitle = this.treeList1.FocusedNode.GetValue("Title").ToString();
     //    string nId = this.treeList1.FocusedNode.GetValue("Col1").ToString();
     //    if (nTitle == "一、110千伏以下负荷" && nId == "1")
     //    {
     //        Ps_Table_220Result psr = Common.Services.BaseService.GetOneByKey<Ps_Table_220Result>(this.treeList1.FocusedNode.GetValue("ID").ToString());
     //        Ps_Table_220Result old = (Ps_Table_220Result)psr.Clone();
     //        FormLoadForecastData frm = new FormLoadForecastData();
     //        frm.ProjectUID = GetProjectID;
     //        if (frm.ShowDialog() == DialogResult.OK)
     //        {
     //            FrmFKbi fkb = new FrmFKbi();
     //            if (fkb.ShowDialog() == DialogResult.OK)
     //            {
     //                DataRow row = frm.ROW;
     //                for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
     //                {
     //                    psr.GetType().GetProperty("yk" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 1), null);
     //                    psr.GetType().GetProperty("yf" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()) * fkb.GetVal, 1), null);
     //                }
     //                Common.Services.BaseService.Update<Ps_Table_220Result>(psr);
     //                UpdateFuHe(psr.ParentID, "no", old, psr);
     //                LoadData1();
     //            }
     //        }
     //    }
     //    else
     //    {
     //        MessageBox.Show("不是正确的负荷数据行,请选择正确的行!");
     //    }
     //}
     //else
     //{
     //    MessageBox.Show("请选择要导入的负荷数据行!");
     //}
     string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";
     IList cList = Common.Services.BaseService.GetList("SelectPs_Table_220ResultByConn", conn);
     if (cList.Count > 0)
     {
         FrmImportSel frm1 = new FrmImportSel();
         frm1.BindList = cList;
         if (frm1.ShowDialog() == DialogResult.OK)
         {
             FormLoadForecastData frm = new FormLoadForecastData();
             frm.ProjectUID = GetProjectID;
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 FrmFKbi fkb = new FrmFKbi();
                 if (fkb.ShowDialog() == DialogResult.OK)
                 {
                     DataRow row = frm.ROW;
                     foreach (string str in frm1.OutList)
                     {
                         IList tempList = Common.Services.BaseService.GetList("SelectPs_Table_220ResultByConn", "ParentID='" + str + "' and ProjectID='" + GetProjectID + "' and Col1='1' and Title='一、110千伏以下负荷'");
                         if (tempList.Count > 0)
                         {
                             Ps_Table_220Result psr = tempList[0] as Ps_Table_220Result;
                             Ps_Table_220Result old = (Ps_Table_220Result)psr.Clone();
                             for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                             {
                                 psr.GetType().GetProperty("yk" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 1), null);
                                 psr.GetType().GetProperty("yf" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()) * fkb.GetVal, 1), null);
                             }
                             Common.Services.BaseService.Update<Ps_Table_220Result>(psr);
                             UpdateFuHe(psr.ParentID, "no", old, psr);
                         }
                     }
                     LoadData1();
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("没有数据!");
     }
 }
Пример #2
0
        //载入负荷数据
        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string tempID = treeList1.FocusedNode.GetValue("ID").ToString();
            string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";
            IList cList = Common.Services.BaseService.GetList("SelectPs_Table_100PHListByConn", conn);
            if (cList.Count > 0)
            {
                FrmImportSellgm frm1 = new FrmImportSellgm();
                frm1.checkEdit1.Visible = false;
                frm1.BindList = cList;
                if (frm1.ShowDialog() == DialogResult.OK)
                {

                    FormLoadForecastData frm = new FormLoadForecastData();
                    frm.ProjectUID = GetProjectID;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        if (frm.ROW["Title"].ToString() != frm1.OutList[1].ToString())
                        {
                            MessageBox.Show("您所选数据与要更新区域数据不匹配!");
                            return;
                        }
                        FrmFKbi fkb = new FrmFKbi();
                        if (fkb.ShowDialog() == DialogResult.OK)
                        {
                            DataRow row = frm.ROW;

                            foreach (string str in frm1.OutList)
                            {
                                IList tempList = Common.Services.BaseService.GetList("SelectPs_Table_100PHListByConn", "ParentID='" + str + "' and ProjectID='" + GetProjectID + "' and Sort=1 and Title like '分区综合最高负荷%'");
                                if (tempList.Count > 0)
                                {
                                    Ps_Table_100PH psr = tempList[0] as Ps_Table_100PH;
                                    //old为psr副本
                                    Ps_Table_100PH old = (Ps_Table_100PH)psr.Clone();
                                    //判断当前数据库中存放的是丰值还是估值,或者从没导入过数据
                                    if (FKflag == "无值" || FKflag=="F")
                                    {
                                        //按丰值存入
                                        for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                                        {
                                            psr.GetType().GetProperty("y" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 2), null);
                                            //psr.GetType().GetProperty("yf" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()) * fkb.GetVal, 1), null);
                                        }
                                        psr.BuildYear = fkb.GetVal.ToString();
                                        psr.Title = "分区综合最高负荷(丰)";
                                        psr.Col3 = "F";
                                    }
                                    else
                                    {
                                        //按枯值存入
                                        for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                                        {
                                            //psr.GetType().GetProperty("y" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 1), null);
                                            psr.GetType().GetProperty("y" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()) * fkb.GetVal, 2), null);
                                        }
                                        psr.BuildYear = fkb.GetVal.ToString();
                                        psr.Title = "分区综合最高负荷(枯)";
                                        psr.Col3 = "K";
                                    }
                                    Common.Services.BaseService.Update<Ps_Table_100PH>(psr);
                                    DataChange(psr.Sort, psr.ID, psr.ParentID);
                                    //UpdateFuHe(psr.ParentID, "no", old, psr);
                                }
                            }
                            LoadData();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("没有数据!");
            }
            FoucsLocation(tempID, treeList1.Nodes);
        }
Пример #3
0
 private void barButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     // string conn = "ProjectID='"+GetProjectID+"' and Col1='1' and ParentID in (Select ID from Ps_Table_35Result where ParentID='0')";
     //  IList list = Common.Services.BaseService.GetList("SelectPs_Table_35ResultByConn", conn);
     if (this.treeList1.FocusedNode != null)
     {
         string nTitle = this.treeList1.FocusedNode.GetValue("Title").ToString();
         string nId = this.treeList1.FocusedNode.GetValue("Col1").ToString();
         if (nTitle == "一、负荷" && nId == "1")
         {
             Ps_Table_35Result psr = Common.Services.BaseService.GetOneByKey<Ps_Table_35Result>(this.treeList1.FocusedNode.GetValue("ID").ToString());
             Ps_Table_35Result old = (Ps_Table_35Result)psr.Clone();
             FormLoadForecastData frm = new FormLoadForecastData();
             frm.ProjectUID = GetProjectID;
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 FrmFKbi fkb = new FrmFKbi();
                 if (fkb.ShowDialog() == DialogResult.OK)
                 {
                     DataRow row = frm.ROW;
                     for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                     {
                         psr.GetType().GetProperty("yk" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()),2), null);
                         psr.GetType().GetProperty("yf" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString())*fkb.GetVal,2), null);
                     }
                     Common.Services.BaseService.Update<Ps_Table_35Result>(psr);
                     UpdateFuHe(psr.ParentID, "no", old, psr);
                     LoadData1();
                 }
             }
         }
         else
         {
             MessageBox.Show("不是正确的负荷数据行!");
         }
     }
     else
     {
         MessageBox.Show("请选择要导入的负荷数据行!");
     }
 }
Пример #4
0
 private void barButtonItem15_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (this.treeList1.FocusedNode != null)
     {
         string nTitle = this.treeList1.FocusedNode.GetValue("Title").ToString();
         string nId = this.treeList1.FocusedNode.GetValue("Col1").ToString();
         if (nTitle == "地区最大负荷" && nId == "1")
         {
             Ps_Table_ElecPH psr = Common.Services.BaseService.GetOneByKey<Ps_Table_ElecPH>(this.treeList1.FocusedNode.GetValue("ID").ToString());
             Ps_Table_ElecPH old = (Ps_Table_ElecPH)psr.Clone();
             FormLoadForecastData frm = new FormLoadForecastData();
             frm.ProjectUID = GetProjectID;
             if (frm.ShowDialog() == DialogResult.OK)
             {
                // FrmFKbi fkb = new FrmFKbi();
               //  if (fkb.ShowDialog() == DialogResult.OK)
                 {
                     DataRow row = frm.ROW;
                     for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++)
                     {
                         psr.GetType().GetProperty("y" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 1), null);
                        // psr.GetType().GetProperty("y" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()) * fkb.GetVal, 1), null);
                     }
                     Common.Services.BaseService.Update<Ps_Table_500Result>(psr);
                     UpdateFuHe(psr.ParentID, "no", old, psr);
                   //  UpdateFuHe(psr.ParentID, "no1", old, psr);
                     LoadData1();
                 }
             }
         }
         else
         {
             MessageBox.Show("不是正确的地区最大负荷数据行,请选择正确的行!");
         }
     }
     else
     {
         MessageBox.Show("请选择要导入的地区最大负荷数据行!");
     }
 }