public bool UpdateCustomer(Membership.CustomerAccount u, ref CreateUserStatus status) { bool result = false; if (u != null) { Membership.CustomerAccount testUser = new Membership.CustomerAccount(); testUser = Customers.FindByEmail(u.Email); if (testUser != null && testUser.Bvin != string.Empty) { if (testUser.Bvin != u.Bvin) { status = CreateUserStatus.DuplicateUsername; return(false); } } if (Customers.Update(u) == true) { result = true; status = CreateUserStatus.Success; } else { status = CreateUserStatus.UpdateFailed; } } return(result); }
public bool ApplyToProduct(MerchantTribeApplication app, Catalog.Product p, Catalog.UserSpecificPrice price, Membership.CustomerAccount currentCustomer, DateTime currentDateTimeUtc) { if (app == null) { return(false); } if (p == null) { return(false); } if (price == null) { return(false); } if (currentDateTimeUtc == null) { return(false); } PromotionContext context = new PromotionContext(app, p, price, currentCustomer, currentDateTimeUtc); context.CustomerDescription = this.CustomerDescription; // Make sure we have an active promotion before applying if (GetStatus(context.CurrentDateAndTimeUtc) != PromotionStatus.Active) { return(false); } // Make sure we meet all requirements // NOTE: we order by processing cost which should allow us to check // the fastest items first. For example, checking userID is faster // than checking user group because ID is in the context and group // requires a database call. foreach (IPromotionQualification q in this._Qualifications.OrderBy(y => y.ProcessingCost)) { if (!q.MeetsQualification(context)) { return(false); } } // We're qualified, do actions foreach (IPromotionAction a in this._Actions) { a.ApplyAction(context, PromotionActionMode.Unknown); } return(true); }
public PromotionContext(MerchantTribeApplication app, Orders.Order o, Membership.CustomerAccount currentUser, DateTime currentTimeUtc) { this.CustomerDescription = string.Empty; this.Mode = PromotionType.Offer; this.MTApp = app; this.Order = o; this.Product = null; this.UserPrice = null; this.CurrentDateAndTimeUtc = DateTime.UtcNow; this.CurrentCustomer = currentUser; }
public PromotionContext(MerchantTribeApplication app, Catalog.Product p, Catalog.UserSpecificPrice up, Membership.CustomerAccount currentUser, DateTime currentTimeUtc) { this.CustomerDescription = string.Empty; this.Mode = PromotionType.Sale; this.MTApp = app; this.Order = null; this.Product = p; this.UserPrice = up; this.CurrentDateAndTimeUtc = DateTime.UtcNow; this.CurrentCustomer = currentUser; }
public override string FriendlyDescription(MerchantTribeApplication app) { string result = "When User Is:<ul>"; foreach (string userid in this.UserIds()) { Membership.CustomerAccount c = app.MembershipServices.Customers.Find(userid); if (c != null) { result += "<li>" + c.Email + "</li>"; } } result += "</ul>"; return(result); }
private void ApplyOffersToOrder(Order o, PromotionActionMode mode) { if (o == null) { return; } Membership.CustomerAccount currentUser = null; if (o.UserID != string.Empty) { currentUser = _app.MembershipServices.Customers.Find(o.UserID); } List <Marketing.Promotion> offers = _app.MarketingServices.Promotions.FindAllPotentiallyActiveOffers(DateTime.UtcNow); foreach (Marketing.Promotion offer in offers) { offer.ApplyToOrder(_app, o, currentUser, DateTime.UtcNow, mode); } }
public override bool Execute(OrderTaskContext context) { if (context.UserId != string.Empty) { Membership.CustomerAccount user = context.MTApp.MembershipServices.Customers.Find(context.UserId); if (user == null) { return(true); } context.Order.ShippingAddress.CopyTo(user.ShippingAddress); if (!context.Order.BillingAddress.IsEqualTo(context.Order.ShippingAddress)) { context.Order.BillingAddress.CopyTo(user.BillingAddress); } context.MTApp.MembershipServices.UpdateCustomer(user); } return(true); }
public bool CreateCustomer(Membership.CustomerAccount u, ref CreateUserStatus status, string clearPassword) { bool result = false; if (u != null) { Membership.CustomerAccount testUser = new Membership.CustomerAccount(); testUser = Customers.FindByEmail(u.Email); if (testUser != null) { if (testUser.Bvin != string.Empty) { status = CreateUserStatus.DuplicateUsername; return false; } } if (u.Salt == string.Empty) { u.Salt = System.Guid.NewGuid().ToString(); u.Password = u.EncryptPassword(clearPassword); } if (Customers.Create(u) == true) { result = true; status = CreateUserStatus.Success; } else { status = CreateUserStatus.UpdateFailed; } } return result; }
public bool CreateCustomer(Membership.CustomerAccount u, ref CreateUserStatus status, string clearPassword) { bool result = false; if (u != null) { Membership.CustomerAccount testUser = new Membership.CustomerAccount(); testUser = Customers.FindByEmail(u.Email); if (testUser != null) { if (testUser.Bvin != string.Empty) { status = CreateUserStatus.DuplicateUsername; return(false); } } if (u.Salt == string.Empty) { u.Salt = System.Guid.NewGuid().ToString(); u.Password = u.EncryptPassword(clearPassword); } if (Customers.Create(u) == true) { result = true; status = CreateUserStatus.Success; } else { status = CreateUserStatus.UpdateFailed; } } return(result); }
public bool UpdateCustomer(Membership.CustomerAccount u, ref CreateUserStatus status) { bool result = false; if (u != null) { Membership.CustomerAccount testUser = new Membership.CustomerAccount(); testUser = Customers.FindByEmail(u.Email); if (testUser != null && testUser.Bvin != string.Empty) { if (testUser.Bvin != u.Bvin) { status = CreateUserStatus.DuplicateUsername; return false; } } if (Customers.Update(u) == true) { result = true; status = CreateUserStatus.Success; } else { status = CreateUserStatus.UpdateFailed; } } return result; }
public bool UpdateCustomer(Membership.CustomerAccount u) { CreateUserStatus s = new CreateUserStatus(); return(UpdateCustomer(u, ref s)); }
public bool CreateCustomer(Membership.CustomerAccount u, string clearPassword) { CreateUserStatus status = CreateUserStatus.None; return(CreateCustomer(u, ref status, clearPassword)); }
public bool DoPasswordsMatchForCustomer(string trialpassword, Membership.CustomerAccount u) { return(u.Password.Equals(u.EncryptPassword(trialpassword), StringComparison.InvariantCulture)); }