public void SendFeeNotificationToCadidates() { var info = _feemanagementService.SendFeeEmailOneByOne(); if (info != null && info.Count > 0) { foreach (var item in info) { if (item.FeeCollection.Count() > 0) { FeeEmailNotifacationLogViewModel Model = new FeeEmailNotifacationLogViewModel(); Model.CandidateName = item.Fname + " " + item.Lname; Model.CourseName = item.CourseName; Model.RegNo = item.RegNo; Model.LogDate = DateTime.Now; Model.Email = item.RegisterEmail; if (item.FeeCollection.FirstOrDefault().InstallmentId == 1) { Model.StartDateOfSendingMail = item.BatchStartDate.Value.AddMonths(11); Model.EndDateofSendingMail = item.BatchStartDate.Value.AddMonths(12); Model.FeeInstallmentName = "Second Installment"; } else if (item.FeeCollection.FirstOrDefault().InstallmentId == 2) { Model.StartDateOfSendingMail = item.BatchStartDate.Value.AddMonths(23); Model.EndDateofSendingMail = item.BatchStartDate.Value.AddMonths(24); Model.FeeInstallmentName = "Third Installment"; } if (_feemanagementService.GetFeeEmailNotifyDetailBiId(Model)) { _feemanagementService.AddFeeNotifaicationLog(Model); } } } var sendingData = _feemanagementService.GetFeeEmailNotifyList(); if (sendingData.Count() > 0) { foreach (var obj in sendingData) { var currDate = DateTime.Now; if (obj.StartDateOfSendingMail <= currDate && obj.EndDateofSendingMail >= currDate) { obj.CourseChangeFeeAmountForMBA = _feemanagementService.GetCourseChangeFeeReminder(obj.RegNo.Value, obj.CourseName, obj.FeeInstallmentName); if (string.IsNullOrEmpty(obj.CourseChangeFeeAmountForMBA) || (obj.CourseChangeFeeAmountForMBA == "0")) { _feemanagementService.UpdateFeeEmailNotification(obj.Id); } else if (Email.SendFeeNotificationEmail(obj) == "Successfull") { _feemanagementService.UpdateFeeEmailNotification(obj.Id); } } } } } }