void Editlamviec(enuEdit enuNew_Edit) { if (bdsEmployee.Position < 0) { return; } if (bdsLamViec.Position < 0 && enuNew_Edit == enuEdit.Edit) { return; } DataRow drEmployee = ((DataRowView)bdsEmployee.Current).Row; //Copy hang hien tai if (bdsLamViec.Position >= 0) { Common.CopyDataRow(((DataRowView)bdsLamViec.Current).Row, ref drCurrent); } else { drCurrent = dtLamViec.NewRow(); } drCurrent["Ma_CbNv"] = (string)drEmployee["Ma_CbNv"]; frmLamViec_Edit frmEdit = new frmLamViec_Edit(); frmEdit.Load(enuNew_Edit, drCurrent); //Người dùng chọn chấp nhận if (frmEdit.isAccept) { if (enuNew_Edit == enuEdit.New) { if (bdsLamViec.Position >= 0) { dtLamViec.ImportRow(drCurrent); } else { dtLamViec.Rows.Add(drCurrent); } bdsLamViec.Position = bdsLamViec.Find("Ident00", drCurrent["Ident00"]); } else { Common.CopyDataRow(drCurrent, ((DataRowView)bdsLamViec.Current).Row); } dtLamViec.AcceptChanges(); } else { dtLamViec.RejectChanges(); } }
void Editlamviec(enuEdit enuNew_Edit) { if (bdsEmployee.Position < 0) { return; } if (bdsLamViec.Position < 0 && enuNew_Edit == enuEdit.Edit) { return; } DataRow drEmployee = ((DataRowView)bdsEmployee.Current).Row; //Copy hang hien tai if (bdsLamViec.Position >= 0) { Common.CopyDataRow(((DataRowView)bdsLamViec.Current).Row, ref drCurrent); } else { drCurrent = dtLamViec.NewRow(); } if (enuNew_Edit == enuEdit.New) { drCurrent["Is_Bat_Dau"] = false; drCurrent["Is_Changed"] = false; drCurrent["Ngay_Changed"] = Element.sysNgay_Min; drCurrent["Ngay_Begin"] = Element.sysNgay_Min; drCurrent["Ngay_Thu_Viec"] = Element.sysNgay_Min; drCurrent["Ngay_End"] = Element.sysNgay_Min; drCurrent["Value_Current"] = string.Empty; drCurrent["Value_New"] = string.Empty; drCurrent["Type_Changed"] = string.Empty; } drCurrent["Ma_CbNv"] = (string)drEmployee["Ma_CbNv"]; frmLamViec_Edit frmEdit = new frmLamViec_Edit(); frmEdit.Load(enuNew_Edit, drCurrent); //Người dùng chọn chấp nhận if (frmEdit.isAccept) { if (enuNew_Edit == enuEdit.New) { if (bdsLamViec.Position >= 0) { dtLamViec.ImportRow(drCurrent); } else { dtLamViec.Rows.Add(drCurrent); } bdsLamViec.Position = bdsLamViec.Find("Ident00", drCurrent["Ident00"]); } else { Common.CopyDataRow(drCurrent, ((DataRowView)bdsLamViec.Current).Row); } dtLamViec.AcceptChanges(); } else { dtLamViec.RejectChanges(); } }