예제 #1
0
        /// <summary>
        /// This method will call the Event resource method to invite the guest for the event
        /// </summary>
        /// <param name="objEvent">An Event Object which contain event id and Guest List</param>
        public int InviteGuest(Events objEvent)
        {
            int count = 0;

            try
            {
                StateManager objStateManager = StateManager.Instance;
                SessionValue objSessionValue = (SessionValue)objStateManager.Get(PortalEnums.SessionValueEnum.objSessionvalue.ToString(), StateManager.State.Session);

                StateManager objStateManager_ = StateManager.Instance;
                Tributes objTribute = (Tributes)objStateManager_.Get(PortalEnums.SessionValueEnum.TributeSession.ToString(), StateManager.State.Session);

                TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
                string Servername = (string)stateManager.Get("SERVERNAME", TributesPortal.Utilities.StateManager.State.Session);

                EventResource objEventRes = new EventResource();
                Events objEventDetails = objEventRes.GetEventInfo(objEvent);

                //Added by amit
                objEventDetails.EventID = objEvent.EventID;
                objEventDetails.TributeId = objEvent.TributeId;
                objEventDetails.IsActive = true;
                objEventDetails.UserId = objEvent.UserId;
                objEventDetails.ModifiedBy = objEvent.UserId;
                objEventDetails.TributeType = objEvent.TributeType;
                objEventDetails.EventThemeID = objEvent.EventThemeID;
                objEventDetails.EventMessage = objEvent.EventMessage;
                objEventDetails.State = objEvent.State;
               // objEventDetails.IsAskForMeal = objEventRes.IsAskForMeal;
                objEventRes.UpdateEvent(objEventDetails);

                string EmailSubject = objSessionValue.FirstName + " " + objSessionValue.LastName + " invited you to the event \"" + objEventDetails.EventName + "\"";
                for (int i = 0; i < objEvent.EventAwaiting.Count; i++)
                {
                    Events emailEvent = new Events();
                    emailEvent.EventID = objEvent.EventID;
                    emailEvent.EmailId = objEvent.EventAwaiting[i].UserName.ToString();
                    emailEvent.IsAskForMeal = objEventDetails.IsAskForMeal;
                    emailEvent.MealOptions = objEventDetails.MealOptions;
                    object identity = objEventRes.InviteGuest(emailEvent);
                    if (identity != null)
                    {
                        if (int.Parse(identity.ToString()) != 0)
                        {
                            //Insert the Hashcode for the Guest
                            string Hashcode = GetHashCode(int.Parse(identity.ToString()));
                            objEventRes.InsertHashCodeForGuest(int.Parse(identity.ToString()), Hashcode);

                            EmailMessages objEmail = EmailMessages.Instance;

                            EventTheme objTheme = GetEventThemeByID(objEventDetails.EventThemeID);

                            StringBuilder objEmailBody = new StringBuilder();
                            objEmailBody.Append("<html>");
                            objEmailBody.Append("<head>");
                            objEmailBody.Append("<title>Event Invitation Mail</title>");
                            objEmailBody.Append("</head>");
                            objEmailBody.Append("<body text='#000000' link='#000000'>");
                            objEmailBody.Append("<table width='700' border='0' align='center' cellpadding='0' cellspacing='0'>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><table width='100%' border='0' cellspacing='10' cellpadding='0'>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>Having trouble seeing this email? <a href='http://" + objEventDetails.TributeType.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "/event.aspx?EventID=" + objEventDetails.EventID + "'> Visit our Event webpage.</a></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("</table></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td><table width='520' height='650' border='0' align='center' cellpadding='0' cellspacing='10' bgcolor='" + objTheme.ThemeBackgroundColor + "'>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><img src='" + GetImageURL(objTheme.ThemeFullSizeImage) + "' alt='Invitation Photo' /></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>&nbsp;</font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><strong><font size='4' face='Verdana, Arial, Helvetica, sans-serif'>" + objEventDetails.EventName + " </font></strong></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" + objEventDetails.EventMessage + " </font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><strong>When:</strong></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" + DateTime.Parse(objEventDetails.EventDate.ToString()).ToString("MMMM dd, yyyy") + ", " + objEventDetails.EventStartTime + " - " + objEventDetails.EventEndTime + "</font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><strong>Where:</strong></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" + objEventDetails.EventPlace + "</font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><strong>Website:</strong></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><a href='http://" + objEventDetails.TributeType.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "/'>http://" + objEventDetails.TributeType.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "/</a></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>&nbsp;</font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("</table>");
                            objEmailBody.Append("</td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td><table width='100%' border='0' cellspacing='10' cellpadding='0'>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><a href='http://" + objEventDetails.TributeType.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + objEvent.TributeURL + "/event.aspx?EventID=" + objEventDetails.EventID + "&TributeID=" + objEventDetails.TributeId + "&Hashcode=" + Hashcode + "'><b><font size='4' face='Verdana, Arial, Helvetica, sans-serif'>Please visit our " + objEventDetails.TributeType + " Tribute to RSVP</font></b></a></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("</table>");
                            objEmailBody.Append("</td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td><table width='100%' border='0' cellspacing='5' cellpadding='0'>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font color='#666666' size='1' face='Verdana, Arial, Helvetica, sans-serif'>This email has a unique link just for you, please do not forward it to others.</font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font color='#666666' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Your Tribute respects your privacy. For any privacy concerns please <a href='"+ WebConfig.AppBaseDomain +"privacy.aspx'>click here.</a></font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font color='#666666' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Your Tribute, Inc.</font></td>");
                            objEmailBody.Append("</tr>");
                            objEmailBody.Append("<tr>");
                            objEmailBody.Append("<td align='center'><font color='#666666' size='1' face='Verdana, Arial, Helvetica, sans-serif'>2875 North Lamb Blvd. Bldg 8, Las Vegas, NV 89115</font></td>");
                            objEmailBody.Append("</tr></table></td>");
                            objEmailBody.Append("</tr></table></body></html>");

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

            return count;
        }
예제 #2
0
        /// <summary>
        /// This method will call the Event Resource class method to get the 
        /// Image List, Event Type, Country List, and Event Detail
        /// </summary>
        /// <param name="objEvent">An Event Object which contain Tribute and Event information</param>
        /// <returns>This method will return the Events object which contain the Event information</returns>
        public Events GetEventInfo(Events objEvent)
        {
            try
            {
                EventResource objEventRes = new EventResource();
                return objEventRes.GetEventInfo(objEvent);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }