Example #1
0
        private void RunOrderEditedWorkflow(SystemOperationResult saveResult)
        {
            MerchantTribe.Commerce.BusinessRules.OrderTaskContext c = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
            c.Order  = MTApp.OrderServices.Orders.FindForCurrentStore(this.BvinField.Value);
            c.UserId = c.Order.UserID;

            if (!MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.OrderEdited))
            {
                foreach (MerchantTribe.Commerce.BusinessRules.WorkflowMessage msg in c.Errors)
                {
                    EventLog.LogEvent("Order Edited Workflow", msg.Description, EventLogSeverity.Warning);
                }
                if (!String.IsNullOrEmpty(saveResult.Message))
                {
                    this.MessageBox1.ShowError(saveResult.Message + " Error Occurred. Please see event log.");
                }
                else
                {
                    this.MessageBox1.ShowError("Error Occurred. Please see event log.");
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(saveResult.Message))
                {
                    this.MessageBox1.ShowError(saveResult.Message);
                }
                else
                {
                    this.MessageBox1.ShowOk("Changes Saved");
                }
            }
        }
        protected void btnSubmit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            this.MessageBox1.ClearMessage();

            if (this.ValidateSelections() == true)
            {
                if (o != null)
                {
                    SaveInfoToOrder(true);

                    //we can't put this in "SaveInfoToOrder" because
                    //that is called multiple times on the page
                    OrderNote note = new OrderNote();
                    note.Note     = InstructionsField.Text;
                    note.IsPublic = false;
                    o.Notes.Add(note);
                    MTApp.OrderServices.Orders.Update(o);

                    // Save as Order
                    MerchantTribe.Commerce.BusinessRules.OrderTaskContext c = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
                    c.UserId = string.Empty;
                    // Use currently selected user for process new order context
                    CustomerAccount u = GetSelectedUserAccount();
                    if (u != null)
                    {
                        if (u.Bvin != string.Empty)
                        {
                            c.UserId = u.Bvin;
                            o.UserID = u.Bvin;
                        }
                    }
                    c.Order = o;

                    if (MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrder))
                    {
                        Response.Redirect("ViewOrder.aspx?id=" + o.bvin);
                    }
                    else
                    {
                        // Show Errors
                        string errorString = string.Empty;
                        for (int i = 0; i <= c.Errors.Count - 1; i++)
                        {
                            errorString += c.Errors[i].Description + "<br />";
                        }
                        if (errorString.Length > 0)
                        {
                            this.MessageBox1.ShowWarning(errorString);
                        }
                    }
                }
            }
        }
Example #3
0
 private void ReloadOrder(OrderShippingStatus previousShippingStatus)
 {
     o = MTApp.OrderServices.Orders.FindForCurrentStore(Request.QueryString["id"]);
     o.EvaluateCurrentShippingStatus();
     MTApp.OrderServices.Orders.Update(o);
     MerchantTribe.Commerce.BusinessRules.OrderTaskContext context 
         = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
     context.Order = o;
     context.UserId = o.UserID;
     context.Inputs.Add("bvsoftware", "PreviousShippingStatus", previousShippingStatus.ToString());
     MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(context, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ShippingChanged);
     LoadOrder();
     this.OrderStatusDisplay1.LoadStatusForOrder(o);
 }
 private void ReloadOrder(OrderShippingStatus previousShippingStatus)
 {
     o = MTApp.OrderServices.Orders.FindForCurrentStore(Request.QueryString["id"]);
     o.EvaluateCurrentShippingStatus();
     MTApp.OrderServices.Orders.Update(o);
     MerchantTribe.Commerce.BusinessRules.OrderTaskContext context
                    = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
     context.Order  = o;
     context.UserId = o.UserID;
     context.Inputs.Add("bvsoftware", "PreviousShippingStatus", previousShippingStatus.ToString());
     MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(context, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ShippingChanged);
     LoadOrder();
     this.OrderStatusDisplay1.LoadStatusForOrder(o);
 }
