protected void Page_Load(object sender, EventArgs e) { int StoreID, PortalID; int CustomerID; string UserName, CultureName, SessionCode; SetCustomerID(); GetPortalCommonInfo(out StoreID, out PortalID, out CustomerID, out UserName, out CultureName, out SessionCode); AspxCommonInfo aspxCommonObj = new AspxCommonInfo(StoreID, PortalID, UserName, CultureName, CustomerID, SessionCode); StoreSettingConfig ssc = new StoreSettingConfig(); string timeToDeleteCartItems, timeToAbandonCart; ssc.GetStoreSettingParamTwo(StoreSetting.TimeToDeleteAbandonedCart, StoreSetting.CartAbandonedTime, out timeToDeleteCartItems, out timeToAbandonCart, StoreID, PortalID, CultureName); ctl.DeleteAbandonedCartItems(StoreID, PortalID, decimal.Parse(timeToDeleteCartItems), decimal.Parse(timeToAbandonCart)); StoreAccessDetailsInfo storeAccessTracker = new StoreAccessDetailsInfo(); storeAccessTracker.PortalID = PortalID; storeAccessTracker.StoreID =StoreID; storeAccessTracker.Username = UserName; StartUpInfoCollection objStartInfo = new StartUpInfoCollection(); AspxCommonController objCommonCont = new AspxCommonController(); objStartInfo = objCommonCont.GetStartUpInformation("AspxKPI", "AspxABTesting", storeAccessTracker); CheckStoreAccessible(aspxCommonObj, objStartInfo.IsStoreAccess,objStartInfo.IsStoreClosed); CreateGlobalVariables(aspxCommonObj,objStartInfo.IsKPIInstalled,objStartInfo.IsABTestInstalled); IncludeCoreLanguageJS(); IncludeTemplateLanguageJS(); IncludeRssFeedLanguageJS(); if (HttpContext.Current.Session["IsLoginClick" + UserName] != null) { if (bool.Parse(HttpContext.Current.Session["IsLoginClick" + UserName].ToString())) { objCommonCont.UpdateCartAnonymoususertoRegistered(StoreID, PortalID, CustomerID, SessionCode); HttpContext.Current.Session["IsLoginClick" + UserName] = false; } } List<CurrrencyRateInfo> ratelist = GetCountryCodeRates(aspxCommonObj); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); string jsonRates = json_serializer.Serialize(ratelist); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ratelist", " var currencyRate='" + jsonRates + "';", true); }
protected void Page_Load(object sender, EventArgs e) { try { SageFrameConfig pagebase = new SageFrameConfig(); string PortalLoginpage = pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage);//Ask santosh to get portal login page SecurityPolicy objSecurity = new SecurityPolicy(); FormsAuthenticationTicket ticket = objSecurity.GetUserTicket(GetPortalID); AspxCommonInfo aspxCommonObj = new AspxCommonInfo(); base.GetPortalCommonInfo(out storeID, out portalID, out customerID, out userName, out cultureName, out sessionCode); aspxCommonObj = new AspxCommonInfo(storeID, portalID, userName, cultureName, customerID, sessionCode); RewardPointsGeneralSettingsIsActive = RewardPointsController.RewardPointsGeneralSettingsIsActive(aspxCommonObj).ToString(); StoreSettingConfig ssc = new StoreSettingConfig(); ssc.GetStoreSettingParamThree(StoreSetting.AllowUsersToCreateMultipleAddress, StoreSetting.MainCurrency, StoreSetting.ShowAddToCartButton, out allowMultipleAddress, out CurrencyCodeSlected, out AllowAddToCart, storeID, portalID, cultureName ); IsRewardInstl = AspxCommonController.GetModuleInstallationInfo("AspxRewardPoints", aspxCommonObj).ToString(); if (ticket != null && ticket.Name != ApplicationKeys.anonymousUser) { if (!IsPostBack) { string templateName = TemplateName; IncludeCss("UserDashBoardCSS", "/Templates/" + templateName + "/css/GridView/tablesort.css", "/Templates/" + templateName + "/css/StarRating/jquery.rating.css", "/Templates/" + templateName + "/css/MessageBox/style.css", "/Templates/" + templateName + "/css/PopUp/style.css", "/Templates/" + templateName + "/css/JQueryUIFront/jquery.ui.all.css", "/Templates/" + templateName + "/css/PasswordValidation/jquery.validate.password.css", "/Templates/" + templateName + "/css/ToolTip/tooltip.css"); IncludeJs("UserDashBoardJS", "/Modules/AspxCommerce/AspxWishList/js/WishItemList.js", "/js/jDownload/jquery.jdownload.js", "/js/DateTime/date.js", "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/js/StarRating/jquery.MetaData.js", "/js/FormValidation/jquery.validate.js", "/js/PasswordValidation/jquery.validate.password.js", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js", "/js/GridView/jquery.tablesorter.min.js", "/js/StarRating/jquery.rating.pack.js", "/js/encoder.js", "/js/StarRating/jquery.rating.js", "/js/PopUp/custom.js", "/js/jquery.tipsy.js", "/Modules/AspxCommerce/AspxUserDashBoard/js/userdashboard.js", "/js/Paging/jquery.pagination.js", "/js/FormValidation/jquery.form-validation-and-hints.js"); userModuleIDUD = int.Parse(SageUserModuleID); ModulePath = ResolveUrl(this.AppRelativeTemplateSourceDirectory); MembershipController m = new MembershipController(); UserInfo sageUser = m.GetUserDetails(GetPortalID, GetUsername); AspxCommonController objUser = new AspxCommonController(); UsersInfo userDetails = objUser.GetUserDetails(aspxCommonObj); if (userDetails.UserName != null) { userEmail = userDetails.Email; userFirstName = userDetails.FirstName; userLastName = userDetails.LastName; userPicture = userDetails.ProfilePicture; userEmailWishList = userEmail;//userDetail.Email;//added later for wishlist userIP = HttpContext.Current.Request.UserHostAddress; IPAddressToCountryResolver ipToCountry = new IPAddressToCountryResolver(); ipToCountry.GetCountry(userIP, out countryName); } BindUserDetails(); } IncludeAllLanguageJS(); } else { if (!IsParent) { Response.Redirect(ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" + PortalLoginpage) + ".aspx?ReturnUrl=" + Request.Url.ToString(), false); } else { Response.Redirect(ResolveUrl("~/" + PortalLoginpage) + ".aspx?ReturnUrl=" + Request.Url.ToString(), false); } } IncludeAllLanguageJS(); GetUserRecentActivity(aspxCommonObj); GetAddressBookDetails(aspxCommonObj); GetAllCountry(); GetMyOrders(aspxCommonObj); } catch (Exception ex) { ProcessException(ex); } }
protected void LoginButton_Click(object sender, EventArgs e) { MembershipController member = new MembershipController(); RoleController role = new RoleController(); UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text); if (user.UserExists && user.IsApproved) { if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(PasswordAspx.Text))) { if (PasswordHelper.ValidateUser(user.PasswordFormat, PasswordAspx.Text, user.Password, user.PasswordSalt)) { string userRoles = role.GetRoleNames(user.UserName, GetPortalID); strRoles += userRoles; if (strRoles.Length > 0) { SetUserRoles(strRoles); //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker]; //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker]; //sessionTracker.PortalID = GetPortalID.ToString(); //sessionTracker.Username = UserName.Text; //Session[SessionKeys.Tracker] = sessionTracker; SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog(); SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString()); StringBuilder redirectURL = new StringBuilder(); SecurityPolicy objSecurity = new SecurityPolicy(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.UserName, DateTime.Now, DateTime.Now.AddMinutes(30), true, GetPortalID.ToString(), FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); string randomCookieValue = GenerateRandomCookieValue(); Session[SessionKeys.RandomCookieValue] = randomCookieValue; HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket); SageFrameConfig objConfig = new SageFrameConfig(); string ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration); int expiryTime = Math.Abs(int.Parse(ServerCookieExpiration)); expiryTime = expiryTime < 5 ? 5 : expiryTime; cookie.Expires = DateTime.Now.AddMinutes(expiryTime); Response.Cookies.Add(cookie); ServiceSecurity.IssueToken(GetPortalID); if (Request.QueryString["ReturnUrl"] != null) { string PageNotFoundPage = PortalAPI.PageNotFoundURLWithRoot; string UserRegistrationPage = PortalAPI.RegistrationURLWithRoot; string PasswordRecoveryPage = PortalAPI.PasswordRecoveryURLWithRoot; string ForgotPasswordPage = PortalAPI.ForgotPasswordURL; string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot; string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString(); if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage) { redirectURL.Append(GetParentURL); redirectURL.Append(PortalAPI.DefaultPageWithExtension); } else { redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString())); } } else { if (!IsParent) { redirectURL.Append(GetParentURL); redirectURL.Append("/portal/"); redirectURL.Append(GetPortalSEOName); redirectURL.Append("/"); redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName)); redirectURL.Append(SageFrameSettingKeys.PageExtension); } else { redirectURL.Append(GetParentURL); redirectURL.Append("/"); redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName)); redirectURL.Append(SageFrameSettingKeys.PageExtension); } } int customerID = GetCustomerID; if (customerID == 0) { CustomerGeneralInfo sageUserCust = CustomerGeneralInfoController.CustomerIDGetByUsername(user.UserName, storeID, portalID); if (sageUserCust != null) { customerID = sageUserCust.CustomerID; } } AspxCommonController objCommonCont = new AspxCommonController(); objCommonCont.UpdateCartAnonymoususertoRegistered(storeID, portalID, customerID, sessionCode); Response.Redirect(redirectURL.ToString(), false); } else { FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal")); } } else { FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!"; } } } else { FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UserDoesnotExist")); } }