Example #1
0
        public void SendNewInvite(string message, CRM_CalendarAdmin Invite, MainDataContext db, Models.Admin CurrentUser)
        {
            System.IO.StringWriter htmlStringWriter = new System.IO.StringWriter();
            HttpContext.Current.Server.Execute("/app_emails/invites/newinvite.aspx", htmlStringWriter);

            string htmlOutput = htmlStringWriter.GetStringBuilder().ToString();

            htmlOutput = htmlOutput.Replace("@NAME@", Invite.Admin.FirstName);
            htmlOutput = htmlOutput.Replace("@EVENTNAME@", Invite.CRM_Calendar.DisplayName);
            htmlOutput = htmlOutput.Replace("@DATETIME@", Invite.EventDate);
            htmlOutput = htmlOutput.Replace("@INVITED@", CurrentUser.DisplayName);
            htmlOutput = htmlOutput.Replace("@SENDERMESSAGE@", message);
            htmlOutput = htmlOutput.Replace("@ACCEPT@", Invite.CRM_Calendar.RSVPAttend);
            htmlOutput = htmlOutput.Replace("@DECLINE@", Invite.CRM_Calendar.RSVPNotAttend);

            AddTo(Invite.Admin.Email);
            Email.SendTemplateEmail(htmlOutput.ToString(), "You have been tagged to a new event - " + Invite.EventName + " - " + Invite.EventDate, mailTo, mailCc, mailBcc, attachments);

            CRM_Note note = new CRM_Note();

            note.Body            = htmlOutput.ToString();
            note.Title           = "Invite sent";
            note.DateCreated     = UKTime.Now;
            note.TargetReference = Invite.CRM_Calendar.Reference;
            note.OwnerAdminID    = CurrentUser.ID;
            db.CRM_Notes.InsertOnSubmit(note);
            db.SubmitChanges();
        }
Example #2
0
        public void SendRSVP(string message, CRM_CalendarAdmin Invite, MainDataContext db, Models.Admin CurrentUser)
        {
            System.IO.StringWriter htmlStringWriter = new System.IO.StringWriter();
            HttpContext.Current.Server.Execute("/app_emails/invites/RSVP.aspx", htmlStringWriter);

            string htmlOutput = htmlStringWriter.GetStringBuilder().ToString();

            CRM.Code.Models.Admin admin = db.Admins.Single(c => c.ID == Invite.CRM_Calendar.CreatedByAdminID);
            htmlOutput = htmlOutput.Replace("@NAME@", admin.DisplayName);
            htmlOutput = htmlOutput.Replace("@RESPONDER@", Invite.Admin.DisplayName);
            htmlOutput = htmlOutput.Replace("@EVENTNAME@", Invite.CRM_Calendar.DisplayName);
            htmlOutput = htmlOutput.Replace("@DATETIME@", Invite.EventDate);
            htmlOutput = htmlOutput.Replace("@STATUS@", Invite.StatusOutput);
            htmlOutput = htmlOutput.Replace("@SENDERMESSAGE@", message);

            AddTo(admin.Email);
            Email.SendTemplateEmail(htmlOutput.ToString(), "An user has RSVP'd - " + Invite.EventName + " - " + Invite.EventDate, mailTo, mailCc, mailBcc, attachments);

            CRM_Note note = new CRM_Note();

            note.Body            = htmlOutput.ToString();
            note.Title           = "RSVP from " + admin.DisplayName;
            note.DateCreated     = UKTime.Now;
            note.TargetReference = Invite.CRM_Calendar.Reference;
            note.OwnerAdminID    = CurrentUser.ID;
            db.CRM_Notes.InsertOnSubmit(note);
            db.SubmitChanges();
        }
Example #3
0
        public void SendTimeChange(CRM_Calendar PreviousDateDetails, CRM_CalendarAdmin Invite, MainDataContext db, Models.Admin CurrentUser)
        {
            System.IO.StringWriter htmlStringWriter = new System.IO.StringWriter();
            HttpContext.Current.Server.Execute("/app_emails/invites/datetimechange.aspx", htmlStringWriter);

            string htmlOutput = htmlStringWriter.GetStringBuilder().ToString();

            htmlOutput = htmlOutput.Replace("@NAME@", Invite.Admin.FirstName);
            htmlOutput = htmlOutput.Replace("@EVENTNAME@", Invite.CRM_Calendar.DisplayName);
            htmlOutput = htmlOutput.Replace("@OLDDATETIME@", PreviousDateDetails.OutputDate);
            htmlOutput = htmlOutput.Replace("@NEWDATETIME@", Invite.EventDate);
            htmlOutput = htmlOutput.Replace("@CHANGED@", CurrentUser.DisplayName);

            AddTo(Invite.Admin.Email);
            Email.SendTemplateEmail(htmlOutput.ToString(), "An event you are tagged in has been rescheduled - " + Invite.EventName + " originally " + PreviousDateDetails.OutputDate, mailTo, mailCc, mailBcc, attachments);

            CRM_Note note = new CRM_Note();

            note.Body            = htmlOutput.ToString();
            note.Title           = "Reschedule sent";
            note.DateCreated     = UKTime.Now;
            note.TargetReference = Invite.CRM_Calendar.Reference;
            note.OwnerAdminID    = CurrentUser.ID;
            db.CRM_Notes.InsertOnSubmit(note);
            db.SubmitChanges();
        }
        protected void btnSendChange_Click(object sender, EventArgs e)
        {
            IEnumerable <CRM_CalendarAdmin> users = Entity.CRM_CalendarAdmins;

            foreach (CRM_CalendarAdmin invite in users)
            {
                EmailManager manager = new EmailManager();
                manager.AddTo(invite.Admin.Email);
                manager.SendVenueChange(txtMessageToTags.Text, invite, db, AdminUser);
                //invite.Status = Request.QueryString["attend"] == "false" ? (byte)CRM_CalendarAdmin.StatusTypes.NotAttending : (byte)CRM_CalendarAdmin.StatusTypes.Attending;
            }

            CRM_Note note = new CRM_Note();

            note.Body            = txtMessageToTags.Text;
            note.Title           = "Users notified of venue change";
            note.DateCreated     = UKTime.Now;
            note.TargetReference = Entity.Reference;
            note.OwnerAdminID    = 1;
            db.CRM_Notes.InsertOnSubmit(note);
            db.SubmitChanges();

            NoticeManager.SetMessage(users.Count() + " user(s) notified");
        }