public int NotificationRequestAttendance(AttendanceRequestDTO atd) { EmployeeDetailsViewModel user = _employeeService.GetEmployeeDetails(atd.RequestEmpCode); EmployeeDetailsViewModel recomend = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.RecommendarEmpCode)); #region Notification NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(atd.RecommendarEmpCode); ntd.NotificationSubject = "Recommender for Attendance request"; ntd.NotificationReceiverType = "E"; ntd.NotificationMessage = user.Name + " Selected you as a Recommender. Please confirm the request"; ntd.NotificationDetailURL = "/user/attendancerequest/recommendlist"; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Email string emailType = "Email"; EmailServices.Message msg = new EmailServices.Message(); htmlReader reader = new htmlReader(); List <string> recipient = new List <string>() { recomend.Email }; msg.Subject = "Attendnace request Recommend"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = recomend.Name, Descriptions = user.Name + " has requested attendance for " + atd.RequestType + " on " + atd.RequestedDate + ". Please visit the link below and confirm the request ", FullName = user.Name, Title = "Attendance Request for recommendation", Url = baseUrl + "/user/attendancerequest/recommendlist" }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); #endregion return(0); }
public int NotificationApproveAttendance(AttendanceRequestDTO atd) { EmployeeDetailsViewModel user = _employeeService.GetEmployeeDetails(atd.RequestEmpCode); EmployeeDetailsViewModel recomend = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.RecommendarEmpCode)); EmployeeDetailsViewModel approver = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.ApproverEmpCode)); if (atd.ApproveStatus == 2) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(user.Code); ntd.NotificationSubject = "Approver approve your Attendnace"; ntd.NotificationMessage = "Attendance you requested on " + atd.RequestedDate + " is Approved by " + approver.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Notificationrecommender NotificationsDTOs ntf = new NotificationsDTOs(); ntf.NotificationDate = DateTime.Now; ntf.NotificationReceiverId = recomend.Code; ntf.NotificationSubject = "Approved attendance request"; ntf.NotificationMessage = "Attendance requested by" + user.Name + " on " + atd.RequestedDate + "is aproved by" + approver.Name; ntf.NotificationReceiverType = "E"; ntf.NotificationDetailURL = "/user/attendancerequest/recommend/" + atd.RequestId; ntf.NotificationReadDate = null; _notifications.InsertNotification(ntf); #endregion } else if (atd.ApproveStatus == 3) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(user.Code); ntd.NotificationSubject = "Approver reject your Attendnace request"; ntd.NotificationMessage = "Attendance requested by" + user.Name + " on " + atd.RequestedDate + "is rejected by" + approver.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Notificationrecommender NotificationsDTOs ntf = new NotificationsDTOs(); ntf.NotificationDate = DateTime.Now; ntf.NotificationReceiverId = recomend.Code; ntf.NotificationSubject = "Approver Rejected attendance request of " + user.Name; ntf.NotificationMessage = "Attendance requested for " + atd.RequestType + "requested on " + atd.RequestedDate + " is rejected by" + approver.Name; ntf.NotificationReceiverType = "E"; ntf.NotificationDetailURL = "/user/attendancerequest/recommend/" + atd.RequestId; ntf.NotificationReadDate = null; _notifications.InsertNotification(ntf); #endregion } #region Emailuser string emailType = "Email"; EmailServices.Message msg = new EmailServices.Message(); htmlReader reader = new htmlReader(); List <string> recipient = new List <string>() { user.Email }; if (atd.ApproveStatus == 2) { msg.Subject = "Approver confirm Attendnace request"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance requested on " + atd.RequestedDate + " for " + atd.RequestType + " is approved by " + approver.Name + " for more detail follow the link below", FullName = recomend.Name, Title = "Approver confirm Attendnace request for " + atd.RequestType, Url = baseUrl + "user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } else if (atd.ApproveStatus == 3) { msg.Subject = "Approver Rejected Attendnace request"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance requested on " + atd.RequestedDate + " for " + atd.RequestType + " is rejected by " + approver.Name + " for more detail follow the link below", FullName = recomend.Name, Title = "Rejected Attendnace request for " + atd.RequestType, Url = baseUrl + "/user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } #endregion #region Emailapprover string emailTypeapprover = "Email"; EmailServices.Message msgapprover = new EmailServices.Message(); htmlReader readerapprover = new htmlReader(); List <string> listapprover = new List <string>() { recomend.Email }; if (atd.RecommendStatus == 2) { msg.Subject = "Attendnace request approved of " + user.Name; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendnace you recommended on " + atd.RecommendStatusDate + " of " + user.Name + " is aproved by " + approver.Name + " on " + DateTime.Now + ". Please visit link below for details", FullName = recomend.Name, Title = "Attendnace request of " + user.Name + " for " + atd.RequestType + " is approved ", Url = baseUrl + "/user/attendancerequest/recommend/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailTypeapprover); EmailServices.Notify(listapprover, msgapprover); } else if (atd.RecommendStatus == 3) { msg.Subject = " Attendnace request rejected of " + user.Name; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = recomend.Name, Descriptions = "Attendnace you recommended on " + atd.RecommendStatusDate + " of " + user.Name + " is rejected by " + approver.Name + " on " + DateTime.Now + ". Please visit link below for details", FullName = recomend.Name, Title = "Attendnace request of " + user.Name + " for " + atd.RequestType + " is approved ", Url = baseUrl + "/user/attendancerequest/recommend/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailTypeapprover); EmailServices.Notify(listapprover, msgapprover); } #endregion return(0); }
public int NotificationRecommendAttendance(AttendanceRequestDTO atd) { EmployeeDetailsViewModel user = _employeeService.GetEmployeeDetails(atd.RequestEmpCode); EmployeeDetailsViewModel recomend = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.RecommendarEmpCode)); EmployeeDetailsViewModel approver = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.ApproverEmpCode)); if (atd.RecommendStatus == 2) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(atd.RequestEmpCode); ntd.NotificationSubject = "Recommender approve your Attendnace"; ntd.NotificationMessage = "Your attendnace request on " + atd.RequestedDate + " is Recommended by " + recomend.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Notificationapprover NotificationsDTOs ntf = new NotificationsDTOs(); ntf.NotificationDate = DateTime.Now; ntf.NotificationReceiverId = approver.Code; ntf.NotificationSubject = "Attendnace Requested to approve"; ntf.NotificationMessage = user.Name + " Slected you as Approver as this request is already been recommened by " + recomend.Name + ".Please confirm the request "; ntf.NotificationReceiverType = "E"; ntf.NotificationDetailURL = "/user/attendancerequest/recommend/" + atd.RequestId; ntf.NotificationReadDate = null; _notifications.InsertNotification(ntf); #endregion #region Emailapprover string emailTypeapprover = "Email"; EmailServices.Message mgs_r = new EmailServices.Message(); htmlReader reader_r = new htmlReader(); List <string> receiver = new List <string>() { approver.Email }; mgs_r.Subject = "Attendnace request for Approve "; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = approver.Name, Descriptions = user.Name + " has request attendance for" + atd.RequestType + " on " + atd.RequestedDate + ". Please confirm the request as this request is already been recommended by " + recomend.Name + " on " + DateTime.Now + " Please follow the link below for more detail.", FullName = recomend.Name, Title = "Attendance Request for approve", Url = baseUrl + "/user/attendancerequest/approved/" + atd.RequestId.ToString() }; mgs_r.Body = reader_r.GetHtmlBodyTemplate(emailTemplateData, emailTypeapprover); EmailServices.Notify(receiver, mgs_r); #endregion } else if (atd.RecommendStatus == 3) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(user.Code); ntd.NotificationSubject = "Attendance request rejected by " + recomend.Name; ntd.NotificationMessage = "Sorry!! Your attendnace request on " + atd.RequestedDate + " is rejected by " + recomend.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion } #region Emailuser string emailType = "Email"; EmailServices.Message msg = new EmailServices.Message(); htmlReader reader = new htmlReader(); List <string> recipient = new List <string>() { user.Email }; if (atd.RecommendStatus == 2) { msg.Subject = "Recommender for Attendnace request"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance you requested on " + atd.RequestedDate + " for " + atd.RequestType + " has been accepted by " + recomend.Name + " on " + DateTime.Now + ". Please visit the link below for details", FullName = recomend.Name, Title = "Recommend Attendance Request", Url = baseUrl + "user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } else if (atd.RecommendStatus == 3) { msg.Subject = "Attendance request rejected by Recommender"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance you requested on " + atd.RequestedDate + " for " + atd.RequestType + " has been rejected by " + recomend.Name + " on " + DateTime.Now + ". Please visit the link below for details", FullName = recomend.Name, Title = "Recommend Attendance Request", Url = baseUrl + "user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } #endregion return(0); }