/// <summary> /// Method to delete user. /// </summary> /// <param name="objUser">User entity containing userid to be deleted.</param> public void DeleteUser(Users objUser) { UserResource objUserResource = new UserResource(); object[] param = { objUser }; using (TransactionScope trans = new TransactionScope()) { try { objUserResource.Delete(param); trans.Complete(); // added by ANKI 05-Feb-09 } catch (Exception ex) { throw ex; } } }
public bool UpdateUserTributeMobileView(Users users) { bool _UpdateStatus = false; if (users != null) { try { object[] objparam = { users.UserId,users.UserName,users.IsMobileViewOn }; DataSet dsIsAllowed = GetDataSet("usp_UpdateIsMobileViewOn", objparam); if (dsIsAllowed.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsIsAllowed.Tables[0].Rows) { bool.TryParse(dr["UpdateOutput"].ToString(), out _UpdateStatus); } } } catch (System.Data.SqlClient.SqlException sqlEx) { if (sqlEx.Number >= 50000) { Errors objError = new Errors(); objError.ErrorMessage = sqlEx.Message; return _UpdateStatus; } } } return _UpdateStatus; }
private void doFacebookDisconnect() { StateManager stateManager = StateManager.Instance; SessionValue objSessionvalue = (SessionValue)stateManager.Get("objSessionvalue", StateManager.State.Session); StringBuilder sbr = new StringBuilder(); if (objSessionvalue == null) { messageText.Text = "Your Tribute session had expired. Please log in."; refreshPage.Text = Request.QueryString["source"].ToString().Equals("headerLogin") ? "false" : "true"; } else { UserRegistration objUserReg = new UserRegistration(); TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users(); objUsers.UserId = objSessionvalue.UserId; objUserReg.Users = objUsers; UserInfoManager umgr = new UserInfoManager(); umgr.RemoveFacebookAssociation(objUserReg); HttpContext.Current.Session.Clear(); if (string.IsNullOrEmpty(objSessionvalue.UserEmail)) { sbr.Append("<div class=\"yt-Error\"><h3>Urgent: You must <a href=\""); sbr.Append(Session["APP_BASE_DOMAIN"].ToString()); sbr.Append("adminprofileemailpassword.aspx\">set up an email address and password</a>!</h3>"); sbr.Append("Your account was disconnected from Facebook, but you do not have an "); sbr.Append("email address and password on file. If you do not create a password "); sbr.Append("then you will not be able to login later.</div>"); messageText.Text = sbr.ToString(); } else { messageText.Text = "<div class=\"yt-Notice\">Facebook was disconnected from your account.</div>"; } } }
/// <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 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."); }
protected void lbtnFacebookSignup_Click(object sender, EventArgs e) { var fbWebContext = FacebookWebContext.Current; if (FacebookWebContext.Current.Session != null) { var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken); var me = (IDictionary<string, object>)fbwc.Get("me"); _FacebookUid = fbWebContext.UserId; try { string fbName = (string)me["first_name"] + " " + (string)me["last_name"]; string UserName = fbName.ToLower().Replace(" ", "_").Replace("'", "");/*+ "_"+_FacebookUid.ToString()*/ Nullable<int> state = null; Nullable<int> country = null; string _UserImage = "images/bg_ProfilePhoto.gif"; //if (!string.IsNullOrEmpty(user.pic_square)) string fql = "Select current_location,pic_square,email from user where uid = " + fbWebContext.UserId; JsonArray me2 = (JsonArray)fbwc.Query(fql); var mm = (IDictionary<string, object>)me2[0]; if (!string.IsNullOrEmpty((string)mm["pic_square"])) { _UserImage = (string)mm["pic_square"]; // get user image } string city = ""; if ((JsonObject)mm["current_location"] != null) { JsonObject hl = (JsonObject)mm["current_location"]; city = (string)hl[0]; if (_presenter.GetFacebookStateId((string)hl[2], (string)hl[1]) > 0) { state = _presenter.GetFacebookStateId((string)hl[2], (string)hl[1]); } if (_presenter.GetFacebookCountryId((string)hl[2]) > 0) { country = _presenter.GetFacebookCountryId((string)hl[2]); } } string password_ = string.Empty; _FBEmail = string.Empty; //user.proxied_email; string result = (string)mm["email"]; if (!string.IsNullOrEmpty(result)) { _FBEmail = result; password_ = RandomPassword.Generate(8, 10); password_ = TributePortalSecurity.Security.EncryptSymmetric(password_); } int _email = _presenter.EmailAvailable(); if (_email == 0) { UserRegistration objUserReg = new UserRegistration(); TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users( UserName, password_, (string)me["first_name"], (string)me["last_name"], _FBEmail, "", false, city, state, country, 1, _FacebookUid, ApplicationType); objUsers.UserImage = _UserImage; // objUsers.ApplicationType = ApplicationType; objUserReg.Users = objUsers; /*System.Decimal identity = (System.Decimal)*/ _presenter.DoShortFacebookSignup(objUserReg); if (objUserReg.CustomError != null) { ShowMessage(string.Format("<h2>Sorry, {0}.</h2>" + "<h3>Those Facebook credentials are already used in some other Your Tribute Account</h3>", fbName), "", true); } else { SessionValue _objSessionValue = new SessionValue(objUserReg.Users.UserId, objUserReg.Users.UserName, objUserReg.Users.FirstName, objUserReg.Users.LastName, objUserReg.Users.Email, objUserReg.UserBusiness == null ? 1 : 2, "Basic", objUserReg.Users.IsUsernameVisiable); TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance; stateManager.Add("objSessionvalue", _objSessionValue, TributesPortal.Utilities.StateManager.State.Session); SaveSessionInDB(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID)); Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain; RedirectPage(); return; } } else { ShowMessage(headertext, "User already exists for this email: " + _FBEmail, true);//COMDIFFRES: is this message correct? _showSignUpDialog = "false"; } } catch (Exception ex) { ShowMessage(headertext, ex.Message, true); _showSignUpDialog = "false"; // killFacebookCookies(); // ShowMessage("Your Facebook session has timed out. Please logout and try again"); } } }
/// <summary> /// get data to update user profile details. /// </summary> /// <param name="objValue"></param> public void GetUserCompleteDetails(object[] objValue) { GetEmailNotofication(objValue); UserRegistration objUserReg = (UserRegistration)objValue[0]; try { object[] objParam = { objUserReg.Users.UserId }; DataSet _objDataSet = GetDataSet("usp_GetUserDetails", objParam); if (_objDataSet.Tables[0].Rows.Count > 0) { Users objUser = new Users(); objUser.EmailNotification = objUserReg.EmailNotification; objUser.UserId = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.UserId.ToString()].ToString()); objUser.UserName = _objDataSet.Tables[0].Rows[0][Users.UserEnum.UserName.ToString()].ToString(); objUser.Password = TributePortalSecurity.Security.DecryptSymmetric(_objDataSet.Tables[0].Rows[0][Users.UserEnum.Password.ToString()].ToString()); objUser.FirstName = _objDataSet.Tables[0].Rows[0][Users.UserEnum.FirstName.ToString()].ToString(); objUser.LastName = _objDataSet.Tables[0].Rows[0][Users.UserEnum.LastName.ToString()].ToString(); objUser.Email = _objDataSet.Tables[0].Rows[0][Users.UserEnum.Email.ToString()].ToString(); objUser.UserImage = _objDataSet.Tables[0].Rows[0][Users.UserEnum.UserImage.ToString()].ToString(); objUser.Status = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.Status.ToString()].ToString()); objUser.City = _objDataSet.Tables[0].Rows[0][Users.UserEnum.City.ToString()].ToString(); if (_objDataSet.Tables[0].Rows[0][Users.UserEnum.State.ToString()].ToString() != "") objUser.State = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.State.ToString()].ToString()); else objUser.State = -1; objUser.Country = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.Country.ToString()].ToString()); objUser.IsUsernameVisiable = bool.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.IsUsernameVisiable.ToString()].ToString()); objUser.AllowIncomingMsg = bool.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.AllowIncomingMsg.ToString()].ToString()); objUser.IsLocationHide = bool.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.IsLocationHide.ToString()].ToString()); objUser.ApplicationType = int.Parse(_objDataSet.Tables[0].Rows[0]["coApplicationId"].ToString()) == 1 ? "yourtribute" : "yourmoments"; if (int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.UserType.ToString()].ToString()) == 2) { UserBusiness objUserBus = new UserBusiness(); objUserBus.Website = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.Website.ToString()].ToString(); objUserBus.CompanyName = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.CompanyName.ToString()].ToString(); objUserBus.BusinessType = int.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.BusinessType.ToString()].ToString()); objUserBus.BusinessAddress = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.BusinessAddress.ToString()].ToString(); objUserBus.ZipCode = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.ZipCode.ToString()].ToString(); if (_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.Phone.ToString()] != DBNull.Value) { objUserBus.Phone = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.Phone.ToString()].ToString(); } objUserReg.UserBusiness = objUserBus; } objUserReg.Users = objUser; } } 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); }
/// <summary> /// udham attri: function to set values for user object /// </summary> /// <returns>object userRegistration </returns> private UserRegistration SaveAccount() { int Usertype = 1; UserRegistration objUserReg = new UserRegistration(); string _Pass = TributePortalSecurity.Security.EncryptSymmetric(txtPassword.Text.ToLower().ToString()); string _UserImage = "images/bg_ProfilePhoto.gif"; Nullable<Int64> _FacebookUid = null; var fbwebContext = FacebookWebContext.Current; if (FacebookWebContext.Current.Session != null) { _FacebookUid = fbwebContext.UserId; try { var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken); string fql = "Select pic_square from user where uid = " + fbwebContext.UserId; JsonArray me2 = (JsonArray)fbwc.Query(fql); var mm = (IDictionary<string, object>)me2[0]; if (!string.IsNullOrEmpty((string)mm["pic_square"])) { _UserImage = (string)mm["pic_square"]; // get user image } } catch (Exception ex) { } } TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users( txtEmail.Text.Trim(), _Pass, txtFirstName.Text.ToString(), txtLastName.Text.ToString(), txtEmail.Text.ToString(), "", chkAgreeReceiveNewsletters.Checked, "", null, int.Parse(ddlCountry.SelectedValue.ToString()), Usertype, _FacebookUid ); objUsers.ApplicationType = ApplicationType; objUsers.UserImage = _UserImage; objUserReg.Users = objUsers; return objUserReg; }
private string GetEmailAccountBody(Users objUserInfo) { TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance; string Servername = (string)stateManager.Get("SERVERNAME", TributesPortal.Utilities.StateManager.State.Session); StringBuilder objstr = new StringBuilder(); if (objUserInfo.UserType == 1) { objstr.Append("<p style='font-size: 16px; font-family:Lucida Sans;'><b>Welcome " + objUserInfo.FirstName + " " + objUserInfo.LastName + ".</b></p>"); objstr.Append("<p style='font-size: 12px; font-family:Lucida Sans;'>Thank you for registering with Your Tribute. With Your Tribute you can <br/>"); objstr.Append("contribute messages, photos, videos and other content to Tributes created by <br/>"); objstr.Append("others. You can also create your own Tribute and invite friends and family <br/>"); objstr.Append("to share their memories.</p>"); objstr.Append("<p style='font-size: 14px; font-family:Lucida Sans;'>"); if(objUserInfo.Email!=string.Empty) { objstr.Append("<b>Your Email : </b>" + objUserInfo.Email + "<br/>"); } if (!objUserInfo.Password.Equals(string.Empty)) { objstr.Append("<b>Your Password</b> : " + TributePortalSecurity.Security.DecryptSymmetric(objUserInfo.Password) + "<br/>"); } objstr.Append("<b>Account Login:</b> <a href='http://" + WebConfig.TopLevelDomain + "/log_in.aspx'>http://" + WebConfig.TopLevelDomain + "/log_in.aspx</a></p>"); objstr.Append("<p style='font-size: 14px; font-family:Lucida Sans;color: #7CC3EA;font-weight: bold;margin-bottom: -11px;'>Start off on the right track</p>"); objstr.Append("<p style='font-size: 12px; font-family:Lucida Sans;'>Read our "); objstr.Append("<a href='http://support.yourtribute.com/forums/94844-how-to-guides'>How-To Guides</a>"); objstr.Append(" and <a href='http://support.yourtribute.com/forums/97320-faqs'>FAQs"); objstr.Append("</a> for helpful information on how to use Your <br/>"); objstr.Append("Tribute. Still need help? Email our friendly "); objstr.Append("<a href='http://support.yourtribute.com/anonymous_requests/new'>Customer Support Team</a>.</p>"); objstr.Append("<p style='font-size: 14px; font-family:Lucida Sans;color: #7CC3EA;font-weight: bold;margin-bottom: -11px;'>Keep up with Your Tribute</p>"); objstr.Append("<p style='font-size: 12px; font-family:Lucida Sans;'>"); objstr.Append("View our <a href='http://blog.yourtribute.com/'>Blog</a> and sign up to receive our "); objstr.Append("<a href='http://eepurl.com/rlagp'>NewsLetter</a> for helpful tips, feature <br/>"); objstr.Append("updates, company news and special offers. You can also follow us on your <br/>"); objstr.Append("favorite social websites: <a href='http://www.facebook.com/yourtribute'>Facebook</a>,"); objstr.Append(" <a href='http://www.twitter.com/yourtribute'>Twitter</a>,"); objstr.Append(" <a href='https://plus.google.com/u/0/109473191564708020938/posts'>Google+</a>"); objstr.Append(" and <a href='http://pinterest.com/yourtribute/'>Pinterest</a>.</p>"); objstr.Append("<p style='font-size: 14px; font-family:Lucida Sans;'><br/>Sincerely,<br/>The Your Tribute Team</p>"); } else { objstr.Append("<font style='font-size: 12px; font-family:Lucida Sans;'><p>Welcome " + objUserInfo.FirstName + " " + objUserInfo.LastName + "</p>"); objstr.Append("<p>Thank you for registering with Your Tribute!</p>"); objstr.Append("<p>Please keep this email in case you forget your account information.<br/>"); if (objUserInfo.UserName != string.Empty) { objstr.Append("Username: "******"<br/>"); } else { objstr.Append("Username: "******"<br/>"); } if (!objUserInfo.Password.Equals(string.Empty)) { objstr.Append("Password: "******"<br/>"); } //objstr.Append("User Profile: <a href='http:" + Servername + "/Users/log_in.aspx'>http://www." + WebConfig.TopLevelDomain + "/" + objUserInfo.UserName + " </a></p>"); objstr.Append("User Profile: <a href='http://" + WebConfig.TopLevelDomain + "/log_in.aspx'>http://" + WebConfig.TopLevelDomain + "/log_in.aspx</a></p>"); objstr.Append("<p>With a Your Tribute membership you can:<br/>"); objstr.Append("• <a href='http://" + WebConfig.TopLevelDomain + "/log_in.aspx?PageName=TributeCreation'>Create a tribute</a> to celebrate a significant event or a special someone<br/>"); objstr.Append( "• Collaborate with friends and family—leave messages in the guestbook, share photos and videos, send virtual gifts, and receive event invites and updates<br/></p>"); objstr.Append("• <a href='http://" + WebConfig.TopLevelDomain + "/features.aspx'>Take a Tour</a> to learn more about Your Tribute, or find Help at the bottom of any page. "); objstr.Append("<p>To get started, please sign in to your account at <a href='http://" + WebConfig.TopLevelDomain + "/log_in.aspx'>http://www." + WebConfig.TopLevelDomain + "</a>" + ".</p>"); objstr.Append("<p>-----<br/>"); objstr.Append("Your Tribute Team</p></font>"); } return objstr.ToString(); }
/// <summary> /// Method to delete users. /// </summary> /// <param name="objUser">User entity containing userid to be deleted.</param> public void DeleteUser(Users objUser) { try { FacadeManager.UserManager.DeleteUser(objUser); } catch (Exception ex) { throw ex; } }
internal bool UpdateUserTributeMobileView(Users users) { return FacadeManager.TributeManager.UpdateUserTributeMobileView(users); }
/// <summary> /// Method to search user based on the entered criteria. /// </summary> /// <param name="objUser">Filled Users entity.</param> /// <returns>List of users.</returns> public List<Users> SearchUsers(Users objUser) { return FacadeManager.UserManager.SearchUsers(objUser); }
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); }
/// <summary> /// To get the creation date of the user /// </summary> /// <param name="userId"></param> /// <returns></returns> public DateTime GetUserCreationDate(int userId) { DateTime creationDate; Users objuser = new Users(); try { if (userId > 0) { object[] param = { userId }; DataSet dsUser = GetDataSet("usp_GetUserCreationDate", param); //check whether user wants to show/hide donation details on the tribute if (dsUser.Tables.Count > 0) { if (dsUser.Tables[0].Rows.Count > 0) { DateTime.TryParse(dsUser.Tables[0].Rows[0][0].ToString(), out creationDate); objuser.CreatedOn = creationDate; } } } return objuser.CreatedOn; } catch (Exception ex) { return objuser.CreatedOn; } }
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 GetUserDetailsFromEmail(object[] objValue) { UserRegistration objUserReg = (UserRegistration)objValue[0]; int tributeId = (int)objValue[1]; try { object[] objParam = { objUserReg.Users.Email, objUserReg.Users.Password }; DataSet _objDataSet = GetDataSet("usp_GetUserDetailsFromEmail", objParam); if (_objDataSet.Tables[0].Rows.Count > 0) { Users objUser = new Users(); objUser.EmailNotification = objUserReg.EmailNotification; objUser.UserId = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.UserId.ToString()].ToString()); objUser.UserName = _objDataSet.Tables[0].Rows[0][Users.UserEnum.UserName.ToString()].ToString(); objUser.FirstName = _objDataSet.Tables[0].Rows[0][Users.UserEnum.FirstName.ToString()].ToString(); objUser.LastName = _objDataSet.Tables[0].Rows[0][Users.UserEnum.LastName.ToString()].ToString(); objUser.Email = _objDataSet.Tables[0].Rows[0][Users.UserEnum.Email.ToString()].ToString(); objUser.UserImage = _objDataSet.Tables[0].Rows[0][Users.UserEnum.UserImage.ToString()].ToString(); objUser.Status = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.Status.ToString()].ToString()); objUser.City = _objDataSet.Tables[0].Rows[0][Users.UserEnum.City.ToString()].ToString(); if (_objDataSet.Tables[0].Rows[0][Users.UserEnum.State.ToString()].ToString() != "") objUser.State = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.State.ToString()].ToString()); else objUser.State = -1; if (_objDataSet.Tables[0].Rows[0][Users.UserEnum.Country.ToString()].ToString() != "") objUser.Country = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.Country.ToString()].ToString()); else objUser.Country = -1; objUser.IsUsernameVisiable = bool.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.IsUsernameVisiable.ToString()].ToString()); objUser.AllowIncomingMsg = bool.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.AllowIncomingMsg.ToString()].ToString()); objUser.IsLocationHide = bool.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.IsLocationHide.ToString()].ToString()); objUser.UserType = int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.UserType.ToString()].ToString()); if (int.Parse(_objDataSet.Tables[0].Rows[0][Users.UserEnum.UserType.ToString()].ToString()) == 2) { UserBusiness objUserBus = new UserBusiness(); objUserBus.Website = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.Website.ToString()].ToString(); objUserBus.CompanyName = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.CompanyName.ToString()].ToString(); objUserBus.BusinessType = int.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.BusinessType.ToString()].ToString()); objUserBus.BusinessAddress = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.BusinessAddress.ToString()].ToString(); objUserBus.ZipCode = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.ZipCode.ToString()].ToString(); //Start - Modification on 17-Dec-09 for the enhancement 6 of the Phase 1 objUserBus.CompanyLogo = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.CompanyLogo.ToString()].ToString(); //End if (_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.Phone.ToString()] != DBNull.Value) { objUserBus.Phone = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.Phone.ToString()].ToString(); } objUserBus.HeaderBGColor = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.HeaderBGColor.ToString()].ToString(); objUserBus.HeaderLogo = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.HeaderLogo.ToString()].ToString(); if (!(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.ObituaryLinkPage.ToString()] == null || _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.ObituaryLinkPage.ToString()].ToString() == "")) objUserBus.ObituaryLinkPage = _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.ObituaryLinkPage.ToString()].ToString(); else objUserBus.ObituaryLinkPage = ""; if (!(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsWebAddressOn.ToString()] == null || _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsWebAddressOn.ToString()].ToString() == "")) objUserBus.IsWebAddressOn = bool.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsWebAddressOn.ToString()].ToString()); else objUserBus.IsWebAddressOn = false; if (!(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsAddressOn.ToString()] == null || _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsAddressOn.ToString()].ToString() == "")) objUserBus.IsAddressOn = bool.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsAddressOn.ToString()].ToString()); else objUserBus.IsAddressOn = false; if (!(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsObUrlLinkOn.ToString()] == null || _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsObUrlLinkOn.ToString()].ToString() == "")) objUserBus.IsObUrlLinkOn = bool.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsObUrlLinkOn.ToString()].ToString()); else objUserBus.IsObUrlLinkOn = false; if (!(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsPhoneNoOn.ToString()] == null || _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsPhoneNoOn.ToString()].ToString() == "")) objUserBus.IsPhoneNoOn = bool.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.IsPhoneNoOn.ToString()].ToString()); else objUserBus.IsPhoneNoOn = false; if (!(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.DisplayCustomHeader.ToString()] == null || _objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.DisplayCustomHeader.ToString()].ToString() == "")) objUserBus.DisplayCustomHeader = bool.Parse(_objDataSet.Tables[0].Rows[0][UserBusiness.UserRegistrationEnum.DisplayCustomHeader.ToString()].ToString()); else objUserBus.DisplayCustomHeader = false; objUserReg.UserBusiness = objUserBus; } objUserReg.Users = objUser; if (tributeId != 0) { Tributes objTribute = new Tributes(); objTribute.TributeId = tributeId; SessionValue objSession = new SessionValue(); objSession.UserId = objUser.UserId; objSession.UserEmail = objUser.Email; object[] param = { objTribute, objSession }; ConformAdmin(param); } } else { objUserReg.Users = null; } } catch (System.Data.SqlClient.SqlException sqlEx) { if (sqlEx.Number >= 50000) { Errors objError = new Errors(); objError.ErrorMessage = sqlEx.Message; objUserReg.CustomError = objError; } } }
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 Users GetUserDetailsOnUserId(int userId) { Users objUser = new Users(); try { string returnVal = string.Empty; if (userId > 0) { object[] objParam = { userId }; DataSet dsUser = GetDataSet("usp_GetUserDetailsOnUserId", objParam); if (dsUser.Tables[0].Rows.Count > 0) { objUser.UserName = dsUser.Tables[0].Rows[0]["UserName"].ToString(); objUser.UserType = int.Parse(dsUser.Tables[0].Rows[0]["UserType"].ToString()); objUser.AtomEnabled = bool.Parse(dsUser.Tables[0].Rows[0]["AtomEnabled"].ToString()); } } return objUser; } catch (Exception ex) { throw ex; } }
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 GetUserDetailsOnUserIdTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value int userId = 9; // TODO: Initialize to an appropriate value Users expected = new Users(); expected.UserType = 2;// TODO: Initialize to an appropriate value Users actual = new Users(); actual = target.GetUserDetailsOnUserId(userId); Assert.AreEqual(expected.UserType, actual.UserType); //Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> /// Method to search user based on the entered criteria. /// </summary> /// <param name="objUser">Filled Users entity.</param> /// <returns>List of users.</returns> public List<Users> SearchUsers(Users objUser) { UserResource objUserResource = new UserResource(); object[] param = {objUser}; return objUserResource.SearchUsers(param); }
/// <summary> /// Method to get the list of users based on the entered criteria. /// </summary> /// <param name="objUsers">Filled Users entity.</param> /// <returns>List of Users.</returns> public List<Users> SearchUsers(object[] objUsers) { List<Users> objUsersList = new List<Users>(); Users objUser = (Users)objUsers[0]; object[] objParam = {objUser.SearchUserId, objUser.UserName, objUser.FirstName, objUser.LastName, objUser.Email, objUser.City, objUser.State, objUser.Country, objUser.UserType, objUser.CreatedAfter, objUser.CreatedBefore,objUser.ApplicationType}; DataSet dsUsers = GetDataSet("usp_UserSearch", objParam); if (dsUsers.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsUsers.Tables[0].Rows) { Users obj = new Users(); obj.UserId = int.Parse(dr["UserId"].ToString()); obj.UserName = dr["UserName"].ToString(); obj.FirstName = dr["FirstName"].ToString(); obj.LastName = dr["LastName"].ToString(); obj.AccountType = dr["AccountType"].ToString(); obj.City = dr["City"].ToString(); obj.StateName = dr["State"].ToString(); obj.CountryName = dr["Country"].ToString(); obj.CreatedOn = DateTime.Parse(dr["CreatedOn"].ToString()); obj.CreationDate = DateTime.Parse(dr["CreatedOn"].ToString()).ToString("MMMM dd, yyyy"); //obj.Email = dr["City"].ToString(); objUsersList.Add(obj); obj = null; } } return objUsersList; }
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 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."); }
private void doFacebookConnect() { StateManager stateManager = StateManager.Instance; SessionValue objSessionvalue = (SessionValue)stateManager.Get("objSessionvalue", StateManager.State.Session); if (objSessionvalue == null) { messageText.Text = "Your Tribute session had expired. Please log in."; refreshPage.Text = Request.QueryString["source"].ToString().Equals("headerLogin") ? "false" : "true"; } else { UserRegistration objUserReg = new UserRegistration(); TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users(); objUsers.UserId = objSessionvalue.UserId; objUsers.FacebookUid = _FacebookUid; objUserReg.Users = objUsers; UserInfoManager umgr = new UserInfoManager(); umgr.UpdateFacebookAssociation(objUserReg); StringBuilder sbr = new StringBuilder(); if (objUserReg.CustomError != null) { var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken); var me = (IDictionary<string, object>)fbwc.Get("me"); string fbName = (string)me["first_name"] + " " + (string)me["last_name"]; sbr.Append(string.Format("<div class=\"yt-Error\"><h3>Sorry, {0}.</h3>", fbName)); sbr.Append(string.Format( "The Facebook account named {0} is aleady used by some other Your Tribute Account.", fbName)); sbr.Append("Would you like to:"); sbr.Append("<ul>"); sbr.Append("<li><a href=\"#\" onclick=\"fb_logout(); return false;\">"); sbr.Append(" <img id=\"fb_logout_image\" "); sbr.Append("src=\"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif\""); sbr.Append(" alt=\"Logout from Facebook and Your Tribute\"/></a> of both Your Tribute and Facebook Connect "); sbr.Append("and switch to the other account using your Facebook email address and password.</li>"); sbr.Append("<li><a href=\"#\" onclick=\"fb_err_logout(); return false;\">"); sbr.Append("<img id=\"fb_logout_image\" "); sbr.Append("src=\"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif\""); sbr.Append(" alt=\"Disconnect from Facebook\"/></a> of Facebook Connect and try again.</li>"); sbr.Append("<li><a href=\"javascript:void(0);\" onclick=\"OpenContactUS();\">Contact us</a> to discuss the situation further if you are confused.</li>"); sbr.Append("</div>"); messageText.Text = sbr.ToString(); refreshPage.Text = "false"; } else { if(Request.QueryString["source"].ToString().Equals("headerLogin")) { refreshPage.Text = "true"; } else { messageText.Text = "<div class=\"yt-Notice\">Facebook Connection was added to your account.</div>"; refreshPage.Text = "false"; } } } }
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."); }
protected void doFacebookSignup() { var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken); var me = (IDictionary<string, object>)fbwc.Get("me"); string fbName = (string)me["first_name"] + " " + (string)me["last_name"]; string UserName = fbName.ToLower().Replace(" ", "_").Replace("'", "");/*+ "_"+_FacebookUid.ToString()*/ string fql = "Select current_location,pic_square,email from user where uid = " + (string)me["id"]; JsonArray me2 = (JsonArray)fbwc.Query(fql); var mm = (IDictionary<string, object>)me2[0]; Nullable<int> state = null; Nullable<int> country = null; string _UserImage = "images/bg_ProfilePhoto.gif"; if (!string.IsNullOrEmpty((string)mm["pic_square"])) { _UserImage = (string)mm["pic_square"]; // get user image } string city = ""; JsonObject hl = (JsonObject)mm["current_location"]; if ((string)hl[0] != null) { city = (string)hl[0]; UserManager usrmngr = new UserManager(); object[] param = { (string)hl[2],(string)hl[1] }; if (usrmngr.GetstateIdByName(param) > 0) { state = usrmngr.GetstateIdByName(param); } if (usrmngr.GetCountryIdByName((string)hl[2]) > 0) { country = usrmngr.GetCountryIdByName((string)hl[2]); } } string password_ = string.Empty; string email_ = string.Empty; //user.proxied_email; string result = (string)mm["email"]; if (!string.IsNullOrEmpty(result)) { email_ = result; password_ = RandomPassword.Generate(8, 10); password_ = TributePortalSecurity.Security.EncryptSymmetric(password_); } UserRegistration objUserReg = new UserRegistration(); TributesPortal.BusinessEntities.Users objUsers = new TributesPortal.BusinessEntities.Users( UserName, password_, (string)me["first_name"], (string)me["last_name"], email_, "", false, city, state, country, 1, _FacebookUid); objUsers.UserImage = _UserImage; objUserReg.Users = objUsers; /*System.Decimal identity = (System.Decimal)*/ UserInfoManager umgr = new UserInfoManager(); umgr.SavePersonalAccount(objUserReg); if (objUserReg.CustomError != null) { messageText.Text=string.Format("<h2>Sorry, {0}.</h2>" + "<h3>Those Facebook credentials are already used in some other Your Tribute Account</h3>", fbName); } else { SessionValue _objSessionValue = new SessionValue(objUserReg.Users.UserId, objUserReg.Users.UserName, objUserReg.Users.FirstName, objUserReg.Users.LastName, objUserReg.Users.Email, objUserReg.UserBusiness == null ? 1 : 2, "Basic", objUserReg.Users.IsUsernameVisiable); TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance; stateManager.Add("objSessionvalue", _objSessionValue, TributesPortal.Utilities.StateManager.State.Session); SaveSessionInDB(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID)); Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain; showDialog.Text = "false"; refreshPage.Text = "true"; } }
public bool UpdateUserTributeMobileView(Users users) { TributeResource objResource = new TributeResource(); return objResource.UpdateUserTributeMobileView(users); }