예제 #1
0
        /// <summary>
        /// This method will call the Event Resource class method to Update the event in the database
        /// And send the email to all admin about the event updation for all public event and also
        /// resend the mail to all guest list about teh event updation
        /// </summary>
        /// <param name="objEvent">An Event Object which contain updated Event information</param>
        public void UpdateEvent(Events objEvent)
        {
            try
            {
                EventResource objEventRes = new EventResource();

                // First get the Guest List for the event which are going to update
                Events guestList = objEventRes.GetEventGuestList(objEvent);

                // Now Update the Event Detail
                object identity = objEventRes.UpdateEvent(objEvent);

                // Send the email to all the adminstrator if event is public that event has been updated
                if ((objEvent != null) && (objEvent.CustomError == null) && (identity != null)
                    && (int.Parse(identity.ToString()) != 0) && (objEvent.IsPrivate == false))
                {
                    string EmailSubject = objEvent.FirstName + " " + objEvent.LastName + " updated the event \"" + objEvent.EventName + "\"";
                    string EmailBody = "<font style='font-size: 12px; font-family:Lucida Sans;'><p>" + objEvent.FirstName + " " + objEvent.LastName + " updated the event \"" + objEvent.EventName + "\"<br/> <br/> To see more details, follow the link below: <br/> " + objEvent.ServerURL.ToLower() + "<br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";

                    SendEmail(objEvent.TributeId, EmailSubject, EmailBody.Replace("##", objEvent.EventID.ToString()));
                }

                // If an event name an event type combination already exist in database then
                // return an error message
                if (int.Parse(identity.ToString()) == 0)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = "This Event Name '" + objEvent.EventName + "' with this Event Type already exist";
                    objEvent.CustomError = objError;
                }
                else   // Otherwise send the mail to all Guests about the updation
                {
                    // Send the email to all the Guest who are invited for the event that event has been updated
                    if (guestList.EventAwaiting != null)
                    {
                        for (int i = 0; i < guestList.EventAwaiting.Count; i++)
                        {
                            Events emailEvent = new Events();

                            emailEvent.EventID = objEvent.EventID;
                            emailEvent.EmailId = guestList.EventAwaiting[i].UserName.ToString();

                            string EmailSubject = objEvent.FirstName + " " + objEvent.LastName + " invited you to the event " + objEvent.TributeName;
                            string EmailBody = "<font style='font-size: 12px; font-family:Lucida Sans;'><p>" + objEvent.FirstName + " " + objEvent.LastName + " invited you to the event '" + objEvent.EventName + "' in the " + objEvent.TributeName + " Tribute. <br/> <br/> To RSVP and see more details, follow the link below: <br/> <br/>";

                            string href = objEvent.InviteGuestURL + "?EventID=" + objEvent.EventID + "&TributeID=" + objEvent.TributeId + "&mode=emailPage" + "&Email=" + emailEvent.EmailId;
                            EmailBody += href + "'>" + "http://" + objEvent.TributeType.ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "/event.aspx?&EventId=" + objEvent.EventID + "</a>" + "<br/> <br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";

                            EmailMessages objEmail = EmailMessages.Instance;
                            bool val = objEmail.SendMessages("Your Tribute<" + WebConfig.NoreplyEmail + ">", emailEvent.EmailId, EmailSubject, CreateBody(EmailBody), EmailMessages.TextFormat.Html.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// This method will call the Event Resource class method to Delete the event in the database
        /// And send the email to all admin about the event deletion for all public event and also
        /// resend the mail to all guest list about teh event deletion
        /// </summary>
        /// <param name="objEvent">An Event Object which contain event id which wants to delete</param>
        public void DeleteEvent(Events objEvent)
        {
            try
            {
                EventResource objEventRes = new EventResource();

                // First get the Guest List for the event which are going to update
                Events guestList = objEventRes.GetEventGuestList(objEvent);
                TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
                //string Servername = (string)stateManager.Get("SERVERNAME", TributesPortal.Utilities.StateManager.State.Session);

                // Now Delete the Event and Guest List
                objEventRes.DeleteEvent(objEvent);

                // Send the email to all the adminstrator that event has been updated
                if ((objEvent != null) && (objEvent.CustomError == null) && (objEvent.IsPrivate == false))
                {
                    string EmailSubject = string.Empty;

                    if (!string.IsNullOrEmpty(objEvent.LastName))
                        EmailSubject = objEvent.FirstName + " " + objEvent.LastName + " cancelled the event \"" + objEvent.EventName + "\"";
                    else
                        EmailSubject = objEvent.FirstName + " cancelled the event \"" + objEvent.EventName + "\"";
                    string EmailBody = "<font style='font-size: 12px; font-family:Lucida Sans;'><p>" + objEvent.FirstName + " " + objEvent.LastName + " cancelled the event \"" + objEvent.EventName + "\"" + " in the " + objEvent.TributeName + " " + objEvent.TributeType + "  Tribute." +
                        "<br/><br/>" + "To view the tribute, follow the link below:" + "<br/>";
                    //string href = "<a href='http://" + objEvent.TributeType.Trim().ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "'> http://" + Servername + "/" + objEvent.TributeURL + "</a>" + "<br/> <br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";
                    string href = "<a href='http://" + objEvent.TributeType.Trim().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "'> http://" + objEvent.TributeType.Trim().ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "</a>" + "<br/> <br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";
                    EmailBody += href;

                    SendEmail(objEvent.TributeId, EmailSubject, EmailBody);
                }

                if (guestList.EventAwaiting != null)
                {
                    // Send the email to all the Guest who are invited for the event that event has been updated
                    for (int i = 0; i < guestList.EventAwaiting.Count; i++)
                    {
                        Events emailEvent = new Events();
                        emailEvent.EventID = objEvent.EventID;
                        emailEvent.EmailId = guestList.EventAwaiting[i].UserName.ToString();
                        string EmailSubject = string.Empty;

                        if (!string.IsNullOrEmpty(objEvent.LastName))
                            EmailSubject = objEvent.FirstName + " " + objEvent.LastName + " cancelled the event \"" + objEvent.EventName + "\"";
                        else
                            EmailSubject = objEvent.FirstName + " cancelled the event \"" + objEvent.EventName + "\"";

                        string EmailBody = "<font style='font-size: 12px; font-family:Lucida Sans;'><p>" + objEvent.FirstName + " " + objEvent.LastName + "  cancelled the event \"" + objEvent.EventName + "\"" + " in the " + objEvent.TributeName + " " + objEvent.TributeType + " Tribute." +
                        "<br/><br/>" + "To view the tribute, follow the link below:" + "<br/>";
                        //string href = "<a href='http://" + objEvent.TributeType.Trim().ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "'> http://" + Servername + "/" + objEvent.TributeURL + "</a>" + "<br/> <br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";
                        string href = "<a href='http://" + objEvent.TributeType.Trim().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "'> http://" + objEvent.TributeType.Trim().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "</a>" + "<br/> <br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";
                        //string href = "<a href='http://" + objEvent.TributeType.Trim().ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "'> http://" + objEvent.TributeType.Trim().ToLower() + "." + WebConfig.TopLevelDomain + "/" + "/" + objEvent.TributeURL + "</a>" + "<br/> <br/>" + "----" + "<br/>" + "Your Tribute Team</p></font>";
                        EmailBody += href;

                        EmailMessages objEmail = EmailMessages.Instance;
                        bool val = objEmail.SendMessages("Your Tribute<" + WebConfig.NoreplyEmail + ">", emailEvent.EmailId, EmailSubject, CreateBody(EmailBody), EmailMessages.TextFormat.Html.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }