/// <summary> /// You may customized what is returned here based on number od existing orders or date or get number from external system /// </summary> /// <param name="order"></param> /// <param name="context"></param> /// <param name="findEntitiesInListCommand"></param> /// <returns></returns> private string GetCustomOrderNumber(Order order, CommercePipelineExecutionContext context, FindEntitiesInListCommand findEntitiesInListCommand) { //Get Contact Component which contains customer information var contactComponent = order.GetComponent <ContactComponent>(); // get all existing orders. var orders = (IEnumerable <Order>)findEntitiesInListCommand.Process <Order>(context.CommerceContext, CommerceEntity.ListName <Order>(), 0, int.MaxValue).Result.Items; // Total orders var orderCount = orders.Count(); // use the info you have to generate an appropriate order number. You may also use the data you have to call an external system. // in this instance we will just return the number of existing orders incremented by 1 // Return order count and increment by 1 as the new order number. if (orders.Any()) { var nextOrderNumber = orderCount + 1; return(nextOrderNumber.ToString()); } // return a random guid if ther was an isssue retriving existing orders or all else failed. return(Guid.NewGuid().ToString("B")); }
/// <summary> /// / /// </summary> /// <param name="context"></param> /// <param name="findEntitiesInListCommand"></param> /// <returns></returns> private static string GenerateNewCustomerNumber(CommercePipelineExecutionContext context, FindEntitiesInListCommand findEntitiesInListCommand) { // get all existing customers. var customers = (IEnumerable <Customer>)findEntitiesInListCommand.Process <Customer>(context.CommerceContext, CommerceEntity.ListName <Customer>(), 0, int.MaxValue).Result.Items; // Total existing customers var customerCount = customers.Count(); if (!customers.Any()) { return("customer1"); } // use the info you have to generate an appropriate customer number. You may also use the data you have to call an external system. // in this instance we will just return the number of existing customers incremented by 1 // Return customer count and increment by 1 as the new customer number. var nextOrderNumber = customerCount + 1; return("customer" + nextOrderNumber.ToString()); }
/// <summary> /// /// </summary> /// <param name="findEntitiesInListCommand"></param> public CustomOrderNumber(FindEntitiesInListCommand findEntitiesInListCommand) : base((string)null) { // We need to use this to get all existing orders placed before the new order _findEntitiesInListCommand = findEntitiesInListCommand; }
public CartItemsPreviouslyPurchasedPercentOffAction(FindEntitiesInListCommand findEntitiesInListCommand) { _findEntitiesInListCommand = findEntitiesInListCommand; }
/// <summary> /// /// </summary> /// <param name="findEntitiesInListCommand"></param> public CustomizeCustomerNumberBlock(FindEntitiesInListCommand findEntitiesInListCommand) { _findEntitiesInListCommand = findEntitiesInListCommand; }
/// <summary> /// / /// </summary> /// <param name="context"></param> /// <param name="findEntitiesInListCommand"></param> /// <returns></returns> private static void CreateNewSalesforceAccount(CommercePipelineExecutionContext context, FindEntitiesInListCommand findEntitiesInListCommand, Customer customerInfo) { //logic //Account account = new Account(); //account.Name = "FuseIT"; //SalesforceSession salesforceSession = new SalesforceSession( // new LoginDetails("*****@*****.**", "salesforcePassword")); //AccountService accountService = new AccountService(salesforceSession); //var saveResult = accountService.Insert(account); //string newAccountId = null; //if (saveResult.success) //{ // newAccountId = account.Id; //} //Assert.IsTrue(accountService.ValidEntityId(newAccountId)); var isLoggedIn = AuthenticationManager.Login(customerInfo.UserName, customerInfo.Password, false); }
/// <summary> /// /// </summary> /// <param name="findEntitiesInListCommand"></param> public CustomizeCustomerRegistrationBlock(FindEntitiesInListCommand findEntitiesInListCommand) { _findEntitiesInListCommand = findEntitiesInListCommand; }
/// <summary> /// c'tpr /// </summary> /// <param name="findEntitiesInListCommand">findEntitiesInListCommand</param> public AssociatedItemRetrievalService(FindEntitiesInListCommand findEntitiesInListCommand) { _findEntitiesInListCommand = findEntitiesInListCommand; }
public CurrentShopperHasPurchaseItemCondition(FindEntitiesInListCommand findEntitiesInListCommand) { this._getEntitFindEntitiesInListCommand = findEntitiesInListCommand; }
/// <summary> /// c'tor /// </summary> /// <param name="findEntitiesInListCommand">findEntitiesInListCommand</param> public ComposerTemplateService( FindEntitiesInListCommand findEntitiesInListCommand) { _findEntitiesInListCommand = findEntitiesInListCommand; }