public void CreateLeave(LeaveApplication lvapplication, LeaveType lvType, VMLoggedUser LoggedInUser) { try { //gets the information of leave and saving entries from logged in user to leaveApplication. lvapplication.LeaveDate = DateTime.Today; int _userID = (int)LoggedInUser.PUserID; lvapplication.LineManagerID = (int)LoggedInUser.LineManagerID; lvapplication.CreatedBy = _userID; lvapplication.Active = true; lvapplication.LeaveStageID = "P"; lvapplication.SubmittedByUserID = LoggedInUser.PUserID; LeaveApplicationRepository.Add(lvapplication); LeaveApplicationRepository.Save(); // Add notification to Line manager's end that he has a pending leave Request. DDService.SaveNotification(lvapplication.LineManagerID, "/ESSP/ESSPLeaveApp/PendingLeaveApplicationIndex", Convert.ToInt32(NTLeaveEnum.LeavePending), true, lvapplication.EmpID, lvapplication.PLeaveAppID); SaveLeaveApplicationFlow(lvapplication.LineManagerID, _userID, lvapplication.LeaveStageID, lvapplication.PLeaveAppID, lvapplication.LeaveReason, ""); // Save entry in Notification Email table for where the email is generated through service. VHR_UserEmployee LMUser = DDService.GetEmployeeUser(lvapplication.LineManagerID, null); VHR_UserEmployee EmpUser = DDService.GetEmployeeUser(null, lvapplication.EmpID); Expression <Func <VAT_LeaveApplication, bool> > SpecificEntries2 = c => c.PLeaveAppID == lvapplication.PLeaveAppID; VAT_LeaveApplication vlvApplication = VEPESSPLeaveApplicationReporsitory.FindBy(SpecificEntries2).First(); DDService.GenerateEmail(LMUser.OfficialEmailID, "", "Leave Application # " + lvapplication.PLeaveAppID.ToString(), ESSPText.GetPendingLeaveText(vlvApplication, LMUser.UserEmployeeName), LoggedInUser.PUserID, Convert.ToInt32(NTLeaveEnum.LeavePending)); } catch (Exception ex) { } }
public ActionResult ForgetPassword(VHR_AppUser obj) { if (obj.OfficialEmailID == null || obj.OfficialEmailID == "") { ModelState.AddModelError("OfficialEmailID", "Official Email Address is Mandatory"); } Expression <Func <VHR_AppUser, bool> > SpecificEntries = c => c.OfficialEmailID == obj.OfficialEmailID && c.UserStatus == true; List <VHR_AppUser> dbVHR_AppUsers = VHRAppUserService.GetIndexSpecific(SpecificEntries); if (VHRAppUserService.GetIndexSpecific(SpecificEntries).ToList().Count > 0) { if (ModelState.IsValid) { var Password = App_Start.AppAssistant.Decrypt(dbVHR_AppUsers.First().Password); var callbackUrl = "http://bcl-portal/"; DDService.GenerateEmail(dbVHR_AppUsers.First().OfficialEmailID, "", "Forget Password", "<html><head><meta content=\"text/html; charset = utf - 8\" /></head><body><p>Dear Employee, " + " </p>" + "<p>This is with reference to your request for forgetting password at Employee Self Service Portal. </p>" + "<p>UserName : <u><strong>" + dbVHR_AppUsers.First().UserName + "</u></strong><p>" + "<p>Password : <u><strong>" + Password + "</u></strong><p>" + " <p>Please click <a href=\"" + callbackUrl + "\">here</a> to login to your profile.</p>" + "<div><strong> Best Regards</strong></div><div><strong>Bestway Cement Limited</strong> </div></body></html>", dbVHR_AppUsers.First().PUserID, Convert.ToInt32(NotificationTypeEmail.ForgetPassword)); } return(RedirectToAction("EmailSent", "Home")); } else { ModelState.AddModelError("OfficialEmailID", "Not registered email"); } return(View()); }
public ActionResult SendEmailToLM() { // Send email to LM VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser; Expression <Func <VHR_UserEmployee, bool> > SpecificEntries2 = aa => aa.UserStatus == true; List <VHR_UserEmployee> dbUsers = VHR_UserEmployeeService.GetIndexSpecific(SpecificEntries2).ToList(); // For Leaves List <VAT_LeaveApplication> dbLVApplications = new List <VAT_LeaveApplication>(); if (LoggedInUser.UserAccessTypeID == 2) { if (LoggedInUser.UserLoctions != null) { foreach (var userLocaion in LoggedInUser.UserLoctions) { Expression <Func <VAT_LeaveApplication, bool> > SpecificEntries23 = aa => aa.LeaveStageID == "P" && aa.LocationID == userLocaion.LocationID; dbLVApplications.AddRange(VATLeaveApplicationService.GetIndexSpecific(SpecificEntries23).ToList()); } } } foreach (var LineManagerID in dbLVApplications.Select(aa => aa.LineManagerID).Distinct().ToList()) { if (dbUsers.Where(aa => aa.PUserID == LineManagerID).Count() > 0) { VHR_UserEmployee vHR_UserEmployee = dbUsers.First(aa => aa.PUserID == LineManagerID); if (vHR_UserEmployee.OfficialEmailID != "" && vHR_UserEmployee.OfficialEmailID != null) { // Send email DDService.GenerateEmail(vHR_UserEmployee.OfficialEmailID, "", "Payroll Period is Closing: Need your attention", ESSPText.GetPendingLeaveAlertEmail(vHR_UserEmployee.UserEmployeeName), LoggedInUser.PUserID, Convert.ToInt32(NTLeaveEnum.EmailAlert)); } } } return(RedirectToAction("ESSPPendingLeaveIndex")); }
public string ApproveJobCard(VMESSPCommon vmESSPCommon, VMLoggedUser LoggedInUser, string Message) { //Gets the First entry and comment box for the approval of the Job Card Application JobCardApp jobCardApp = JobCardAppRepository.GetSingle((int)vmESSPCommon.PID); //Changes the stage of JobCard to "A"(Approved). //if (DDService.IsDateLieBetweenActivePayroll(jobCardApp.DateStarted)) //{ Expression <Func <PayrollPeriod, bool> > SpecificEntries96 = c => jobCardApp.DateStarted >= c.PRStartDate && jobCardApp.DateStarted <= c.PREndDate && c.PeriodStageID == "C"; List <PayrollPeriod> dbPayrollPeriods = PayrollPeriodService.GetIndexSpecific(SpecificEntries96).ToList(); if (dbPayrollPeriods.Count() > 0) { Message = "Cannot Approve Job Cards of Closed Payroll Period"; } if (Message == "") { jobCardApp.JobCardStageID = "A"; JobCardAppRepository.Edit(jobCardApp); UnitOfWork.Commit(); //Gets the LM and Employee Information VHR_UserEmployee LMUser = DDService.GetEmployeeUser(jobCardApp.LineManagerID, null); VHR_UserEmployee EmpUser = DDService.GetEmployeeUser(null, jobCardApp.EmployeeID); // Add notifcation to Employee end about the Approval of the Job Card DDService.SaveNotification((int)EmpUser.PUserID, "/ESSP/ESSPJobCard/Index", Convert.ToInt32(NotificationTypeJCEnum.JCApproved), true, jobCardApp.LineManagerID, jobCardApp.PJobCardAppID); // Create Entry in the Job card flow. SaveJobCardFlow((int)EmpUser.PUserID, (int)jobCardApp.LineManagerID, jobCardApp.JobCardStageID, jobCardApp.PJobCardAppID, "", vmESSPCommon.Comment); // Save Email in notification email about the approval of the jobcard that is being sent to the employeee through Service. Expression <Func <VAT_JobCardApplication, bool> > SpecificEntries2 = c => (c.PJobCardAppID == jobCardApp.PJobCardAppID); VAT_JobCardApplication dbVAT_JobCardApplication = VATJobCardApplicationReporsitory.FindBy(SpecificEntries2).First(); DDService.GenerateEmail(EmpUser.OfficialEmailID, "", "Job Card Application # " + jobCardApp.PJobCardAppID.ToString(), ESSPText.GetApprovedJCText(dbVAT_JobCardApplication, EmpUser.UserEmployeeName, LMUser.UserEmployeeName, LMUser.DesignationName), LoggedInUser.PUserID, Convert.ToInt32(NotificationTypeJCEnum.JCApproved)); // Create Reprocess Request DDService.ProcessDailyAttendance(jobCardApp.DateStarted, jobCardApp.DateEnded, (int)jobCardApp.EmployeeID, jobCardApp.EmployeeID.ToString()); DDService.ProcessMonthlyAttendance(jobCardApp.DateStarted, (int)jobCardApp.EmployeeID, jobCardApp.EmployeeID.ToString()); // Disable Notifications of Pending Job Card int notiTypeID1 = Convert.ToInt32(NotificationTypeJCEnum.JCPending); Expression <Func <Notification, bool> > SpecificEntries = c => (c.UserID == LoggedInUser.PUserID && c.Status == true && (c.NotificationTypeID == notiTypeID1) && c.PID == jobCardApp.PJobCardAppID); DDService.DeleteNotification(SpecificEntries); } return(Message); }