Ejemplo n.º 1
0
        /// <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"));
        }
Ejemplo n.º 2
0
        /// <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());
        }
Ejemplo n.º 3
0
 /// <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;
 }
Ejemplo n.º 4
0
 public CartItemsPreviouslyPurchasedPercentOffAction(FindEntitiesInListCommand findEntitiesInListCommand)
 {
     _findEntitiesInListCommand = findEntitiesInListCommand;
 }
Ejemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="findEntitiesInListCommand"></param>
 public CustomizeCustomerNumberBlock(FindEntitiesInListCommand findEntitiesInListCommand)
 {
     _findEntitiesInListCommand = findEntitiesInListCommand;
 }
Ejemplo n.º 6
0
        /// <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);
        }
Ejemplo n.º 7
0
 /// <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;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// c'tor
 /// </summary>
 /// <param name="findEntitiesInListCommand">findEntitiesInListCommand</param>
 public ComposerTemplateService(
     FindEntitiesInListCommand findEntitiesInListCommand)
 {
     _findEntitiesInListCommand = findEntitiesInListCommand;
 }