private void btReEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) return; DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); PJ_gypdxldlwzt currRecord = new PJ_gypdxldlwzt(); foreach (DataColumn dc in gridtable.Columns) { if (dc.ColumnName != "Image") { if (dc.DataType.FullName.IndexOf("Byte[]") < 0) currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); else if (dc.DataType.FullName.IndexOf("Byte[]") > -1 && DBNull.Value != dr[dc.ColumnName] && dr[dc.ColumnName].ToString() != "") currRecord.GetType().GetProperty(dc.ColumnName).SetValue(currRecord, dr[dc.ColumnName], null); } } frmdlwztEdit frm = new frmdlwztEdit(); frm.RowData = currRecord; if (frm.ShowDialog() == DialogResult.OK) { MainHelper.PlatformSqlMap.Update<PJ_gypdxldlwzt>(currRecord); InitData(); } }
private void btReAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PJ_gypdxldlwzt newobj = new PJ_gypdxldlwzt(); newobj.CreateDate = DateTime.Now; Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin(); newobj.CreateMan = m_UserBase.RealName; frmdlwztEdit frm = new frmdlwztEdit(); frm.RowData = newobj; if (frm.ShowDialog() == DialogResult.OK) { MainHelper.PlatformSqlMap.Create<PJ_gypdxldlwzt>(newobj); InitData(); } }