Example #5
0
        public ActionResult IndexPost()
        {
            CheckoutViewModel model = IndexSetup();

            DisplayPaypalExpressMode(model);
            LoadShippingMethodsForOrder(model);

            if (ValidatePage(model))
            {
                SaveShippingSelections(model);
                // Save Payment Information
                SavePaymentInfo(model);
                MTApp.OrderServices.Orders.Update(model.CurrentOrder);

                // Save as Order
                MerchantTribe.Commerce.BusinessRules.OrderTaskContext c
                         = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
                c.UserId = MTApp.CurrentCustomerId;
                c.Order  = model.CurrentOrder;

                if (MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrder))
                {
                    // Clear Cart ID because we're now an order
                    SessionManager.SetCurrentCartId(MTApp.CurrentStore, string.Empty);

                    // Process Payment
                    if (MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrderPayments))
                    {
                        MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrderAfterPayments);
                        Order tempOrder = MTApp.OrderServices.Orders.FindForCurrentStore(model.CurrentOrder.bvin);
                        MTApp.CurrentRequestContext.IntegrationEvents.OrderReceived(tempOrder, MTApp);
                        Response.Redirect("~/checkout/receipt?id=" + model.CurrentOrder.bvin);
                    }
                }
            }
            // Render Error Summary
            foreach (var v in model.Violations)
            {
                FlashFailure(v.ErrorMessage);
            }

            ViewBag.HideEditButton = true;
            return(View(model));
        }
        protected void btnSubmit_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            this.MessageBox1.ClearMessage();

            if (this.ValidateSelections() == true)
            {
                if (o != null)
                {
                    SaveInfoToOrder(true);

                    //we can't put this in "SaveInfoToOrder" because
                    //that is called multiple times on the page
                    OrderNote note = new OrderNote();
                    note.Note = InstructionsField.Text;
                    note.IsPublic = false;
                    o.Notes.Add(note);
                    MTApp.OrderServices.Orders.Update(o);

                    // Save as Order
                    MerchantTribe.Commerce.BusinessRules.OrderTaskContext c = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
                    c.UserId = string.Empty;
                    // Use currently selected user for process new order context
                    CustomerAccount u = GetSelectedUserAccount();
                    if (u != null)
                    {
                        if (u.Bvin != string.Empty)
                        {
                            c.UserId = u.Bvin;
                            o.UserID = u.Bvin;
                        }
                    }
                    c.Order = o;

                    if (MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrder))
                    {
                        Response.Redirect("ViewOrder.aspx?id=" + o.bvin);
                    }
                    else
                    {
                        // Show Errors   
                        string errorString = string.Empty;
                        for (int i = 0; i <= c.Errors.Count - 1; i++)
                        {
                            errorString += c.Errors[i].Description + "<br />";
                        }
                        if (errorString.Length > 0)
                        {
                            this.MessageBox1.ShowWarning(errorString);
                        }
                    }
                }
            }
        }
        public ActionResult IndexPost()
        {
            CheckoutViewModel model = IndexSetup();
            DisplayPaypalExpressMode(model);
            LoadShippingMethodsForOrder(model);

            if (ValidatePage(model))
            {
                SaveShippingSelections(model);
                // Save Payment Information
                SavePaymentInfo(model);
                MTApp.OrderServices.Orders.Update(model.CurrentOrder);

                // Save as Order
                MerchantTribe.Commerce.BusinessRules.OrderTaskContext c
                    = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
                c.UserId = MTApp.CurrentCustomerId;
                c.Order = model.CurrentOrder;

                if (MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrder))
                {
                    // Clear Cart ID because we're now an order
                    SessionManager.SetCurrentCartId(MTApp.CurrentStore, string.Empty);

                    // Process Payment
                    if (MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrderPayments))
                    {
                        MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.ProcessNewOrderAfterPayments);
                        Order tempOrder = MTApp.OrderServices.Orders.FindForCurrentStore(model.CurrentOrder.bvin);
                        MTApp.CurrentRequestContext.IntegrationEvents.OrderReceived(tempOrder, MTApp);
                        Response.Redirect("~/checkout/receipt?id=" + model.CurrentOrder.bvin);
                    }
                }            
            }
            // Render Error Summary
            foreach (var v in model.Violations)
            {
                FlashFailure(v.ErrorMessage);
            }

            ViewBag.HideEditButton = true;
            return View(model);
        }
Example #8
0
        private void RunOrderEditedWorkflow(SystemOperationResult saveResult)
        {
            MerchantTribe.Commerce.BusinessRules.OrderTaskContext c = new MerchantTribe.Commerce.BusinessRules.OrderTaskContext(MTApp);
            c.Order = MTApp.OrderServices.Orders.FindForCurrentStore(this.BvinField.Value);
            c.UserId = c.Order.UserID;

            if (!MerchantTribe.Commerce.BusinessRules.Workflow.RunByName(c, MerchantTribe.Commerce.BusinessRules.WorkflowNames.OrderEdited))
            {
                foreach (MerchantTribe.Commerce.BusinessRules.WorkflowMessage msg in c.Errors)
                {
                    EventLog.LogEvent("Order Edited Workflow", msg.Description, EventLogSeverity.Warning);
                }
                if (!String.IsNullOrEmpty(saveResult.Message))
                {
                    this.MessageBox1.ShowError(saveResult.Message + " Error Occurred. Please see event log.");
                }
                else
                {
                    this.MessageBox1.ShowError("Error Occurred. Please see event log.");
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(saveResult.Message))
                {
                    this.MessageBox1.ShowError(saveResult.Message);
                }
                else
                {
                    this.MessageBox1.ShowOk("Changes Saved");
                }
            }
        }