//===================================================Method to Send Reminder Email //Insert reminder email details in email Queue ========================================================================= /// <summary> /// Method to Send Reminder Email //Insert reminder email details in email Queue /// </summary> public static void SendReminderEmail() { ExceptionLogsRepositery exceptionLogsRepositery = new ExceptionLogsRepositery(); UsersRepositery _UsersRepositeryObject = new UsersRepositery(); EmailQueueRepositery _EmailQueueRepositeryObject = new EmailQueueRepositery(); EmailLogsRepositery _EmailLogsRepositeryObject = new EmailLogsRepositery(); TaskRepositery _TaskRepositertyObject = new TaskRepositery(); List <Users> usersList = new List <Users>(); List <EmailLogs> emailLogsList = new List <EmailLogs>(); List <Task> taskList = new List <Task>(); List <EmailLogs> emailLogsListReminder = new List <EmailLogs>(); string hostname = Dns.GetHostName(); try { //get all users detail int usersList usersList = _UsersRepositeryObject.GetAllUsers(); //Remove admin details usersList.RemoveAll(x => x.RoleId == 1); //get detail of user who have submitted there task today from task table taskList = _TaskRepositertyObject.GetTaskDetailOfTodaySubmittedTask(); //list of user who have not submitted there task today //remove the user who have submitted there task usersList.RemoveAll(x => taskList.Exists(i => x.Id == i.EmployeeId)); string logo = "ftp://[email protected]/Content/Image/Logo.jpg"; if (usersList.Count > 0) { //insert email detail into email Queue foreach (Users item in usersList) { _EmailQueueRepositeryObject.InsertEmailDeatailsInEmailQueue("*****@*****.**", item.Email, "Task Reminder", "<html>Dear Employee,<br/><br/><br/>You have not submitted your today's task detail. Don't forget to submit your task.<br/><br/><b>Thanks & regards<br/><br/><img width=196 height=153 src=" + "http://demo8.clanstech.com/Content/Image/logo.jpg" + "><br/><br/></b><br/><br><address><b>Adderss:</b><br/>G-282 , Sector-63<br/> Noida -201301 ,<br/>Gautam Buddh Nagar<br/>U.P, India<br><br><b>Website: </b><a href=" + "https://clanstech.com" + ">www.clanstech.com</a><br/><b>Phone:</b> <phone>+91-7042.615.658</phone><br/><b>Maps: </b><a href=" + "https://www.google.com/maps/place/Clanstech+%7C+Providing+Online+Presence/@28.614499,77.3887193,17z/data=!3m1!4b1!4m5!3m4!1s0x390cef928e84423b:0xde8604eb59d84354!8m2!3d28.614499!4d77.390908" + ">Google Maps</a></address></html>"); Console.WriteLine("Email details inserting to Email Queue : " + item.Email); } } } catch (Exception ex) { string error = ex.Message; MethodBase site = MethodBase.GetCurrentMethod(); //HttpRequest request = HttpContext.Current.Request; string url = "";// request.Url.AbsoluteUri; Console.WriteLine("Exception occurred in inserting into email queue for reminder"); Console.WriteLine("Message : " + ex.Message); Console.WriteLine("StackTrace : " + ex.StackTrace); Console.WriteLine("Data : " + ex.Data); Console.WriteLine("Source : " + ex.Source); Console.WriteLine("Method" + site.Name.ToString()); exceptionLogsRepositery.InsertException(ex, url, site.Name); } }
public ActionResult TodayStatus() { //Read all employee List <Users> taskSubmittedUsersList = _UsersRepositeryObject.GetAllEmployee(); List <Users> taskNotSubmittedUsersList = _UsersRepositeryObject.GetAllEmployee(); //Get today task taskList = _TaskRepositeryObject.GetTaskDetailOfTodaySubmittedTask(); ViewBag.taskList = taskList; //Employee who are submitted there task if (taskList.Count > 0) { taskSubmittedUsersList.RemoveAll(x => !taskList.Exists(i => i.EmployeeId == x.Id)); ViewBag.taskSubmittedUsersList = taskSubmittedUsersList; } //Employee who are not submitted there task taskNotSubmittedUsersList.RemoveAll(x => taskList.Exists(i => i.EmployeeId == x.Id)); ViewBag.taskNotSubmittedUsersList = taskNotSubmittedUsersList; return(View(usersList)); }