public void SendMail(int SendByUserId, int SendToUserId, string Subject, string _EmailBody)
        {
            MailMessage _objMailMessage = new MailMessage();
            _objMailMessage.SendByUserId = SendByUserId;
            _objMailMessage.Subject = Subject;
            _objMailMessage.Body = _EmailBody;
            _objMailMessage.SendToUserId = SendToUserId;
            _objMailMessage.SendDate = DateTime.Now;
            _objMailMessage.Status = 1;
            _objMailMessage.RecievedDate = DateTime.Now;
            _objMailMessage.CreatedBy = SendByUserId;
            _objMailMessage.CreatedDate = DateTime.Now;
            _objMailMessage.ModifiedBy = SendByUserId;
            _objMailMessage.ModifiedDate = DateTime.Now;
            _objMailMessage.IsActive = true;
            _objMailMessage.IsDeleted = false;
            object[] _ParamMail = { _objMailMessage };
            UserInfoResource objUser = new UserInfoResource();

            if (objUser.SaveEmail(_ParamMail) > 0)
            {
                EmailMessages objEmail = EmailMessages.Instance;

                //to get user details of from user id
                UserRegistration objFromUserInfo = new UserRegistration();
                objFromUserInfo = (UserRegistration)GetUserDetails(SendByUserId);
                //to get user details of TO user id
                UserRegistration objToUserInfo = new UserRegistration();
                objToUserInfo = (UserRegistration)GetUserDetails(SendToUserId);
                if (objToUserInfo.EmailNotification.MessagesNotify)
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + WebConfig.NoreplyEmail + ">", objToUserInfo.Users.Email, GetEmailSubject(objFromUserInfo), GetEmailBody(objFromUserInfo, objToUserInfo, Subject, _EmailBody), EmailMessages.TextFormat.Html.ToString());
                }
            }
        }
        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 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 Users GetUserDetailsOnUserId(int userId)
 {
     UserInfoResource objUserInfoResource = new UserInfoResource();
     return objUserInfoResource.GetUserDetailsOnUserId(userId);
 }
 private string GetEmail(int UserId)
 {
     string email = string.Empty;
     Users objusr = new Users();
     objusr.UserId = UserId;
     UserRegistration objUserReg = new UserRegistration();
     objUserReg.Users = objusr;
     object[] objparam = { objUserReg };
     UserInfoResource objinfo = new UserInfoResource();
     objinfo.GetUserDetails(objparam);
     if (objUserReg.Users != null)
         email = objUserReg.Users.Email;
     return email;
 }
    public void UserLogOut()
    {
        UserInfoResource UIResource = new UserInfoResource();
        var fbWebcontext = FacebookWebContext.Current;
        HttpContext.Current.Session.Clear();
        pagebase.killFacebookCookies();

        try
        {
            if (fbWebcontext.Session != null)
            {
                fbWebcontext.DeleteAuthCookie();
            }
        }
        catch
        { }

        HttpContext.Current.Session.RemoveAll();
        StateManager stateManager = StateManager.Instance;
        UIResource.DeleteSession(HttpContext.Current.Session.SessionID);
        stateManager.Remove("objSessionvalue", StateManager.State.Session);
        HttpContext.Current.Session.Clear();
        HttpContext.Current.Session.Abandon();
    }
        private void SendMail(UserRegistration _objGenralUserInfo, int Userid, UserInfoResource objUser)
        {
            string SIGNUPAdmin = WebConfig.SIGNUPAdmin;
            EmailMessages objEmail = EmailMessages.Instance;
            _objGenralUserInfo.Users.FirstName = _objGenralUserInfo.UserBusiness == null ? _objGenralUserInfo.Users.FirstName : _objGenralUserInfo.UserBusiness.CompanyName;
            _objGenralUserInfo.Users.LastName = _objGenralUserInfo.UserBusiness == null ? _objGenralUserInfo.Users.LastName : string.Empty;
            string _EmailBody = GetEmailAccountBody(_objGenralUserInfo.Users);
            bool val = objEmail.SendMessages("Your Tribute<" + SIGNUPAdmin + ">", _objGenralUserInfo.Users.Email, "Welcome to Your Tribute", _EmailBody, EmailMessages.TextFormat.Html.ToString());
            if (val == true)
            {
                //MailMessage _objMailMessage = new MailMessage();
                //_objMailMessage.SendByUserId = Userid;
                //_objMailMessage.Subject = "User Registration";
                //_objMailMessage.Body = _EmailBody;
                //_objMailMessage.SendToUserId = Userid;
                //_objMailMessage.SendDate = DateTime.Now;
                //_objMailMessage.Status = 1;
                //_objMailMessage.RecievedDate = DateTime.Now;
                //_objMailMessage.CreatedBy = Userid;
                //_objMailMessage.CreatedDate = DateTime.Now;
                //_objMailMessage.ModifiedBy = Userid;
                //_objMailMessage.ModifiedDate = DateTime.Now;
                //_objMailMessage.IsActive = true;
                //_objMailMessage.IsDeleted = false;
                //object[] _ParamMail ={ _objMailMessage };
                //objUser.SaveEmail(_ParamMail);

                //if (_objMailMessage.CustomError != null)
                //{
                //    _objGenralUserInfo.CustomError = _objMailMessage.CustomError;
                //}

            }
        }
 public void UserSiteAdminLogin(GenralUserInfo _objGenralUserInfo)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objGenralUserInfo };
     objUser.SignInSiteAdmin(param);
 }
 //public IList<Locations> Locations(Locations locaton)
 //{
 //    LocationResource objLocationResource = new LocationResource();
 //    return objLocationResource.LocationList(locaton);
 //}
 public int UserInboxCount(object[] objValue)
 {
     UserInfoResource objUser = new UserInfoResource();
     return objUser.UserInboxCount(objValue);
 }
 /// <summary>
 ///  This method will call the UserInfoResource Resource class method for saving the company logo
 /// Added By Parul Jain
 /// </summary>
 /// <param name="objTributeParam">A object which contain the company logo which wants to save</param>
 public void SaveImage(UserBusiness objBusinessUser)
 {
     try
     {
         UserInfoResource objUser = new UserInfoResource();
         objUser.SaveImage(objBusinessUser);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// Method to check if user is Owner of Type(Video, Photo etc.)
 /// Added By: Gaurav Puri
 /// </summary>
 /// <param name="objUserInfo">UserAdminOwnerInfo entity containing UserId, TypeId and TypeName</param>
 /// <returns>True/False</returns>
 public bool IsUserOwner(UserAdminOwnerInfo objUserInfo)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { objUserInfo };
     return objUser.IsUserOwner(param);
 }
        /// <summary>
        /// Method to insert Session
        /// </summary>
        public void InsertSession(SessionValue _objSessionValue, string strId)
        {
            UserInfoResource objUser = new UserInfoResource();
            object[] param = { _objSessionValue, strId };

            //  System.Decimal identity = (System.Decimal)objUser.InsertSessionValues(param);
            int identity = Convert.ToInt32(objUser.InsertSessionValues(param));

            _objSessionValue.ID = int.Parse(identity.ToString());
            //UserId
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "UserId", _objSessionValue.UserId.ToString());
            //UserName
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "UserName", _objSessionValue.UserName);
            //FirstName
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "FirstName", _objSessionValue.FirstName);
            //LastName
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "LastName", _objSessionValue.LastName);
            //Email
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "Email", _objSessionValue.UserEmail);
            //UserType
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "UserType", _objSessionValue.UserType.ToString());
            //UserTypeDescription
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "UserTypeDescription", _objSessionValue.UserTypeDescription);
            //IsUsernameVisiable
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "IsUsernameVisiable", _objSessionValue.IsUsernameVisiable.ToString());
            //Added by rupendra to get logged in user image
            //UserImage
            if (_objSessionValue.UserImage != null)
                objUser.InsertSessionKeyValues(_objSessionValue.ID, "UserImage", _objSessionValue.UserImage.ToString());
            else
                objUser.InsertSessionKeyValues(_objSessionValue.ID, "UserImage", "");
            // Added by Varun to store NoRedirection boolean
            objUser.InsertSessionKeyValues(_objSessionValue.ID, "NoRedirection", _objSessionValue.NoRedirection.ToString());
        }
 public IList<GetTributesFeed> GetYourTributesFeed(object[] objparam)
 {
     UserInfoResource objUser = new UserInfoResource();
      return objUser.GetYourTributesFeed(objparam);
 }
 public List<MailMessage> GetuserSentMessages(object[] objValue)
 {
     UserInfoResource objUser = new UserInfoResource();
     return objUser.GetuserSentMessages(objValue);
 }
 public void GetUserProfile(object[] objValue)
 {
     UserInfoResource objUser = new UserInfoResource();
     objUser.GetUserProfile(objValue);
 }
 public void UpdatePrivacySettings(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     objUser.UpdatePrivacySettings(param);
 }
 public void UserAvailability(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     objUser.UserAvailability(param);
 }
 /// <summary>
 ///  This method will call the UserInfoResource Resource class method for saving the message
 /// Added By Parul Jain
 /// </summary>
 /// <param name="objTributeParam">A object which contain the welcome message which wants to save</param>
 public void SaveMessage(UserBusiness objBusinessUser,string ApplicationType)
 {
     try
     {
         UserInfoResource objUser = new UserInfoResource();
         objUser.SaveMessage(objBusinessUser, ApplicationType);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void UserLogin(GenralUserInfo _objGenralUserInfo)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objGenralUserInfo };
     objUser.CheckLogin(param);
 }
        //private string SetInternal()
        //{
        //    StringBuilder objstrb = new StringBuilder();
        //    //objstrb.Append("<P>"<P>);
        //    //        "Welcome to Your Tribute!
        //    //Now that you have registered you can begin collaborating with friends and family:
        //    //• leave messages in their guestbooks
        //    //• share photos and videos
        //    //• send virtual gifts
        //    //• receive event invites and updates
        //    //You can also:
        //    //• create your own tribute to celebrate a significant event or a special someone
        //    //• send private messages—simply click on another member’s name to open the profile and communicate one-to-one
        //    //• upload a profile picture of yourself—you can upload a picture, an icon, or a drawing, and it will show up wherever you add content on Your Tribute. To add a profile picture, click the ""My Profile"" link in the top navigation bar and then click the ""Edit My Profile"" button
        //    //Take a Tour to learn more about Your Tribute, or find Help at the bottom of any page.
        //    //----
        //    //Your Tribute Team
        //    //"
        //}
        public object SavePersonalAccount(UserRegistration _UserRegistration)
        {
            UserInfoResource objUserinfo = new UserInfoResource();
            object[] param = { _UserRegistration };

            using (TransactionScope trans = new TransactionScope())
            {
                objUserinfo.SaveUserAccount(param).ToString();
                //Transaction Completed
                if (_UserRegistration.CustomError == null)
                {
                    trans.Complete();
                }
            }

            if (_UserRegistration.CustomError == null &&
                !_UserRegistration.Users.Email.Equals(string.Empty) &&
                !_UserRegistration.Users.Password.Equals(string.Empty))
            {
                SendMail(_UserRegistration, _UserRegistration.Users.UserId, objUserinfo);
            }
            return _UserRegistration.Users.UserId;
        }
 public void UserSummaryReport(UsersSummaryReport objSummary, string applicationType)
 {
     UserInfoResource objUser = new UserInfoResource();
     objUser.UserSummaryReport(objSummary, applicationType);
 }
 public void UpdateEmailNotofication(object[] param)
 {
     UserInfoResource objUserInfoResource = new UserInfoResource();
     objUserInfoResource.UpdateEmailNotofication(param);
 }
        /*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());

            }
        }
 public void UpdateFacebookAssociation(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     objUser.UpdateFacebookAssociation(_objUserRegistration);
 }
    public void UserLogOut()
    {
        //HttpContext.Current.Response.Cookies.Clear();
        UserInfoResource UIResource = new UserInfoResource();
        PageBase pb = new PageBase();
        var fbWebcontext = FacebookWebContext.Current;

        HttpContext.Current.Session.Clear();
        pb.killFacebookCookies();

        try
        {
            if (fbWebcontext.Session != null)
            {
                fbWebcontext.DeleteAuthCookie();
                // just to be sure...
            }
        }
        catch
        { }

        HttpContext.Current.Session.RemoveAll();
        UsersController _controller = new UsersController();
        StateManager stateManager = StateManager.Instance;
        UIResource.DeleteSession(HttpContext.Current.Session.SessionID);
        stateManager.Remove("objSessionvalue", StateManager.State.Session);
        HttpContext.Current.Session.Clear();
        HttpContext.Current.Session.Abandon();
    }
 public void UpdateFavouriteEmailAlert(object[] _Tributes)
 {
     UserInfoResource objUser = new UserInfoResource();
     objUser.UpdateFavouriteEmailAlert(_Tributes);
 }
 /// <summary>
 /// Method to get user details.
 /// </summary>
 /// <param name="userId">Userid</param>
 /// <returns>UserRegistration entity containing user details.</returns>
 private UserRegistration GetUserDetails(int userId)
 {
     Users objFromUser = new Users();
     objFromUser.UserId = userId;
     UserRegistration objUserReg = new UserRegistration();
     objUserReg.Users = objFromUser;
     object[] objparam = { objUserReg };
     UserInfoResource objFromUserInfo = new UserInfoResource();
     objFromUserInfo.GetUserDetails(objparam);
     return objUserReg;
 }
 public void UpdateMessageStstus(object[] Params)
 {
     UserInfoResource objUser = new UserInfoResource();
     objUser.UpdateMessageStstus(Params);
 }
 public void UpdatePersonalDetails(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     //Transaction started
     using (TransactionScope trans = new TransactionScope())
     {
         objUser.UpdatePersonalDetails(param);
         //Transaction commited
         trans.Complete();
     }
 }
 //Mohit Gupta 31 jan 2011 For tribute upgrade
 public void GetUserDetailsFromEmail(UserRegistration _objUserRegistration, int tributeId)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration, tributeId };
     objUser.GetUserDetailsFromEmail(param);
 }