public static string HeaderLinks(MerchantTribeApplication app, string currentUserId) { StringBuilder sb = new StringBuilder(); string rootUrl = app.StoreUrl(false, true); string rootUrlSecure = app.StoreUrl(true, false); sb.Append("<ul>"); sb.Append("<li><a class=\"myaccountlink\" href=\"" + rootUrlSecure + "account\"><span>"); sb.Append("My Account"); sb.Append("</span></a></li>"); sb.Append("<li><a class=\"signinlink\""); if (currentUserId == string.Empty) { sb.Append(" href=\"" + rootUrlSecure + "SignIn\"><span>"); sb.Append("Sign In"); } else { string name = string.Empty; MerchantTribe.Commerce.Membership.CustomerAccount a = app.MembershipServices.Customers.Find(currentUserId); if (a != null) { name = a.Email; } sb.Append(" href=\"" + rootUrlSecure + "SignOut\" title=\"" + System.Web.HttpUtility.HtmlEncode(name) + "\"><span>"); sb.Append("Sign Out"); } sb.Append("</span></a></li>"); //sb.Append("<li><a class=\"orderstatuslink\" href=\"" + rootUrlSecure + "OrderStatus\"><span>"); //sb.Append("Order Status"); //sb.Append("</span></a></li>"); //sb.Append("<li><a class=\"emailsignuplink\" href=\"" + rootUrl + "EmailSignUp\"><span>"); //sb.Append("Email Sign Up"); //sb.Append("</span></a></li>"); //sb.Append("<li><a class=\"giftcardslink\" href=\"" + rootUrl + "GiftCards\"><span>"); //sb.Append("Gift Cards"); //sb.Append("</span></a></li>"); //sb.Append("<li><a class=\"contactlink\" href=\"" + rootUrl + "Contact\"><span>"); //sb.Append("Contact Us"); //sb.Append("</span></a></li>"); sb.Append("<li><a class=\"contactlink\" href=\"" + rootUrl + "Checkout\"><span>"); sb.Append("Checkout"); sb.Append("</span></a></li>"); sb.Append("</ul>"); return(sb.ToString()); }
protected void GridView1_RowEditing(object sender, System.Web.UI.WebControls.GridViewEditEventArgs e) { if (MessageBox != null) { MessageBox.ClearMessage(); } string bvin = (string)GridView1.DataKeys[e.NewEditIndex].Value; MerchantTribe.Commerce.Membership.CustomerAccount u = MyPage.MTApp.MembershipServices.Customers.Find(bvin); if (u != null) { this.UserNameField.Text = u.Email; } ValidateUser(); this.pnlUserBrowser.Visible = false; }
protected void btnNewUserSave_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if (MessageBox != null) { MessageBox.ClearMessage(); } MerchantTribe.Commerce.Membership.CustomerAccount u = new MerchantTribe.Commerce.Membership.CustomerAccount(); u.Email = this.NewUserEmailField.Text.Trim(); u.FirstName = this.NewUserFirstNameField.Text.Trim(); u.LastName = this.NewUserLastNameField.Text.Trim(); u.Password = MyPage.MTApp.MembershipServices.GeneratePasswordForCustomer(12); u.TaxExempt = this.NewUserTaxExemptField.Checked; MerchantTribe.Commerce.Membership.CreateUserStatus createResult = new MerchantTribe.Commerce.Membership.CreateUserStatus(); if (MyPage.MTApp.MembershipServices.CreateCustomer(u, ref createResult, u.Password) == true) { this.UserNameField.Text = u.Email; ValidateUser(); this.pnlNewUser.Visible = false; } else { switch (createResult) { case MerchantTribe.Commerce.Membership.CreateUserStatus.DuplicateUsername: if (MessageBox != null) { MessageBox.ShowWarning("The username " + this.NewUserEmailField.Text.Trim() + " already exists. Please select another username."); } break; case MerchantTribe.Commerce.Membership.CreateUserStatus.InvalidPassword: if (MessageBox != null) { MessageBox.ShowWarning("Unable to create this account. Invalid Password"); } break; default: if (MessageBox != null) { MessageBox.ShowWarning("Unable to create this account. Unknown Error."); } break; } } }
public static bool IsUserAuthenticated(MerchantTribeApplication app) { string uid = app.CurrentCustomerId; if (uid.Trim() == string.Empty) { return(false); } MerchantTribe.Commerce.Membership.CustomerAccount customer = app.MembershipServices.Customers.Find(uid); if (customer == null) { return(false); } if (customer.Bvin.Trim() == string.Empty) { return(false); } return(true); }
// User Is Editor private void LoadUserIsEditor(UserIs q) { List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>(); foreach (string bvin in q.UserIds()) { FriendlyBvinDisplay item = new FriendlyBvinDisplay(); item.bvin = bvin; item.DisplayName = bvin; MerchantTribe.Commerce.Membership.CustomerAccount c = MyPage.MTApp.MembershipServices.Customers.Find(item.bvin); if (c != null) { item.DisplayName = c.Email; } displayData.Add(item); } this.gvUserIs.DataSource = displayData; this.gvUserIs.DataBind(); }
private void ValidateUser() { MerchantTribe.Commerce.Membership.CustomerAccount u = MyPage.MTApp.MembershipServices.Customers.FindByEmail(this.UserNameField.Text.Trim()); if (u != null) { if (u.Bvin != string.Empty) { MerchantTribe.Commerce.Controls.UserSelectedEventArgs args = new MerchantTribe.Commerce.Controls.UserSelectedEventArgs(); args.UserAccount = u; if (UserSelected != null) { UserSelected(this, args); } } else { if (MessageBox != null) { MessageBox.ShowWarning("User account " + this.UserNameField.Text.Trim() + " wasn't found. Please try again or create a new account."); } } } }
protected void btnNewUserSave_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if (MessageBox != null) MessageBox.ClearMessage(); MerchantTribe.Commerce.Membership.CustomerAccount u = new MerchantTribe.Commerce.Membership.CustomerAccount(); u.Email = this.NewUserEmailField.Text.Trim(); u.FirstName = this.NewUserFirstNameField.Text.Trim(); u.LastName = this.NewUserLastNameField.Text.Trim(); u.Password = MyPage.MTApp.MembershipServices.GeneratePasswordForCustomer(12); u.TaxExempt = this.NewUserTaxExemptField.Checked; MerchantTribe.Commerce.Membership.CreateUserStatus createResult = new MerchantTribe.Commerce.Membership.CreateUserStatus(); if (MyPage.MTApp.MembershipServices.CreateCustomer(u, ref createResult, u.Password) == true) { this.UserNameField.Text = u.Email; ValidateUser(); this.pnlNewUser.Visible = false; } else { switch (createResult) { case MerchantTribe.Commerce.Membership.CreateUserStatus.DuplicateUsername: if (MessageBox != null) MessageBox.ShowWarning("The username " + this.NewUserEmailField.Text.Trim() + " already exists. Please select another username."); break; case MerchantTribe.Commerce.Membership.CreateUserStatus.InvalidPassword: if (MessageBox != null) MessageBox.ShowWarning("Unable to create this account. Invalid Password"); break; default: if (MessageBox != null) MessageBox.ShowWarning("Unable to create this account. Unknown Error."); break; } } }
public void LoadReview() { if (Request.QueryString["ReviewID"] != null) { ProductReview r = new ProductReview(); r = MyPage.MTApp.CatalogServices.ProductReviews.Find(ReviewID); if (r != null) { Product p = MyPage.MTApp.CatalogServices.Products.Find(r.ProductBvin); if (p != null) { this.lblProductName.Text = p.ProductName; } else { this.lblProductName.Text = "Unknown"; } if (r.UserID != string.Empty) { MerchantTribe.Commerce.Membership.CustomerAccount u = MyPage.MTApp.MembershipServices.Customers.Find(r.UserID); if (u == null) { this.lblUserName.Text = "Anonymous"; } else { this.lblUserName.Text = u.LastName + ", " + u.FirstName + " " + u.Email; } } this.lblReviewDate.Text = r.ReviewDateForTimeZone(MyPage.MTApp.CurrentStore.Settings.TimeZone).ToString(); this.chkApproved.Checked = r.Approved; this.KarmaField.Text = r.Karma.ToString(); switch (r.Rating) { case ProductReviewRating.ZeroStars: lstRating.SelectedValue = "0"; break; case ProductReviewRating.OneStar: lstRating.SelectedValue = "1"; break; case ProductReviewRating.TwoStars: lstRating.SelectedValue = "2"; break; case ProductReviewRating.ThreeStars: lstRating.SelectedValue = "3"; break; case ProductReviewRating.FourStars: lstRating.SelectedValue = "4"; break; case ProductReviewRating.FiveStars: lstRating.SelectedValue = "5"; break; } this.DescriptionField.Text = r.Description; } r = null; } }