public List <DesignationwiseSalaryHeadModel> GetAllDeductionsSalaryHeadsForDesignation(int designationID, EMPLOYMENT_TYPE EmploymentType) { List <DesignationwiseSalaryHeadModel> lstDeduction = new List <DesignationwiseSalaryHeadModel>(); try { List <SelectListItem> lstDesignations = (new ServiceMASTERS()).GetAllDesignation(); List <SelectListItem> lstSalaryHeads = (new ServiceMASTERS()).GetAllSalaryHeads(); int DEDUCTION_CATEGORY_ID = 0; DEDUCTION_CATEGORY_ID = _dbContext.APP_DEFAULTS.Where(X => X.ID == (int)APP_DEFAULT_VALUES.SalaryHeadDEDUCTIONType).FirstOrDefault().DEFAULT_VALUE; List <TBl_MP_HR_SalaryHead> lstSalaryHeadsDeduction = (new ServiceSalaryHead()).GetAllSalaryHeadsofType(DEDUCTION_CATEGORY_ID); foreach (TBl_MP_HR_SalaryHead salaryHeadItem in lstSalaryHeadsDeduction) { DesignationwiseSalaryHeadModel model = new DesignationwiseSalaryHeadModel(); model.EmploymentType = EmploymentType; model.SalaryHeadID = salaryHeadItem.pK_SH_ID; model.SalaryHeadName = lstSalaryHeads.Where(x => x.ID == salaryHeadItem.fK_Usrlst_SH_ID).FirstOrDefault().Description; model.DesignationID = designationID; if (lstDesignations.Where(x => x.ID == designationID).FirstOrDefault() != null) { model.DesignationName = lstDesignations.Where(x => x.ID == designationID).FirstOrDefault().Description; } model.ApplicableChargesType = ITEM_CHARGE_TYPE.LUMPSUM; model.ApplicableChargesValue = 0; model.ID = 0; model.SalaryHeadAmount = 0; model.IsSelected = false; lstDeduction.Add(model); } // UPDATE LIST COLLECTION FROM THE DATABASE foreach (DesignationwiseSalaryHeadModel item in lstDeduction) { TBL_MP_HR_DesignationwiseSalaryHeads found = (from xx in _dbContext.TBL_MP_HR_DesignationwiseSalaryHeads where xx.FK_DesignationID == designationID && xx.FK_EmploymentTypeID == (int)EmploymentType && xx.FK_SalaryHeadID == item.SalaryHeadID && xx.IsDeleted == false select xx).FirstOrDefault(); if (found != null) { item.ApplicableChargesType = (ITEM_CHARGE_TYPE)found.ApplicableChargesType; item.ApplicableChargesValue = found.ApplicableChargesValue; item.ID = found.PK_ID; item.SalaryHeadAmount = found.SalaryHeadAmount; if (!found.IsDeleted) { item.IsSelected = true; } } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ServiceDesignationWiseSalary::GetAllDeductionsSalaryHeadsForDesignation", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(lstDeduction); }
public ControlCTCConfiguration(EMPLOYMENT_TYPE typeOfemployment) { InitializeComponent(); this.employmentTYPE = typeOfemployment; }