Esempio n. 1
0
        public bool SendEmail(string[] email)
        {
            string subject = "Example Subject Message";
            string body    = "Example Body Message";

            ICSFileModel icsFileModel = new ICSFileModel()
            {
                Location    = "Derivative C",
                Subject     = subject,
                Description = "Schedule Decription",
                StartDate   = DateTime.Now,
                EndDate     = DateTime.Now
            };

            return(_service.SendEmailICS(email, subject, body, icsFileModel));
        }
Esempio n. 2
0
        public void DistributeReminder(bool sendCalendar = false)
        {
            var recipients = context.Users.Where(t => t.IsActive == true && t.IsDeleted != true && t.IsDraft == false && t.Email != null).Select(t => t.Email).ToArray();

            if (recipients.Length <= 0)
            {
                return;
            }

            var date = DateTime.Today.Date;

            var reminders = GetReminders(date);

            var subject = $"App Reminders {date.ToString("dd MMMM yyyy", new System.Globalization.CultureInfo("id-ID"))}";

            var body = CreateBody(reminders);

            ICSFileModel icsFileModel = new ICSFileModel()
            {
                Location    = "Location",
                Subject     = subject,
                Description = subject,
                StartDate   = date.ChangeTime(16, 0, 0, 0),
                EndDate     = date.ChangeTime(8, 0, 0, 0),
                IcsGuid     = Guid.NewGuid().ToString(),
                Sequence    = 1.ToString(),
                Method      = "REQUEST"
            };

            if (sendCalendar)
            {
                _emailSvc.SendEmailICS(recipients, subject, body, icsFileModel);
            }
            else
            {
                _emailSvc.SendEmailOnly(recipients, subject, body);
            }

            try {
                var log = new ActivityLog();

                log.Action      = "Distribute Reminder";
                log.Url         = "";
                log.IPAddress   = "";
                log.HostName    = "";
                log.Modul       = "";
                log.Username    = "******";
                log.CreatedDate = DateTime.Now;
                log.Data        = "Distribute Reminder " + DateTime.Now.ToString("yyyy MMM dd HH:mm:ss");

                context.ActivityLogs.Add(log);

                context.SaveChanges();
            } catch (Exception) {
            }
        }
Esempio n. 3
0
        public void CancelMail(Flow flow)
        {
            string[] emails = flow.Recipients?.Split(',');
            if (flow != null && emails != null && emails.Length > 0)
            {
                string subject = flow.Subject;
                string body    = flow.Body;

                ICSFileModel icsFileModel = new ICSFileModel()
                {
                    Location    = "IDX",
                    Subject     = subject,
                    Description = subject,
                    StartDate   = flow.DueDate ?? DateTime.MinValue,
                    EndDate     = flow.DueDate ?? DateTime.MinValue,
                    IcsGuid     = flow.EmailGuid,
                    Sequence    = ((flow.EmailSequence ?? 1) + 1).ToString(),
                    Method      = "CANCEL"
                };

                _emailSvc.SendEmailICS(emails, subject, body, icsFileModel);
            }
        }