private void UpdateSift() { Class.DanhMuc_CaLamViec dm = new Class.DanhMuc_CaLamViec(); dm.ShiftCode = txtCode.Text; dm.ShiftName = txtName.Text; dm.Description = txtDescription.Text; dm.BeginTime = timeBeginTime.Time; dm.EndTime = timeEndTime.Time; if (txtCode.Enabled == true) { if (dm.Insert()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } } else if (dm.Update()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } CT_SHIFT_GetList(); txtCode.Text = Get_Code_New(); }
private void btnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!btnEdit.Enabled) { return; } int SelectedRow = gridItemDetail.FocusedRowHandle; if (SelectedRow >= 0) { DataRow drow = gridItemDetail.GetDataRow(SelectedRow); string _value = drow["ShiftCode"].ToString(); Class.DanhMuc_CaLamViec dm = new Class.DanhMuc_CaLamViec(); dm.ShiftCode = _value; dm.ShiftName = txtName.Text; dm.Description = txtDescription.Text; dm.BeginTime = timeBeginTime.Time; dm.EndTime = timeEndTime.Time; if (dm.Update()) { Class.App.SaveSuccessfully(); } else { Class.App.SaveNotSuccessfully(); } CT_SHIFT_GetList(); txtCode.Text = Get_Code_New(); // frmDanhMucCaLamViec_Update frm = new frmDanhMucCaLamViec_Update(false, "Cập nhật ca làm việc", "Ca", _value); // frm.Owner = this; // frm.ShowDialog(); } }