/// <summary> /// Gets the details of the Jobcard of the Employee. /// </summary> /// <param name="vJobCardApplication">id of the specific Jobcard to display its details</param> /// <returns>A table with all the necessary information in the table.</returns> /// <remarks>Shows a table that containg the minutes ,start time,end time of the jobcard.</remarks> private static string GetJobCardDetails(VAT_JobCardApplication vJobCardApplication) { string ST = ""; string ET = ""; string WorkMin = ""; if (vJobCardApplication.TimeStart != null) { ST = vJobCardApplication.TimeStart.Value.Hours.ToString("00") + ":" + vJobCardApplication.TimeStart.Value.Minutes.ToString("00"); } if (vJobCardApplication.TimeEnd != null) { ET = vJobCardApplication.TimeEnd.Value.Hours.ToString("00") + ":" + vJobCardApplication.TimeEnd.Value.Minutes.ToString("00"); } if (vJobCardApplication.Minutes > 0) { TimeSpan ts = new TimeSpan(0, vJobCardApplication.Minutes.Value, 0); WorkMin = ts.Hours.ToString("00") + ":" + ts.Minutes.ToString("00"); } string Body = "<table><tr><td>JOB CARD TYPE</td><td>" + vJobCardApplication.JobCardName + "</td></tr>" + "<tr><td>START DATE</td><td>" + vJobCardApplication.DateStarted.ToString("dd-MMM-yyyy") + "</td></tr>" + "<tr><td>END DATE</td><td>" + vJobCardApplication.DateEnded.ToString("dd-MMM-yyyy") + "</td></tr>" + "<tr><td>START TIME</td><td>" + ST + "</td></tr>" + "<tr><td>END TIME</td><td>" + ET + "</td></tr>" + "<tr><td>MINUTES</td><td>" + WorkMin + "</td></tr></table>"; return(Body); }
public void PostCreate(JobCardApp obj, VMLoggedUser LoggedInUser) { try { //Save the value provided in the Get of Jobcard and save them in the Jobcard app Table. obj.DateCreated = DateTime.Now; obj.JobCardStageID = "P"; obj.LineManagerID = LoggedInUser.LineManagerID; obj.Remarks = obj.Remarks; obj.JobCardTypeID = obj.JobCardTypeID; obj.DateStarted = obj.DateStarted; obj.DateEnded = obj.DateEnded; JobCardAppRepository.Add(obj); JobCardAppRepository.Save(); // Add Notification to Line Manager that he has a Pending Job card request DDService.SaveNotification((int)obj.LineManagerID, "/ESSP/ESSPJobCard/PendingJobCardIndex", Convert.ToInt32(NotificationTypeJCEnum.JCPending), true, obj.EmployeeID, obj.PJobCardAppID); SaveJobCardFlow((int)obj.LineManagerID, (int)LoggedInUser.PUserID, obj.JobCardStageID, obj.PJobCardAppID, obj.Remarks, ""); // Save entry in Notification email about the Submission of leave application that is sent to LIne manager through the Service VHR_UserEmployee LMUser = DDService.GetEmployeeUser(obj.LineManagerID, null); VHR_UserEmployee EmpUser = DDService.GetEmployeeUser(null, obj.EmployeeID); Expression <Func <VAT_JobCardApplication, bool> > SpecificEntries = c => (c.PJobCardAppID == obj.PJobCardAppID); VAT_JobCardApplication dbVAT_JobCardApplication = VATJobCardApplicationReporsitory.FindBy(SpecificEntries).First(); DDService.GenerateEmail(LMUser.OfficialEmailID, "", "Job Card Application # " + obj.PJobCardAppID.ToString(), ESSPText.GetPendingJCText(dbVAT_JobCardApplication, LMUser.UserEmployeeName), LoggedInUser.PUserID, Convert.ToInt32(NotificationTypeJCEnum.JCPending)); } catch (Exception ex) { } }
public void RejectJobCard(VMESSPCommon vmESSPCommon, VMLoggedUser LoggedInUser) { //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 "R"(Rejected). jobCardApp.JobCardStageID = "R"; JobCardAppRepository.Edit(jobCardApp); UnitOfWork.Commit(); // Add notifcation to Employee end about the Rejection of the Job Card VHR_UserEmployee LMUser = DDService.GetEmployeeUser(jobCardApp.LineManagerID, null); VHR_UserEmployee EmpUser = DDService.GetEmployeeUser(null, jobCardApp.EmployeeID); DDService.SaveNotification((int)EmpUser.PUserID, "/ESSP/ESSPJobCard/Index", Convert.ToInt32(NotificationTypeJCEnum.JCRejected), true, jobCardApp.EmployeeID, jobCardApp.PJobCardAppID); // Create Entry in the Job card flow. SaveJobCardFlow(EmpUser.PUserID, LMUser.PUserID, jobCardApp.JobCardStageID, jobCardApp.PJobCardAppID, "", vmESSPCommon.Comment); // Save Email in notification email about the Rejection 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.GetRejectJCText(dbVAT_JobCardApplication, EmpUser.UserEmployeeName, LMUser.UserEmployeeName, LMUser.DesignationName), LoggedInUser.PUserID, Convert.ToInt32(NotificationTypeJCEnum.JCRejected)); // 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); }
public static string GetRejectJCText(VAT_JobCardApplication vJobCardApplication, string ToName, string LMName, string LMDesignation) { string Body = GetHeader().ToString() + "<body>Dear " + ToName + ", <br/><br/>Your Job Card Application # " + vJobCardApplication.PJobCardAppID.ToString() + " has been <strong>Rejected</strong> by " + LMName + " [" + LMDesignation + "]."; Body = Body + "<br/><br/> Further Details are:<br/><br/>" + GetJobCardDetails(vJobCardApplication).ToString(); Body = Body + "<br/>You can access the ESSP account through following link: <br/>" + "http://essp-portal/"; Body = Body + "<br/><br/><p>***This is System generated email. Please do not reply.***</p><p>Please print this email only if necessary.</p><p>Thank You!</p>" + "</body>"; return(Body); }
/// <summary> /// Gets the Pening Job cards Text /// </summary> /// <param name="vJobCardApplication">gets the pending jobcard id</param> /// <param name="ToName">To whom the jobcard is being sent.</param> /// <returns>Generates a mail.</returns> /// <remarks>This method has the all the text that is required for the email by just calling this function in the controller</remarks> public static string GetPendingJCText(VAT_JobCardApplication vJobCardApplication, string ToName) { string Body = "<head><style>body{font-family: calibri;}table{font-family: calibri; border-collapse: collapse; width: 100%;font-size:13px;}td, th{border: 1px solid #dddddd; text-align: left; padding: 8px;}</style></head>" + "<body>Dear " + ToName + ", <br/><br/>Job Card Application # " + vJobCardApplication.PJobCardAppID.ToString() + " was submitted by " + vJobCardApplication.EmployeeName + " [" + vJobCardApplication.DesignationName + "] is <strong>Pending</strong> for your approval."; Body = Body + "<br/><br/> Further Details are:<br/><br/>" + GetJobCardDetails(vJobCardApplication).ToString(); Body = Body + "<br/>You can access the ESSP account through following link: <br/>" + "http://essp-portal/"; Body = Body + "<br/><br/><p>***This is System generated email. Please do not reply.***</p><p>Please print this email only if necessary. </p><p>Thank You!</p>" + "</body>"; return(Body); }
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); }