public ActionResult confirmprocesspayrollBySP(int year, int month) { var nullcheck = PayslipbatchheaderBo.GetAll().Where(x => x.BranchId == BRANCHID).ToList(); if (nullcheck.Count() != 0) { var confirmMonth = PayslipbatchheaderBo.GetLatestRecord(x => x.BranchId == BRANCHID).Month; if (confirmMonth == (month - 1)) { using (var dbCntx = new HrDataContext()) { var result = dbCntx.CommitPayslip(Convert.ToInt16(BRANCHID), month, year); } //Session["IsError"] = false; } else { //Session["IsError"] = true;// "Please Generate The Previous Months Payslip"; } } else { using (var dbCntx = new HrDataContext()) { var result = dbCntx.CommitPayslip(Convert.ToInt16(BRANCHID), month, year); } } return(RedirectToAction("ProcessPayroll", new { currentmonth = month, currentyear = year })); }