private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (row != null) { PDrelcontent PD = Itop.Common.DataConverter.RowToObject <PDrelcontent>(row); PdDateEdit PDT = new PdDateEdit(); 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.ID; //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; } } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PdDateEdit PDT = new PdDateEdit(); if (ParentObj == null) { Itop.Common.MsgBox.ShowYesNo("配电区域为空!"); return; } PDT.parentobj = ParentObj; PDrelcontent pdr = new PDrelcontent(); pdr.ParentID = ParentObj.ID; //pdr.TDdatetime PDT.RowData = pdr; if (PDT.ShowDialog() == DialogResult.OK) { pdr = PDT.RowData; //if (pdr.TDdatetime.Year!=ParentObj.Year) //{ // Itop.Common.MsgBox.ShowYesNo("停电日期和年份不符!"); // return; //} Itop.Client.Common.Services.BaseService.Create <PDrelcontent>(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; } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (row != null) { PDrelcontent PD = Itop.Common.DataConverter.RowToObject<PDrelcontent>(row); PdDateEdit PDT = new PdDateEdit(); 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.ID; //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; } } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PdDateEdit PDT = new PdDateEdit(); if (ParentObj==null) { Itop.Common.MsgBox.ShowYesNo("配电区域为空!"); return; } PDT.parentobj = ParentObj; PDrelcontent pdr = new PDrelcontent(); pdr.ParentID = ParentObj.ID; //pdr.TDdatetime PDT.RowData = pdr; if (PDT.ShowDialog() == DialogResult.OK) { pdr = PDT.RowData; //if (pdr.TDdatetime.Year!=ParentObj.Year) //{ // Itop.Common.MsgBox.ShowYesNo("停电日期和年份不符!"); // return; //} Itop.Client.Common.Services.BaseService.Create<PDrelcontent>(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; } }