private void btnEdit_Click(object sender, EventArgs e) { frmGiaoDan frm; frm = new frmGiaoDan(); frm.Operation = GxOperation.EDIT; frm.Id = MaGiaoDan; frm.MaGiaoHo = maGiaoHo; frm.AssignControlData(); if (frm.ShowDialog() == DialogResult.OK) { if (frm.DataReturn != null) { CancelEventArgs ce = new CancelEventArgs(); if (OnEditing != null) { OnEditing(frm.DataReturn, ce); } if (!ce.Cancel) { //assignValue(frm.DataReturn); CurrentRow = frm.DataReturn; changFont(CurrentRow); if (OnEdited != null) { OnEdited(frm.DataReturn, e); } } } } }
public void EditRow() { if (this.CurrentRow == null || (this.CurrentRow.DataRow as DataRowView) == null) { return; } frmGiaoDan frm = new frmGiaoDan(); frm.Operation = GxOperation.VIEW;//show for view only DataRow row = (this.CurrentRow.DataRow as DataRowView).Row; frm.Id = (int)row[GiaoDanConst.MaGiaoDan]; frm.AssignControlData(); if (frm.ShowDialog() == DialogResult.OK) { //if (frm.DataReturn != null) //{ // row[GiaoDanConst.TenThanh] = frm.DataReturn[GiaoDanConst.TenThanh]; // row[GiaoDanConst.HoTen] = frm.DataReturn[GiaoDanConst.HoTen]; // row[GiaoDanConst.NgaySinh] = frm.DataReturn[GiaoDanConst.NgaySinh]; // row[GiaoDanConst.Phai] = frm.DataReturn[GiaoDanConst.Phai]; // row[GiaoDanConst.SoRuaToi] = frm.DataReturn[GiaoDanConst.SoRuaToi]; // row[GiaoDanConst.SoRuocLe] = frm.DataReturn[GiaoDanConst.SoRuocLe]; // row[GiaoDanConst.SoThemSuc] = frm.DataReturn[GiaoDanConst.SoThemSuc]; // row[GiaoDanConst.NguoiDoDauRuaToi] = frm.DataReturn[GiaoDanConst.NguoiDoDauRuaToi]; // row[GiaoDanConst.NguoiDoDauThemSuc] = frm.DataReturn[GiaoDanConst.NguoiDoDauThemSuc]; //} } }
private void btnAdd_Click(object sender, EventArgs e) { frmGiaoDan frm; frm = new frmGiaoDan(); frm.MaGiaoHo = maGiaoHo; if (frm.ShowDialog() == DialogResult.OK) { if (frm.DataReturn != null) { CancelEventArgs ce = new CancelEventArgs(); if (OnAdding != null) { OnAdding(frm.DataReturn, ce); } if (!ce.Cancel) { //assignValue(frm.DataReturn); CurrentRow = frm.DataReturn; EnableEditButton(true); changFont(CurrentRow); if (OnAdded != null) { OnAdded(frm.DataReturn, e); } } } } }
public virtual void EditRow() { if (!allowShowForm) { return; } if (this.CurrentRow == null || (this.CurrentRow.DataRow as DataRowView) == null) { return; } frmGiaoDan frm = new frmGiaoDan(); if (allowEditGiaoDan) { frm.Operation = GxOperation.EDIT; } else { frm.Operation = GxOperation.VIEW; } DataRow row = (this.CurrentRow.DataRow as DataRowView).Row; if (this.RootTable.Columns.Contains(ThanhVienGiaDinhConst.VaiTro)) { Memory.Instance.SetMemory(ThanhVienGiaDinhConst.VaiTro, this.CurrentRow.Cells[0].Value); } SetFormData(frm); frm.AssignControlData(); if (frm.ShowDialog() == DialogResult.OK) { if (frm.DataReturn != null) { //row[GiaoDanConst.TenThanh] = frm.DataReturn[GiaoDanConst.TenThanh]; //row[GiaoDanConst.HoTen] = frm.DataReturn[GiaoDanConst.HoTen]; //row[GiaoDanConst.NgaySinh] = frm.DataReturn[GiaoDanConst.NgaySinh]; //row[GiaoDanConst.Phai] = frm.DataReturn[GiaoDanConst.Phai]; //row[GiaoHoConst.TenGiaoHo] = frm.DataReturn[GiaoHoConst.TenGiaoHo]; foreach (DataColumn col in frm.DataReturn.Table.Columns) { if (row.Table.Columns.Contains(col.ColumnName)) { row[col.ColumnName] = frm.DataReturn[col.ColumnName]; } } } } }