Пример #1
0
        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);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
 public static string SendFeeNotificationEmail(FeeEmailNotifacationLogViewModel Model)
 {
     try
     {
         EmailNotificationModel obj = new EmailNotificationModel();
         obj.SenderEmailId    = Model.Email;
         obj.SmtpUser         = ConfigurationManager.AppSettings["smtpUser"];
         obj.CCEmail          = new string[] { "*****@*****.**" };
         obj.EmailSubjectName = "Fee Reminder from Spice Star";
         obj.TemplateFilePath = EmailTemplateForFeeNotification("~/Templates/FeeReminderTemplate.html", Model);
         SendEmail(obj);
     }
     catch (Exception ex)
     {
         return(ex.Message + "," + ex.InnerException.StackTrace);
     }
     return("Successfull");
 }
Пример #3
0
        public static string EmailTemplateForFeeNotification(string mailTemplatePath, FeeEmailNotifacationLogViewModel Model)
        {
            var    strContent = new StringBuilder();
            string line;
            var    file = new System.IO.StreamReader(
                System.Web.Hosting.HostingEnvironment.MapPath(mailTemplatePath));

            while ((line = file.ReadLine()) != null)
            {
                strContent.Append(line);
            }
            file.Close();
            DateTime currDate = DateTime.Now;

            strContent = strContent.Replace("@@CurrentDate", currDate.ToString("dd/MM/yyyy"));
            strContent = strContent.Replace("@@CandidateName", Model.CandidateName);
            strContent = strContent.Replace("@@ProgrameName", Model.CourseName);
            strContent = strContent.Replace("@@Money", Model.CourseChangeFeeAmountForMBA);
            strContent = strContent.Replace("@@CurrMonth", currDate.ToString("MMMM"));
            strContent = strContent.Replace("@@CurrYear", currDate.Year.ToString());

            return(strContent.ToString());
        }