Exemplo n.º 1
0
        public ActionResult Edit()
        {
            SettingsViewModel obj = new SettingsViewModel();

            obj.settingsView = new SettingsView();
            obj.settingsView.BirthDayEmailText    = SettingService.BirthDayEmailText();
            obj.settingsView.AnniversaryEmailText = SettingService.AnniversaryEmailText();
            obj.settingsView.EmailAdmin           = SettingService.EmailAdmin();

            //-----------------------get item selected value------------------------//
            obj.BirthdayReminderID    = Convert.ToInt32(SettingService.BirthdayReminderID());
            obj.AnniversaryReminderID = Convert.ToInt32(SettingService.AnniversaryReminderID());
            obj.EventReminderID       = Convert.ToInt32(SettingService.EventReminderID());
            obj.SendBirthdayID        = Convert.ToInt32(SettingService.SendBirthdayID());
            obj.SendAnniversaryID     = Convert.ToInt32(SettingService.SendAnniversaryID());
            obj.SendEventID           = Convert.ToInt32(SettingService.SendEventID());
            obj.UpComingReminderID    = Convert.ToInt32(SettingService.UpComingReminderID());



            //--------------get list data from database(lookup table)--------------//

            obj.BirthdayReminder    = SettingService.GetDayBefore();
            obj.AnniversaryReminder = SettingService.GetDayBefore();
            obj.EventReminder       = SettingService.GetDayBefore();
            obj.SendBirthday        = SettingService.GetDayBefore();
            obj.SendAnniversary     = SettingService.GetDayBefore();
            obj.SendEvent           = SettingService.GetDayBefore();
            obj.UpComingReminder    = SettingService.GetUpcoming();


            return(View(obj));
        }
Exemplo n.º 2
0
        //---------------------------------------------Send Email Function Anniversary--------------------------------------//
        public bool SendEmailEmployeeStartDate(string name, string email, string ImagePath, int Id)
        {
            List <string> Data = new List <string>();

            using (RemindersEntities db2 = new RemindersEntities())
            {
                var filter1 = db2.Reminders.Where(x => x.ID == Id).Select(x => x.ID).ToList();
                var filter2 = db2.RemindersGroups.Where(x => filter1.Contains(x.ReminderID)).Select(x => x.GroupID).Distinct().ToList();
                Data = db2.EmployeesGroups.Where(s => filter2.Contains(s.GroupID)).Select(s => s.Employee.Email).ToList();
            }
            ImagePath = "http://localhost//Appointment.Web//" + ImagePath.Replace("~", ".");
            string bod = "<html><body><img src='" + ImagePath + "'></body></html>";

            foreach (var item in Data)
            {
                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
                service.UseDefaultCredentials = false;
                service.Credentials           = new WebCredentials(SettingService.UserName(), SettingService.PasswordSender(), SettingService.smtpaddress());
                service.Url = new Uri("https://mail.sssprocess.com/EWS/Exchange.asmx");
                EmailMessage emailMessage = new EmailMessage(service);
                emailMessage.Subject = name + " Happy Work Anniversary ";
                if (ImagePath == null)
                {
                    emailMessage.Body = SettingService.AnniversaryEmailText();
                }
                else
                {
                    emailMessage.Body = SettingService.AnniversaryEmailText() + bod;
                }
                emailMessage.ToRecipients.Add(item);
                emailMessage.SendAndSaveCopy();
            }
            return(true);
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            //JobScheduler.Start();
            SettingsViewModel obj = new SettingsViewModel();

            obj.settingsView = new SettingsView();

            ViewBag.AdminEmail           = SettingService.EmailAdmin();
            ViewBag.BirthdayEmailText    = SettingService.BirthDayEmailText();
            ViewBag.AnniversaryEmailText = SettingService.AnniversaryEmailText();
            ViewBag.BirthdayReminder     = SettingService.BirthdayReminderEN();
            ViewBag.AnniversaryReminder  = SettingService.AnniversaryReminderEN();
            ViewBag.EventReminder        = SettingService.EventReminderEN();
            ViewBag.SendBirthday         = SettingService.SendBirthdayEN();
            ViewBag.SendAnniversary      = SettingService.SendAnniversaryEN();
            ViewBag.SendEvent            = SettingService.SendEventEN();
            ViewBag.UpComingReminder     = SettingService.UpComingReminderEN();
            return(View());
            //return null;
        }