示例#1
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmgleYearEdit PDT = new FrmgleYearEdit();

            if (ParentObj == null)
            {
                Itop.Common.MsgBox.ShowYesNo("配电区域为空!");
                return;
            }
            PDT.ParentObj = ParentObj;
            glebeYearValue pdr = new glebeYearValue();

            pdr.ParentID = ParentObj.UID;
            PDT.RowData  = pdr;
            if (PDT.ShowDialog() == DialogResult.OK)
            {
                pdr = PDT.RowData;

                Itop.Client.Common.Services.BaseService.Create <glebeYearValue>(pdr);

                //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                ((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                //gridControl1.DataSource = datatable;
            }
        }
示例#2
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                glebeYearValue PD  = Itop.Common.DataConverter.RowToObject <glebeYearValue>(row);
                FrmgleYearEdit PDT = new FrmgleYearEdit();
                PDT.ParentObj = ParentObj;
                PDT.RowData   = PD;
                if (PDT.ShowDialog() == DialogResult.OK)
                {
                    PD = PDT.RowData;
                    //if (PD.TDdatetime.Year != ParentObj.Year) {
                    //    Itop.Common.MsgBox.ShowYesNo("停电日期和年份不符!");
                    //    return;
                    //}
                    Itop.Client.Common.Services.BaseService.Update <PDrelcontent>(PD);
                    ParentID = ParentObj.UID;
                    //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    //((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    //gridControl1.DataSource = datatable;
                }
            }
        }
示例#3
0
 public void Refresh()
 {
     foreach (DataRow dr in datatable.Rows)
     {
         glebeYearValue gyv = Itop.Common.DataConverter.RowToObject <glebeYearValue>(dr);
         gyv.Burthen = Convert.ToDouble(ParentObj.Burthen) * gyv.FHmdTz;
         gyv.AvgFHmd = Convert.ToDouble(ParentObj.Burthen / (ParentObj.Area + Convert.ToDecimal(ParentObj.ObligateField10))) * gyv.FHmdTz;
         Itop.Client.Common.Services.BaseService.Update <glebeYearValue>(gyv);
     }
     parentID = ParentObj.UID;
 }
示例#4
0
        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                glebeYearValue dev = Itop.Common.DataConverter.RowToObject <glebeYearValue>(row);
                if (Itop.Common.MsgBox.ShowYesNo("是否确认删除?") == DialogResult.Yes)
                {
                    Itop.Client.Common.Services.BaseService.Delete <glebeYearValue>(dev);
                    ((DataTable)gridControl1.DataSource).Rows.Remove(row);
                }
            }
        }
示例#5
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FrmAddspatialarea FA = new FrmAddspatialarea();

            FA.init();
            if (FA.ShowDialog() == DialogResult.OK)
            {
                foreach (DataRow dr in dataTable.Rows)
                {
                    if (dr["Title"] == FA.Areatitle)
                    {
                        MessageBox.Show("已经存在此地区!请重新选。");
                        return;
                    }
                }
                glebeProperty gp = new glebeProperty();
                gp.ParentEleID     = "0";
                gp.SvgUID          = "c5ec3bc7-9706-4cbd-9b8b-632d3606f933";
                gp.ObligateField16 = FA.Areatitle;
                IList <glebeProperty> svglist = Services.BaseService.GetList <glebeProperty>("SelectglebePropertyByObligateField16", gp);
                if (svglist.Count > 0)
                {
                    frmMainProperty f = new frmMainProperty();
                    f.IsReadonly = true;
                    f.InitData(svglist[0], "", "", "");

                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();

                        psp_Type.ID = Guid.NewGuid().ToString();

                        psp_Type.Forecast   = type;
                        psp_Type.ForecastID = forecastReport.ID;

                        psp_Type.Title = FA.Areatitle;
                        glebeYearValue gy = new glebeYearValue();

                        IList <glebeYearValue> yearlist = Services.BaseService.GetList <glebeYearValue>("SelectglebeYearValueBywhere", "ParentID='" + svglist[0].UID + "'");
                        for (int i = 0; i < yearlist.Count; i++)
                        {
                            string y = "y" + yearlist[i].Year.ToString();
                            psp_Type.GetType().GetProperty(y).SetValue(psp_Type, yearlist[i].Burthen, null);
                        }
                        object obj = Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null);
                        if (obj != null)
                        {
                            psp_Type.Sort = ((int)obj) + 1;
                        }
                        else
                        {
                            psp_Type.Sort = 1;
                        }

                        try {
                            Common.Services.BaseService.Create <Ps_Forecast_Math>(psp_Type);
                            //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_P_Types", psp_Type);
                            dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                        } catch (Exception ex) {
                            MsgBox.Show("增加区域出错:" + ex.Message);
                        }
                        RefreshChart();
                    }
                }
                else
                {
                    Ps_Forecast_Math psp_Type = new Ps_Forecast_Math();

                    psp_Type.ID = Guid.NewGuid().ToString();

                    psp_Type.Forecast   = type;
                    psp_Type.ForecastID = forecastReport.ID;

                    psp_Type.Title = FA.Areatitle;
                    //glebeYearValue gy = new glebeYearValue();

                    //IList<glebeYearValue> yearlist = Services.BaseService.GetList<glebeYearValue>("SelectglebeYearValueBywhere", "ParentID='" + svglist[0].UID + "'");
                    //for (int i = 0; i < yearlist.Count; i++) {
                    //    string y = "y" + yearlist[i].Year.ToString();
                    //    psp_Type.GetType().GetProperty(y).SetValue(psp_Type, y, null);
                    //}
                    object obj = Services.BaseService.GetObject("SelectPs_Forecast_MathMaxID", null);
                    if (obj != null)
                    {
                        psp_Type.Sort = ((int)obj) + 1;
                    }
                    else
                    {
                        psp_Type.Sort = 1;
                    }

                    try {
                        Common.Services.BaseService.Create <Ps_Forecast_Math>(psp_Type);
                        //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_P_Types", psp_Type);
                        dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                    } catch (Exception ex) {
                        MsgBox.Show("增加区域出错:" + ex.Message);
                    }
                    RefreshChart();
                }
            }
        }