//
 public void GetUserDetails(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     objUser.GetUserDetails(param);
 }
        /// <summary>
        /// Method to get email body for the message to be sent when user sends message to inbox
        /// </summary>
        /// <param name="objFromUser">From user details</param>
        /// <param name="objToUser">To user details</param>
        /// <param name="strSubject">Subject of message entered by user</param>
        /// <param name="strMessage">Message entered by ujser</param>
        /// <returns>String of email body.</returns>
        private string GetEmailBody(UserRegistration objFromUser, UserRegistration objToUser, string strSubject, string strMessage)
        {
            StringBuilder sbBody = new StringBuilder();

            sbBody.Append("Dear ");
            if (objToUser.Users.UserType == 1)
            {
                if (objToUser.Users.FirstName == string.Empty)
                    sbBody.Append(objToUser.Users.UserName);
                else
                    sbBody.Append(objToUser.Users.FirstName + " " + objToUser.Users.LastName);
            }
            else
            {
                sbBody.Append(objToUser.Users.FirstName);
            }
            //if (objToUser.Users.FirstName != string.Empty && objToUser.Users.LastName != string.Empty)
            //    sbBody.Append(objToUser.Users.FirstName + " " + objToUser.Users.LastName);
            //else
            //    sbBody.Append(objToUser.Users.UserName);

            sbBody.Append(",");
            sbBody.Append("<br/>");
            sbBody.Append("<br/>");

            if (objFromUser.Users.UserType == 1)
            {
                if (objFromUser.Users.FirstName == string.Empty)
                    sbBody.Append(objFromUser.Users.UserName);
                else
                    sbBody.Append(objFromUser.Users.FirstName + " " + objFromUser.Users.LastName);
            }
            else
            {
                sbBody.Append(objFromUser.Users.FirstName);
            }

            sbBody.Append(" sent you a message...");
            sbBody.Append("<br/>");
            sbBody.Append("<br/>");
            //sbBody.Append("-------------");
            sbBody.Append("<br/>");
            sbBody.Append("Subject: " + strSubject);
            sbBody.Append("<br/>");
            sbBody.Append("<br/>");
            if (strMessage.Length > 100)
                sbBody.Append(strMessage.Substring(0, 100) + "...");
            else
            {
                strMessage = strMessage.Replace("\n", "<br/>");
                sbBody.Append(strMessage);
            }

            sbBody.Append("<br/>");
            //sbBody.Append("-------------");
            sbBody.Append("<br/>");
            sbBody.Append("To read and reply to the message, follow the link below:");
            sbBody.Append("<br/>");
            string strLink = "http://www." + WebConfig.TopLevelDomain + "/inbox.aspx";
            sbBody.Append("<a href='http://www." + WebConfig.TopLevelDomain + "/log_in.aspx?mode=inbox'>" + strLink + "</a>");
            sbBody.Append("<br/>");
            sbBody.Append("<br/>");
            sbBody.Append("-------");
            sbBody.Append("<br/>");
            sbBody.Append("Your " + WebConfig.ApplicationWord + "");

            return sbBody.ToString();
        }
 /// <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 GetEmailNotoficationTest()
 {
     UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
     UserRegistration _objUserRegistration = new UserRegistration(); // TODO: Initialize to an appropriate value
     _objUserRegistration.Users = new Users();
     _objUserRegistration.Users.UserId = InsertDummyUser("tj_op");
     target.GetEmailNotofication(_objUserRegistration);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.CommentsNotify);
     Assert.AreEqual(21080, _objUserRegistration.EmailNotification.EmailNotifyId);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.EventsNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.GiftsNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.GuestBookNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.MessagesNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.NewsLetterNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.NotesNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.PhotoAlbumNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.PhotosNotify);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.StoryNotify);
     Assert.AreEqual(21085, _objUserRegistration.EmailNotification.UserId);
     Assert.AreEqual(true, _objUserRegistration.EmailNotification.CommentsNotify);
     // Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
        public int InsertDummyBusinessUser(String DummyUser)
        {
            bool userNameExists = false;
            int UserId = -1;

            try
            {

                object[] objParam = { DummyUser };
                DataSet _objDataSet = GetDataSet("usp_AvailableUser", objParam);
                int count = _objDataSet.Tables[0].Rows.Count;
                if (count > 0)
                {
                    String UserName = _objDataSet.Tables[0].Rows[0][0].ToString();
                    if (UserName != "0")
                    {
                        userNameExists = true;

                        object[] objParam1 ={ DummyUser,
                                            "zSpeN+GdR0Ey9VrM9QyvUA==",
                                     null
                                   };
                        //DataSet _objDataSet = GetDataSet("usp_ValidateUser", objParam);
                        DataSet _objDataSet1 = GetDataSetWithoutCheckingIOVS("usp_ValidateWebsiteUser", objParam1);
                        // ds.Tables[0].
                        if (_objDataSet1.Tables[0].Rows.Count > 0)
                        {
                            UserId = (int)_objDataSet1.Tables[0].Rows[0]["UserId"];
                        }

                    }

                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                if (sqlEx.Number >= 50000)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = sqlEx.Message;
                    //objUser.CustomError = objError;
                    userNameExists = false;
                }
            }
            /////////////////////////////////////////////////////////////////
            if (!userNameExists)
            {
                TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users();
                UserRegistration objUserReg = new UserRegistration();

                objUsers.CountryName = "India";
                objUsers.Email = "*****@*****.**";
                objUsers.FacebookUid = null;
                objUsers.FirstName = "tajinder";
                objUsers.LastName = "kaur";
                objUsers.Password = "******";
                objUsers.City = "Delhi";
                objUsers.UserName = DummyUser;
                objUsers.UserType = 2;
                objUsers.UserImage = null;
                objUsers.Country = null;
                objUsers.State = null;
                objUsers.AllowIncomingMsg = false;
                objUsers.VerificationCode = "";

                TributesPortal.BusinessEntities.UserBusiness objUserBusiness = new TributesPortal.BusinessEntities.UserBusiness();
                objUserBusiness.BusinessAddress = "optimus";
                objUserBusiness.BusinessType = 1;
                objUserBusiness.City = "Delhi";
                objUserBusiness.CompanyName = "optimus";
                objUserBusiness.Country = "India";
                objUserBusiness.Email = "*****@*****.**";
                objUserBusiness.Phone = "9911089140";
                objUserBusiness.Website = "www.yourtribute.com";
                objUserBusiness.ZipCode = "201301";

                objUserReg.Users = objUsers;
                objUserReg.UserBusiness = objUserBusiness;

                try
                {
                    string[] strParam = {
                                    Users.UserEnum.UserName.ToString(),
                                    Users.UserEnum.Password.ToString(),
                                    Users.UserEnum.FirstName.ToString(),
                                    Users.UserEnum.LastName.ToString(),
                                    Users.UserEnum.Email.ToString(),
                                    Users.UserEnum.VerificationCode.ToString(),
                                    Users.UserEnum.AllowIncomingMsg.ToString(),
                                    Users.UserEnum.City.ToString(),
                                    Users.UserEnum.State.ToString(),
                                    Users.UserEnum.Country.ToString(),
                                    Users.UserEnum.UserImage.ToString(),
                                    Users.UserEnum.UserType.ToString(),
                                    Users.UserEnum.FacebookUid.ToString()
                                };

                    DbType[] enumDbType ={
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.Boolean,
                                    DbType.String,
                                    DbType.Int32,
                                    DbType.Int32,
                                    DbType.String,
                                    DbType.Int32,
                                    DbType.Int64
                                 };
                    if (objUserReg.Users.State == -1)
                    {
                        objUserReg.Users.State = null;
                    }

                    object[] objValue ={
                                        objUserReg.Users.UserName.ToString(),
                                        objUserReg.Users.Password.ToString(),
                                        objUserReg.Users.FirstName.ToString(),
                                        objUserReg.Users.LastName.ToString(),
                                        objUserReg.Users.Email.ToString(),
                                        objUserReg.Users.VerificationCode.ToString(),
                                        objUserReg.Users.AllowIncomingMsg.ToString(),
                                        objUserReg.Users.City.ToString(),
                                        objUserReg.Users.State,
                                        objUserReg.Users.Country,
                                        objUserReg.Users.UserImage,
                                        objUserReg.Users.UserType,
                                        objUserReg.Users.FacebookUid
                                   };

                    DataSet _objDataSet1 = GetDataSetWithoutCheckingIOVS("usp_SaveUserPersonalAccount", objValue);
                    // ds.Tables[0].
                    int count1 = _objDataSet1.Tables[0].Rows.Count;
                    if (count1 > 0)
                    {
                        UserId = (int)_objDataSet1.Tables[0].Rows[0]["UserId"];
                        objUserReg.Users.UserId = UserId;
                    }
                    string[] strParam1 = {
                                    UserBusiness.UserRegistrationEnum.UserId.ToString(),
                                    UserBusiness.UserRegistrationEnum.Website.ToString(),
                                    UserBusiness.UserRegistrationEnum.CompanyName.ToString(),
                                    UserBusiness.UserRegistrationEnum.BusinessType.ToString(),
                                    UserBusiness.UserRegistrationEnum.BusinessAddress.ToString(),
                                    UserBusiness.UserRegistrationEnum.ZipCode.ToString(),
                                    "Phone"

                                };

                    DbType[] enumDbType1 ={
                                    DbType.Int64,
                                    DbType.String,
                                    DbType.String,
                                    DbType.Int64,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String
                                 };

                    object[] objValue1 ={
                                    (Int64)objUserReg.Users.UserId,
                                    objUserReg.UserBusiness.Website.ToString(),
                                    objUserReg.UserBusiness.CompanyName.ToString(),
                                    objUserReg.UserBusiness.BusinessType.ToString(),
                                    objUserReg.UserBusiness.BusinessAddress.ToString(),
                                    objUserReg.UserBusiness.ZipCode.ToString(),
                                    objUserReg.UserBusiness.Phone.ToString()
                               };
                    //base.InsertRecord("usp_SaveUserBusinessAccount", strParam, enumDbType, objValue);
                    base.InsertRecordMinusIovs("usp_SaveUserBusinessAccount", strParam1, enumDbType1, objValue1);
                    //UserId = objUserReg.Users.UserId;
                }
                catch (System.Data.SqlClient.SqlException sqlEx)
                {
                    if (sqlEx.Number >= 50000)
                    {
                        Errors objError = new Errors();

                        objUserReg.CustomError = objError;
                        return -1;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return UserId;
        }
        public void SavePersonalAccountTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
            UserRegistration _UserRegistration = new UserRegistration(); // TODO: Initialize to an appropriate value
            //object expected = null; // TODO: Initialize to an appropriate value
            //object actual;

            bool userNameExists = false;
            int UserId = -1;
            String DummyUser = "******";
            try
            {

                object[] objParam = { DummyUser };
                DataSet _objDataSet = GetDataSet("usp_AvailableUser", objParam);
                int count = _objDataSet.Tables[0].Rows.Count;
                if (count > 0)
                {
                    String UserName = _objDataSet.Tables[0].Rows[0][0].ToString();
                    if (UserName != "0")
                    {
                        userNameExists = true;

                        object[] objParam1 ={ DummyUser,
                                            "zSpeN+GdR0Ey9VrM9QyvUA==",
                                     null
                                   };
                        //DataSet _objDataSet = GetDataSet("usp_ValidateUser", objParam);
                        DataSet _objDataSet1 = GetDataSetWithoutCheckingIOVS("usp_ValidateWebsiteUser", objParam1);
                        // ds.Tables[0].
                        if (_objDataSet1.Tables[0].Rows.Count > 0)
                        {
                            UserId = (int)_objDataSet1.Tables[0].Rows[0]["UserId"];
                        }

                    }

                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                if (sqlEx.Number >= 50000)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = sqlEx.Message;
                    //objUser.CustomError = objError;
                    userNameExists = false;
                }
            }
            /////////////////////////////////////////////////////////////////
            if (!userNameExists)
            {
                TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users();

                objUsers.CountryName = "India";
                objUsers.Email = "*****@*****.**";
                objUsers.FacebookUid = null;
                objUsers.FirstName = "tajinder";
                objUsers.LastName = "kaur";
                objUsers.Password = "******";
                objUsers.City = "Delhi";
                objUsers.UserName = DummyUser;
                objUsers.UserType = 2;
                objUsers.UserImage = null;
                objUsers.Country = null;
                objUsers.State = null;
                objUsers.AllowIncomingMsg = false;
                objUsers.VerificationCode = "";

                TributesPortal.BusinessEntities.UserBusiness objUserBusiness = new TributesPortal.BusinessEntities.UserBusiness();
                objUserBusiness.BusinessAddress = "optimus";
                objUserBusiness.BusinessType = 1;
                objUserBusiness.City = "Delhi";
                objUserBusiness.CompanyName = "optimus";
                objUserBusiness.Country = "India";
                objUserBusiness.Email = "*****@*****.**";
                objUserBusiness.Phone = "9911089140";
                objUserBusiness.Website = "www.yourtribute.com";
                objUserBusiness.ZipCode = "201301";

                _UserRegistration.Users = objUsers;
                _UserRegistration.UserBusiness = objUserBusiness;

                object UserId1 = target.SavePersonalAccount(_UserRegistration);
                UserId = (int)UserId1;
                //Assert.AreEqual(expected, actual);
                //Assert.Inconclusive("Verify the correctness of this test method.");
            }
            Assert.AreEqual(true, UserId > 0);
        }
        public void UpdatePersonalDetailsTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
            UserRegistration objUserReg = new UserRegistration(); // TODO: Initialize to an appropriate value
            int UserId = InsertDummyUser("tj_op");
            TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users();
            objUsers.UserId = UserId;
            objUsers.FirstName = "Tajinder1";
            objUsers.LastName = "Kaur1";
            objUsers.City = "Noida";
            objUsers.State = null;
            objUsers.Country = 5;
            objUsers.UserImage = null;
            objUserReg.Users = objUsers;
            target.UpdatePersonalDetails(objUserReg);

            UserRegistration objUserReg1 = new UserRegistration();
            TributesPortal.BusinessEntities.Users objUsers1 = new TributesPortal.BusinessEntities.Users();
            objUsers1.UserId = UserId;
            objUserReg1.Users = objUsers1;
            target.GetUserDetails(objUserReg1);

            Assert.AreEqual("Tajinder1", objUserReg1.Users.FirstName);
            Assert.AreEqual("Kaur1", objUserReg1.Users.LastName);
            Assert.AreEqual("Noida", objUserReg1.Users.City);
            Assert.AreEqual(5, objUserReg1.Users.Country);
        }
 public void UserAvailability(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     objUser.UserAvailability(param);
 }
        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 UpdatePersonalDetails(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     //Transaction started
     using (TransactionScope trans = new TransactionScope())
     {
         objUser.UpdatePersonalDetails(param);
         //Transaction commited
         trans.Complete();
     }
 }
 public void UpdatePrivacySettings(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     objUser.UpdatePrivacySettings(param);
 }
 public void UpdateFacebookAssociation(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     objUser.UpdateFacebookAssociation(_objUserRegistration);
 }
        //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;
        }
 //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);
 }
        public void SaveMessageTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
            UserBusiness objBusinessUser = new UserBusiness(); // TODO: Initialize to an appropriate value

            int UserId = InsertDummyBusinessUser("tj_op_business2");
            objBusinessUser.UserId = UserId;
            objBusinessUser.UserName = "******";
            objBusinessUser.WelcomeMessage = "Hello TJ";
            string AppDomain = "yourtribute";
            target.SaveMessage(objBusinessUser,AppDomain);

            UserRegistration objUserReg1 = new UserRegistration();
            TributesPortal.BusinessEntities.Users objUsers1 = new TributesPortal.BusinessEntities.Users();
            objUsers1.UserId = UserId;
            objUserReg1.Users = objUsers1;
            target.GetUserDetails(objUserReg1);

            Assert.AreEqual("Hello TJ", objUserReg1.UserBusiness.WelcomeMessage);
            // Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public void UpdateFacebookAssociation(UserRegistration objUserReg)
        {
            try
            {
                string[] strParam = {
                                        "UserId",
                                        "FacebookUid"
                };

                DbType[] enumDbType ={
                                    DbType.Int32,
                                    DbType.Int64
                                 };

                object[] objValueS ={
                                    objUserReg.Users.UserId,
                                    objUserReg.Users.FacebookUid
                                   };
                base.InsertRecord("usp_UpdateUserFacebookAssociation", strParam, enumDbType, objValueS);
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                if (sqlEx.Number >= 2601)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = sqlEx.Message;
                    objUserReg.CustomError = objError;
                }
            }
        }
        public void SavePersonalAccountsignupTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
            UserRegistration _UserRegistration = new UserRegistration(); // TODO: Initialize to an appropriate value

            int UserId = -1;
            string DummyEmail = "*****@*****.**";
            string pass = "******";
            /////////////////////////////////////////////////////////////////
            TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users();

            objUsers.Country = 404;
            objUsers.CreatedOn = System.DateTime.Now;
            objUsers.FacebookUid = null;
            objUsers.FirstName = "udham";
            objUsers.LastName = "attri";
            objUsers.Password = pass;
            objUsers.State = null;
            objUsers.UserImage = "images/bg_ProfilePhoto.gif";
            objUsers.UserName = DummyEmail;
            objUsers.UserType = 1;
            objUsers.VerificationCode = "";
            objUsers.Email = DummyEmail;
            objUsers.AllowIncomingMsg = false;
            objUsers.City = "";

            _UserRegistration.Users = objUsers;

            object UserId1 = target.SavePersonalAccount(_UserRegistration);
            UserId = (int)UserId1;

            Assert.AreEqual(true, UserId > 0);
        }
        private void UpdateBusinessDetails(UserRegistration objUserReg)
        {
            try
            {
                string[] strParam = {
                                        "UserId",
                                        "Website",
                                        "CompanyName",
                                        "BusinessType",
                                        "BusinessAddress",
                                        "Phone",
                                        "ZipCode",
                                        "HeaderBGColor",
                                        "IsAddressOn",
                                        "IsWebAddressOn",
                                        "IsObUrlLinkOn",
                                        "IsPhoneNoOn",
                                        "DisplayCustomHeader",
                                        "HeaderLogo",
                                        "ObituaryLinkPage"
                                };

                DbType[] enumDbType ={
                                    DbType.Int32,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.String,
                                    DbType.Boolean,
                                    DbType.Boolean,
                                    DbType.Boolean,
                                    DbType.Boolean,
                                    DbType.Boolean,
                                    DbType.String,
                                    DbType.String
                                 };

                object[] objValue ={
                                    objUserReg.Users.UserId,
                                     objUserReg.UserBusiness.Website.ToString(),
                                     objUserReg.UserBusiness.CompanyName.ToString(),
                                     objUserReg.UserBusiness.BusinessType.ToString(),
                                     objUserReg.UserBusiness.BusinessAddress.ToString(),
                                     string.IsNullOrEmpty(objUserReg.UserBusiness.Phone) ? null :objUserReg.UserBusiness.Phone.ToString() ,
                                     objUserReg.UserBusiness.ZipCode.ToString(),
                                    objUserReg.UserBusiness.HeaderBGColor.ToString(),
                                    objUserReg.UserBusiness.IsAddressOn,
                                    objUserReg.UserBusiness.IsWebAddressOn,
                                    objUserReg.UserBusiness.IsObUrlLinkOn,
                                    objUserReg.UserBusiness.IsPhoneNoOn,
                                    objUserReg.UserBusiness.DisplayCustomHeader,
                                    objUserReg.UserBusiness.HeaderLogo,
                                    objUserReg.UserBusiness.ObituaryLinkPage
                                   };
                base.InsertRecord("usp_UpdateBusinessDetails", strParam, enumDbType, objValue);

            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                if (sqlEx.Number >= 50000)
                {
                    Errors objError = new Errors();
                    objError.ErrorMessage = sqlEx.Message;
                    objUserReg.CustomError = objError;
                }
            }
        }
        public void UpdateEmailNotoficationTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
            //object[] param = null; // TODO: Initialize to an appropriate value
            //target.UpdateEmailNotofication(param);

            UserRegistration _objUserReg = new UserRegistration();
            EmailNotification _objEmaNoti = new EmailNotification();
            int UserId = InsertDummyUser("tj_op");
            _objEmaNoti.UserId = UserId;
            _objEmaNoti.StoryNotify = true;
            _objEmaNoti.NotesNotify = true;
            _objEmaNoti.EventsNotify = true;
            _objEmaNoti.GuestBookNotify = true;
            _objEmaNoti.GiftsNotify = true;
            _objEmaNoti.PhotosNotify = true;
            _objEmaNoti.PhotoAlbumNotify = true;
            _objEmaNoti.VideosNotify = true;
            _objEmaNoti.CommentsNotify = true;
            _objEmaNoti.MessagesNotify = true;
            _objEmaNoti.NewsLetterNotify = true;
            _objUserReg.EmailNotification = _objEmaNoti;
            object[] param = { _objUserReg };
            target.UpdateEmailNotofication(param);
            //Assert.Inconclusive("A method that does not return a value cannot be verified.");

            UserRegistration _objUserReg1 = new UserRegistration();
            TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users();
            objUsers.UserId = UserId;
            _objUserReg1.Users = objUsers;
            target.GetEmailNotofication(_objUserReg1);

            Assert.AreEqual(true, _objUserReg1.EmailNotification.CommentsNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.EventsNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.GiftsNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.GuestBookNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.MessagesNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.NewsLetterNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.NotesNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.PhotoAlbumNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.PhotosNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.StoryNotify);
            Assert.AreEqual(true, _objUserReg1.EmailNotification.VideosNotify);
        }
 //Start - Modification on 7-Dec-09 for the enhancement 5 of the Phase 1
 /// <summary>
 /// Method to get the User details
 /// </summary>
 /// <param name="_objUserRegistration">used to specify the UserRegistration object</param>
 public void GetUserDetails(UserRegistration _objUserRegistration)
 {
     FacadeManager.UserInfoManager.GetUserDetails(_objUserRegistration);
 }
        public void UpdatePrivacySettingsTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
            //UserRegistration _objUserRegistration = null; // TODO: Initialize to an appropriate value
            int UserId = InsertDummyUser("tj_op");
            UserRegistration objUserReg = new UserRegistration();
            TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users();
            objUsers.UserId = UserId;
            objUsers.IsUsernameVisiable = true;
            objUsers.IsLocationHide = false;
            objUsers.AllowIncomingMsg = true;
            objUserReg.Users = objUsers;
            target.UpdatePrivacySettings(objUserReg);

            UserRegistration objUserReg1 = new UserRegistration();
            TributesPortal.BusinessEntities.Users objUsers1 = new TributesPortal.BusinessEntities.Users();
            objUsers1.UserId = UserId;
            objUserReg1.Users = objUsers1;
            target.GetUserDetails(objUserReg1);

            Assert.AreEqual(false, objUserReg1.Users.IsLocationHide);
            Assert.AreEqual(true, objUserReg1.Users.AllowIncomingMsg);
            Assert.AreEqual(true, objUserReg1.Users.IsUsernameVisiable);

            // Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
 public void GetUserDetailsFromEmail(UserRegistration _objUserRegistration, int tributeId)
 {
     FacadeManager.UserInfoManager.GetUserDetailsFromEmail(_objUserRegistration,tributeId);
 }
 public void GetUserCompleteDetailsTest()
 {
     UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value
     UserRegistration _objUserRegistration = new UserRegistration(); // TODO: Initialize to an appropriate value
     _objUserRegistration.Users = new Users();
     _objUserRegistration.Users.UserId = InsertDummyUser("tj_op");
     target.GetUserCompleteDetails(_objUserRegistration);
     Assert.AreEqual("Tajinder1", _objUserRegistration.Users.FirstName);
     Assert.AreEqual("Kaur", _objUserRegistration.Users.LastName);
     Assert.AreEqual("tj_op", _objUserRegistration.Users.UserName);
     Assert.AreEqual("*****@*****.**", _objUserRegistration.Users.Email);
     //Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
 //Mohit Gupta
 public object SavePersonalAccount(UserRegistration objUserRegistration)
 {
     return FacadeManager.UserInfoManager.SavePersonalAccount(objUserRegistration);
 }
 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;
 }
 /// <summary>
 /// Method to get User Details
 /// </summary>
 /// <param name="objUserId">UserRegistration entity containing UserId.</param>
 public void GetUserInfo(UserRegistration objUserId)
 {
     FacadeManager.UserInfoManager.GetUserDetails(objUserId);
 }
        /// <summary>
        /// Method to get subject for the message to be sent when user sends message to inbox
        /// </summary>
        /// <param name="objFromUser">User Id</param>
        /// <returns>Returns string of subject line.</returns>
        private string GetEmailSubject(UserRegistration objFromUser)
        {
            StringBuilder sbBody = new StringBuilder();

            if (objFromUser.Users.UserType == 1)
            {
                if (objFromUser.Users.FirstName == string.Empty)
                    sbBody.Append(objFromUser.Users.UserName);
                else
                    sbBody.Append(objFromUser.Users.FirstName + " " + objFromUser.Users.LastName);
            }
            else
            {
                sbBody.Append(objFromUser.Users.FirstName);
            }

            //if (objFromUser.Users.FirstName != string.Empty && objFromUser.Users.LastName != string.Empty)
            //    sbBody.Append(objFromUser.Users.FirstName + " " + objFromUser.Users.LastName);
            //else
            //    sbBody.Append(objFromUser.Users.UserName);

            sbBody.Append(" sent you a message on Your " + WebConfig.ApplicationWord + "...");

            return sbBody.ToString();
        }
        public void SaveImageTest()
        {
            UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value

            UserBusiness objBusinessUser = new UserBusiness(); // TODO: Initialize to an appropriate value

            int UserId = InsertDummyBusinessUser("tj_op_business2");
            objBusinessUser.UserId = UserId;
            objBusinessUser.UserName = "******";
            objBusinessUser.CompanyLogo = "images/bbb.gif";
            target.SaveImage(objBusinessUser);

            UserRegistration objUserReg1 = new UserRegistration();
            TributesPortal.BusinessEntities.Users objUsers1 = new TributesPortal.BusinessEntities.Users();
            objUsers1.UserId = UserId;
            objUserReg1.Users = objUsers1;
            target.GetUserDetails(objUserReg1);

            Assert.AreEqual("images/bbb.gif", objUserReg1.UserBusiness.CompanyLogo);

            //Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public void SendMailReply(int SendByUserId, int SendToUserId, string Subject, string _EmailBody, int Messageid)
        {
            EmailMessages objEmail = EmailMessages.Instance;
            //string fromMail = GetEmail(SendByUserId);
            //string tomail = GetEmail(SendToUserId);
            //bool val = objEmail.SendMessages(fromMail, tomail, Subject, _EmailBody, EmailMessages.TextFormat.Html.ToString());.

            //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);

            bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + WebConfig.NoreplyEmail + ">", objToUserInfo.Users.Email, GetEmailSubject(objFromUserInfo), GetEmailBody(objFromUserInfo, objToUserInfo, Subject, _EmailBody), EmailMessages.TextFormat.Html.ToString());

            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;
            _objMailMessage.MessageId = Messageid;
            object[] _ParamMail = { _objMailMessage };
            UserInfoResource objUser = new UserInfoResource();
            objUser.SaveEmailReply(_ParamMail);
        }
 public void GetEmailNotofication(UserRegistration _objUserRegistration)
 {
     UserInfoResource objUser = new UserInfoResource();
     object[] param = { _objUserRegistration };
     objUser.GetEmailNotofication(param);
 }