/// <summary> /// This method will call the Story Resource access class method to Delete the Topic from the /// More about section and also send a email to all admin user /// </summary> /// <param name="objStory">stories object which contain the Section id and Userbioagraphy ID /// of the topic which topic user wants to delete /// </param> public void DeleteTopic(Stories objStory) { try { StoryResource objStoryRes = new StoryResource(); objStoryRes.DeleteTopic(objStory); } catch (Exception ex) { throw ex; } }
/// <summary> /// This method will call the Story Resource access class method to get the Tribute Detail, /// Story, and List of topic in More About section. and calcumate the age of the User. /// </summary> /// /// <param name="objStory"> This is the stories object which contain the Tribute ID to get ///the story for that tribute and user ID to get that user is admin or not for that tribute /// </param> /// /// <returns> This method will return the story object /// </returns> public Stories GetStoryDetail(Stories objStoryParam) { try { StoryResource objStoryRes = new StoryResource(); Stories objStory = objStoryRes.GetStoryDetail(objStoryParam); if (objStory.TributeType == "Memorial") { objStory.Age = CalculateAge( objStory.Date1, objStory.Date2 ); } return objStory; } catch (Exception ex) { throw ex; } }
/// <summary> /// Method to send email to the list of users /// </summary> /// <param name="TribuetId">Tribute ID to get the list of admin</param> /// <param name="strSubject">Subject of the mail</param> public void SendEmail(int TribuetId, string strSubject, string EmailBody) { StoryResource objStoryRes = new StoryResource(); UserInfo objUser = objStoryRes.GetTributeAdministrators(TribuetId, "Gift"); //Function to send the mail to the list of users who have added the Tribute in their list of favourites UserInfo objUserFav = objStoryRes.GetFavouriteTributeUsers(TribuetId, "Gift"); EmailMessages objEmail = EmailMessages.Instance; if (objUser.UserEmail != "") { bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + "<" + WebConfig.NoreplyEmail + ">", objUser.UserEmail, strSubject, CreateBody(EmailBody), EmailMessages.TextFormat.Html.ToString()); } //favourite mail //As per discussion with Rupendra: will send the mail in "To" field. //ie a comma separated list of users in the "to" field if (objUserFav.UserEmail != "") { bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + "<" + WebConfig.NoreplyEmail + ">", objUserFav.UserEmail, strSubject, CreateBody(EmailBody), EmailMessages.TextFormat.Html.ToString()); } }
public void SendSponsorMailsWithMessage(String Sponsor, String Message, int TributeId, string TributeType, string TributeName, string TributeUrl, string Expiry, int PackageId) { string _EmailBody = string.Empty; EmailMessages objEmail = EmailMessages.Instance; MailBodies objMail = new MailBodies(); StoryResource objStoryRes = new StoryResource(); UserInfo objUser = new UserInfo(); objUser = objStoryRes.GetTributeAdministrators(TributeId, ""); if (PackageId == 2 || PackageId == 5 || PackageId == 7) { _EmailBody = objMail.TributeSponsor1YearWithMessage(Sponsor, Message, TributeType, TributeName, TributeUrl, Expiry); } if (PackageId == 1 || PackageId == 4 || PackageId == 6) _EmailBody = objMail.TributeSponsorLifeWithMessage(Sponsor, Message, TributeType, TributeName, TributeUrl, Expiry); bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + "<" + WebConfig.NoreplyEmail + ">", objUser.UserEmail, Sponsor + " has sponsored the " + TributeName + " " + TributeType + " " + WebConfig.ApplicationWordForInternalUse + "...", _EmailBody, EmailMessages.TextFormat.Html.ToString()); }
//New Methods added for Sponsor email functionality. public void SendSponsorMails(String Sponsor, string FromUserEmail, int TributeId, string TributeType, string TributeName, string TributeUrl, string Expiry, int PackageId) { string _EmailBody = string.Empty; EmailMessages objEmail = EmailMessages.Instance; MailBodies objMail = new MailBodies(); StoryResource objStoryRes = new StoryResource(); UserInfo objUser = new UserInfo(); objUser = objStoryRes.GetTributeAdministrators(TributeId, ""); if (PackageId == 2 || PackageId == 5 || PackageId == 7) { _EmailBody = objMail.TributeSponsor1Year(Sponsor, TributeId, TributeType, TributeName, TributeUrl, Expiry); } if (PackageId == 1 || PackageId == 4 || PackageId == 6) _EmailBody = objMail.TributeSponsorLife(Sponsor, TributeId, TributeType, TributeName, TributeUrl, Expiry); if (Sponsor != null && Sponsor != String.Empty) { // For the anonymous email when the sponsor does not want to show who he is to the tribute owner if (Sponsor.Contains("An anonymous person")) { bool val = objEmail.SendMessages(FromUserEmail, objUser.UserEmail, "Someone has sponsored the " + TributeName + " " + TributeType + " " + WebConfig.ApplicationWordForInternalUse + "...", _EmailBody, EmailMessages.TextFormat.Html.ToString()); } else { bool val = objEmail.SendMessages(FromUserEmail, objUser.UserEmail, Sponsor + " sponsored the " + TributeName + " " + TributeType + " " + WebConfig.ApplicationWordForInternalUse + "...", _EmailBody, EmailMessages.TextFormat.Html.ToString()); } } }
/// <summary> /// This Method will call the Story Resource access class method to get the Topic list /// </summary> /// /// <param name="objStoryParam">An object which contain the Tribute type for which wants to get the Topic list /// </param> /// /// <returns>This method will return the StoryMoreAbout object which contain the list of topic /// </returns> public IList<StoryMoreAbout> GetTopic(object[] objStoryParam) { try { StoryResource objStoryRes = new StoryResource(); return objStoryRes.GetTopic(objStoryParam); } catch (Exception ex) { throw ex; } }
/// <summary> /// This method will calculate the age of the user if tribute is memorial /// </summary> /// <param name="Date1">This is datetime object which is date of Birth</param> /// <param name="Date2">This is datetime object which is date of Death</param> /// <returns>This will return the </returns> private string CalculateAge(Nullable<DateTime> Date1, Nullable<DateTime> Date2) { try { if ((Date1 != null) && (Date1.ToString() != "") && (Date2 != null) && (Date2.ToString() != "")) { Stories story = new Stories(); story.Date1 = Date1; story.Date2 = Date2; TributesPortal.ResourceAccess.StoryResource sr=new StoryResource (); story =sr.ClaculateAge(story); if (story.Age != "0") return story.Age; else return "<1"; } else { return "0"; } } catch (Exception ex) { throw ex; } }
/// <summary> /// This method will call the Story Resource access class method to update the tribute detail /// and also send a email to all admin user /// </summary> /// /// <param name="objTribute">Stories object which contain the Tribute detail which user want to update /// </param> public void UpdateTributeDetail(Stories objStory) { try { StoryResource objStoryRes = new StoryResource(); objStoryRes.UpdateTributeDetail(objStory); 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); string UserName = objSessionValue.FirstName == string.Empty ? objSessionValue.UserName : (objSessionValue.FirstName + " " + objSessionValue.LastName); string EmailSubject = UserName + " updated a story on Your Tribute..."; StringBuilder obhstrb = new StringBuilder(); obhstrb.Append("<font style='font-size: 12px; font-family:Lucida Sans;'><p>" + UserName + " updated the story in the " + objTribute.TributeName + " " + objTribute.TypeDescription + " Tribute.</p>"); obhstrb.Append("<p>To read the story, follow the link below:<br/>"); string strLink = "http://" + objTribute.TypeDescription.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + objTribute.TributeUrl + "/story.aspx"; obhstrb.Append("<a href='" + strLink + "' >" + strLink + "</a><p>"); obhstrb.Append("<p>---<br/>"); obhstrb.Append("Your Tribute Team</p></font>"); SendEmail(objStory.TributeId, EmailSubject, obhstrb.ToString()); } catch (Exception ex) { throw ex; } }
public void UpdateObituaryDetail(Stories objStory) { try { StoryResource objStoryRes = new StoryResource(); objStoryRes.UpdateObituaryDetail(objStory); } catch (Exception ex) { throw ex; } }
/// <summary> /// Method to send email to the list of users /// </summary> /// <param name="TribuetId">Tribute ID to get the list of admin</param> /// <param name="strSubject">Subject of the mail</param> public void SendEmail(int TribuetId, string strSubject, string strBody, string FromUserEmail) { StoryResource objStoryRes = new StoryResource(); UserInfo objUser = new UserInfo(); objUser = objStoryRes.GetTributeAdministrators(TribuetId, ""); EmailMessages objEmail = EmailMessages.Instance; bool val = objEmail.SendMessages(FromUserEmail, objUser.UserEmail, strSubject, strBody, EmailMessages.TextFormat.Html.ToString()); }