Ejemplo n.º 1
0
 //载入负荷数据
 private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";
     IList cList = Common.Services.BaseService.GetList("SelectPs_Table_220ResultByConn", conn);
     if (cList.Count > 0)
     {
         FrmImportSellgm frm1 = new FrmImportSellgm();
         frm1.BindList = cList;
         if (frm1.ShowDialog() == DialogResult.OK)
         {
             FormLoadForecastDataFSH frm = new FormLoadForecastDataFSH();
             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 Col3='1' and Title='1、全社会最高负荷'");
                         if (tempList.Count > 0)
                         {
                             Ps_Table_220Result psr = tempList[0] as Ps_Table_220Result;
                             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()) * fkb.GetVal, 1), null);
                                 psr.GetType().GetProperty("yf" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()), 1), null);
                             }
                             Common.Services.BaseService.Update<Ps_Table_220Result>(psr);
                             UpdateFuHe(psr.ParentID);
                         }
                     }
                     LoadData1();
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("没有数据!");
     }
 }
Ejemplo n.º 2
0
 private void barButtonItem13_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 == "一、220千伏供电负荷" && nId == "1")
     //    {
     //        Ps_Table_500Result psr = Common.Services.BaseService.GetOneByKey<Ps_Table_500Result>(this.treeList1.FocusedNode.GetValue("ID").ToString());
     //        Ps_Table_500Result old = (Ps_Table_500Result)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_500Result>(psr);
     //                UpdateFuHe(psr.ParentID, "no", old, psr);
     //                UpdateFuHe(psr.ParentID, "no1", old, psr);
     //                LoadData1();
     //            }
     //        }
     //    }
     //    else
     //    {
     //        MessageBox.Show("不是正确的负荷数据行,请选择正确的行!");
     //    }
     //}
     //else
     //{
     //    MessageBox.Show("请选择要导入的负荷数据行!");
     //}
     string conn = "ParentID='0' and ProjectID='" + GetProjectID + "'";
     IList cList = Common.Services.BaseService.GetList("SelectPs_Table_500ResultByConn", conn);
     if (cList.Count > 0)
     {
         FrmImportSellgm frm1 = new FrmImportSellgm();
         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_500ResultByConn", "ParentID='" + str + "' and ProjectID='" + GetProjectID + "' and Col1='1' and Title='一、220千伏供电负荷'");
                         if (tempList.Count > 0)
                         {
                             Ps_Table_500Result psr = tempList[0] as Ps_Table_500Result;
                             Ps_Table_500Result old = (Ps_Table_500Result)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())* fkb.GetVal, 1), null);
                                 psr.GetType().GetProperty("yf" + i.ToString()).SetValue(psr, Math.Round(double.Parse(row["y" + i.ToString()].ToString()) , 1), null);
                             }
                             Common.Services.BaseService.Update<Ps_Table_500Result>(psr);
                             UpdateFuHe(psr.ParentID, "no", old, psr);
                         }
                     }
                     LoadData1();
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("没有数据!");
     }
 }
Ejemplo n.º 3
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);
        }