public void SendAdminMails(string Adminmail, string OtherAdminMails, string TributeId, string TributeName, string TributeType, string TributeUrl, string Username)
        {
            UserInfoResource objUser = new UserInfoResource();
            EmailMessages objEmail = EmailMessages.Instance;
            string[] toemails = OtherAdminMails.Split(',');
            for (int i = 0; i < toemails.Length; i++)
            {
                MailBodies objMailbod = new MailBodies();
                string _EmailBody = objMailbod.AdminRequest(Username, TributeType, TributeName, TributeUrl, TributeId, toemails[i]);
                // string _EmailBody = GetAdminBody(TributeId, TributeName, toemails[i]);
                bool val = objEmail.SendMessages(Adminmail, toemails[i], Username + " made you a " + WebConfig.ApplicationWordForInternalUse.ToLower() + " administrator...", _EmailBody, EmailMessages.TextFormat.Html.ToString());

            }
        }
        public void SendAdminMails(int SendByUserId, string SendToUserId, string TributeId, string TributeName, string TributeType, string userName)
        {
            Tributes objTribute = new Tributes();
            objTribute.TributeId = int.Parse(TributeId);
            TributeManager objtrbmngr = new TributeManager();
            objtrbmngr.GetTributeSession(objTribute);

            EmailMessages objEmail = EmailMessages.Instance;
            // string fromMail = GetEmail(SendByUserId);
            string fromMail = "Your Tribute <" + WebConfig.NoreplyEmail + ">";
            string tomail = SendToUserId;

            MailBodies objMailbod = new MailBodies();
            string _EmailBody = objMailbod.AdminRequest(userName, TributeType, TributeName, objTribute.TributeUrl, TributeId, tomail);

            bool val = objEmail.SendMessages(fromMail, tomail, userName + " made you a " + WebConfig.ApplicationWordForInternalUse.ToLower() + " administrator...", _EmailBody, EmailMessages.TextFormat.Html.ToString());
        }
        public void ChangeEmailPassword(GenralUserInfo _objGenralUserInfo)
        {
            UserInfoResource objUser = new UserInfoResource();
            object[] param = { _objGenralUserInfo };
            string usermail = GetEmail(_objGenralUserInfo.RecentUsers.UserID);
            try
            {
                string _EmailBody = string.Empty;
                string _Subject = string.Empty;
                if (objUser.ChangeEmailPassword(param) > 0)
                {
                    EmailMessages objEmail = EmailMessages.Instance;
                    //string _EmailBody = GetEmailBodyOnEmailAndPasswordChanged(_objGenralUserInfo.RecentUsers);
                    MailBodies objMail = new MailBodies();
                    if ((_objGenralUserInfo.RecentUsers.UserEmail.Length != 0) && (_objGenralUserInfo.RecentUsers.UserPassword.Length > 0))
                    {
                        _Subject = "Your Tribute Password and Email Reminder";
                        _EmailBody = objMail.ChangeEmailPassword(_objGenralUserInfo.RecentUsers.UserName, _objGenralUserInfo.RecentUsers.UserEmail, _objGenralUserInfo.RecentUsers.UserPassword);

                    }
                    else if ((_objGenralUserInfo.RecentUsers.UserEmail.Length == 0) && (_objGenralUserInfo.RecentUsers.UserPassword.Length != 0))
                    {
                        _Subject = "Your Tribute Password Reminder";
                        _EmailBody = objMail.ForgetPassword(_objGenralUserInfo.RecentUsers.UserName, _objGenralUserInfo.RecentUsers.UserPassword);
                    }
                    else if ((_objGenralUserInfo.RecentUsers.UserEmail.Length != 0) && (_objGenralUserInfo.RecentUsers.UserPassword.Length == 0))
                    {
                        _Subject = "Your Tribute Email Reminder";
                        _EmailBody = objMail.ChangeEmail(_objGenralUserInfo.RecentUsers.UserName, _objGenralUserInfo.RecentUsers.UserEmail);
                    }

                    bool val = objEmail.SendMessages(ForgetPassAdmin, usermail, _Subject, _EmailBody, EmailMessages.TextFormat.Html.ToString());

                }
            }
            catch (Exception ex)
            {
                Errors objError = new Errors();
                objError.ErrorMessage = ex.Message;
                _objGenralUserInfo.CustomError = objError;
            }
        }
        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());
         }
     }
 }
        //System.Configuration.ConfigurationManager.
        public void SendOwnerMails(string TributeOwner, string TributeId, string TributeName, int Packageid, string TributeType, string TributeUrl, bool Notifyme, string userName)
        {
            string _EmailBody = string.Empty;
            EmailMessages objEmail = EmailMessages.Instance;
            MailBodies objMail = new MailBodies();

            if(WebConfig.ApplicationType.ToLower()=="yourmoments")
            {
                if ((Packageid == 3) || (Packageid == 8) || (Packageid == 9) || (Packageid == 10) || (Packageid == 13) || (Packageid == 14))
                    _EmailBody = objMail.CreationFree(userName, TributeType, TributeName, TributeUrl, TributeId);
                else if ((Packageid == 2) || (Packageid == 5) || (Packageid == 7) || (Packageid == 12))
                {
                    if (Notifyme.Equals(true))
                        _EmailBody = objMail.Creation1YearAuto(userName, TributeType, TributeName, TributeUrl, TributeId);
                    else
                        _EmailBody = objMail.Creation1Year(userName, TributeType, TributeName, TributeUrl, TributeId);
                }
                else if ((Packageid == 1) || (Packageid == 4) || (Packageid == 6) || (Packageid == 11))
                    _EmailBody = objMail.CreationLifeTime(userName, TributeType, TributeName, TributeUrl, TributeId);
                //string _EmailBody = GetOwnerAdminBody(TributeId,TributeName);
                if (HttpContext.Current.Session["FromVideoTributeCreation"] == null)
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + TributeCreationAdmin + ">", TributeOwner, "Your " + TributeType + " " + WebConfig.ApplicationWordForInternalUse + " has been created", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                }
                else
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + TributeCreationAdmin + ">", TributeOwner, "Your " + TributeType + " " + WebConfig.ApplicationWordForInternalUse + " has been created", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                }
            }
            else
            {
                // Changes for new tribute packages in website upgrade phase 1 by UD
                if ((Packageid == 3) || (Packageid == 9) || (Packageid == 10) || (Packageid == 13) || (Packageid == 14))
                {
                    _EmailBody = objMail.CreationFree(Packageid, userName, TributeType, TributeName, TributeUrl, TributeId);
                }
                else if (Packageid == 8)
                {
                    _EmailBody = objMail.CreationObituaryFree(userName, TributeType, TributeName, TributeUrl, TributeId);
                }
                else if ((Packageid == 6) || (Packageid == 7))
                {
                    _EmailBody = objMail.CreationPremiumObituary(userName, TributeType, TributeName, TributeUrl, TributeId);
                }
                else if ((Packageid == 2) || (Packageid == 5) || (Packageid == 12))
                {
                    _EmailBody = objMail.CreationMemorialTribute1Year(userName, TributeType, TributeName, TributeUrl, TributeId);
                }
                else if ((Packageid == 1) || (Packageid == 4) || (Packageid == 11))
                {
                    _EmailBody = objMail.CreationMemorialLifeTime(userName, TributeType, TributeName, TributeUrl, TributeId);
                }

                if ((Packageid == 12) || (Packageid == 13) || (Packageid == 14))
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + TributeCreationAdmin + ">", TributeOwner, "Your Video Only Tribute has been created", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                }
                else if ((Packageid == 9) || (Packageid == 10) || (Packageid == 1) || (Packageid == 2))
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + TributeCreationAdmin + ">", TributeOwner, "Your Video Tribute has been created", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                }
                else if ((Packageid == 3) || (Packageid == 8) || (Packageid == 6) || (Packageid == 7))
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + TributeCreationAdmin + ">", TributeOwner, "Your Obituary has been created", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                }
                else
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + TributeCreationAdmin + ">", TributeOwner, "Your Memorial Tribute has been created", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                }
            }
        }
        /*public string GetEventName(int _EventId)
        {
            UserInfoResource objUser = new UserInfoResource();
            return objUser.GetEventName(_EventId);
        }*/
        public void CheckAndSendPassword(GenralUserInfo _objGenralUserInfo, bool _Reset)
        {
            UserInfoResource objUser = new UserInfoResource();
            object[] param = { _objGenralUserInfo };
            objUser.CheckAndSendPassword(param, _Reset);

            if (_objGenralUserInfo.CustomError == null)
            {
                EmailMessages objEmail = EmailMessages.Instance;
                //string _EmailBody = GetEmailBody(_objGenralUserInfo.RecentUsers);
                MailBodies objMail = new MailBodies();
                string Password = TributePortalSecurity.Security.DecryptSymmetric(_objGenralUserInfo.RecentUsers.UserPassword);
                string _EmailBody = objMail.ForgetPassword(_objGenralUserInfo.RecentUsers.UserName, Password);
                bool val = objEmail.SendMessages(ForgetPassAdmin, _objGenralUserInfo.RecentUsers.UserEmail, "Your Tribute Password Reminder", _EmailBody, EmailMessages.TextFormat.Html.ToString());
                // bool val = objEmail.SendMessages("*****@*****.**", "*****@*****.**", "Forgot password", _EmailBody, EmailMessages.TextFormat.Html.ToString());

            }
        }