public bool DeleteSalaryHead(int salaryHeadID) { bool result = true; try { TBl_MP_HR_SalaryHead model = _dbContext.TBl_MP_HR_SalaryHead.Where(x => x.pK_SH_ID == salaryHeadID).FirstOrDefault(); if (model != null) { model.IsActive = false; } TBL_MP_Admin_UserList model1 = _dbContext.TBL_MP_Admin_UserList.Where(x => x.PKID == salaryHeadID).FirstOrDefault(); if (model1 != null) { model1.IsActive = false; } _dbContext.SaveChanges(); result = true; } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ServiceSalaryHead::DeleteSalaryHead", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public bool DeactivateTermAndConditionCategory(int catID) { bool result = false; try { TBL_MP_Admin_UserList model = _dbContext.TBL_MP_Admin_UserList.Where(x => x.PKID == catID).FirstOrDefault(); if (model != null) { model.IsActive = false; _dbContext.SaveChanges(); result = true; } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ServiceTermsAndConditions::DeactivateTermAndConditionCategory", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
private void btnSave_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { TBL_MP_Admin_UserList model = null; if (!this.ValidateChildren()) { return; } if (this.UserListID == 0) { model = new TBL_MP_Admin_UserList(); } else { model = _UOM.MasterService.GetAdminUserListDBCategory(UserListID); } if (model != null) { model.Fk_Admin_CategoryID = this.ADMINCategoryID; model.Admin_UserList_Desc = txtCategoryName.Text.Trim(); model.ShortCode = txtShortCode.Text.Trim(); model.IsActive = chkIsActive.Checked; } if (this.UserListID == 0) { int newID = _UOM.MasterService.AddNewADMINUserListItem(model); if (newID > 0) { this.UserListID = newID; this.DialogResult = DialogResult.OK; } } else { bool result = _UOM.MasterService.UpdateADMINUserListItem(model); if (result) { this.DialogResult = DialogResult.OK; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "frmADMINUserList::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmADMINCategory_Load(object sender, EventArgs e) { chkIsActive.Checked = true; txtCategoryName.Text = string.Empty; if (this.UserListID != 0) { TBL_MP_Admin_UserList model = _UOM.AppDBContext.TBL_MP_Admin_UserList.Where(x => x.PKID == this.UserListID).FirstOrDefault(); if (model != null) { txtCategoryName.Text = model.Admin_UserList_Desc; txtShortCode.Text = model.ShortCode; chkIsActive.Checked = model.IsActive; } } }