Exemplo n.º 1
0
    private void SetSelectedPricesList()
    {
        if (!String.IsNullOrEmpty(filter.Prices))
        {
            Int32 f;
            selectedPricesList = filter.Prices.Split(',').Select(i =>
            {
                if (Int32.TryParse(i, out f) && f >= 0 && f < pricesListDataSource.Count)
                {
                    return(f);
                }

                return(-1);
            })
                                 .Where(i => i != -1)
                                 .Distinct()
                                 .ToDictionary(i => i, i => pricesListDataSource.Table.Rows[i] as FlyerMeDS.fly_sp_GetListSizeRow);

            if (view.ShouldSaveSelectedPricesIntoFlyer)
            {
                var flyer = WizardFlyer.GetFlyer();

                if (flyer != null)
                {
                    flyer.SelectedPricesList = PricesList.FromPricesList(selectedPricesList);
                }
            }
        }
        else
        {
            selectedPricesList = new Dictionary <Int32, FlyerMeDS.fly_sp_GetListSizeRow>();
        }
    }
Exemplo n.º 2
0
        public static Object SaveInDrafts()
        {
            var    flyer   = WizardFlyer.GetFlyer();
            var    saved   = false;
            String message = null;

            if (flyer != null && flyer.OrderId.HasValue)
            {
                flyer.UpdateMarkup();

                var order = flyer.ToOrder();

                if (String.Compare(order.status, Order.flyerstatus.Incomplete.ToString(), true) != 0)
                {
                    saved   = false;
                    message = String.Format("Save operation is available only for incomplete flyers. This flyer (ID = {0}) status is {1}.", order.order_id.ToString(), order.status.ToUpper());
                }
                else
                {
                    order.Save();
                    saved = true;
                }
            }

            if (!saved)
            {
                message = "Nothing to save.";
            }

            var rootUrl = clsUtility.GetRootHost;
            var result  = new { Result = saved, Message = message, RedirectToUrl = rootUrl + "myflyers.aspx" };

            return(result);
        }
Exemplo n.º 3
0
        protected void Page_Load(Object sender, EventArgs args)
        {
            RootURL = clsUtility.GetRootHost;
            flyer   = WizardFlyer.GetFlyer();

            SetFlyerType();
            SetItems();
        }
Exemplo n.º 4
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            var layout = Request["l"];

            if (String.IsNullOrEmpty(layout))
            {
                if (!String.IsNullOrEmpty(Request["orderid"]))
                {
                    var order = Helper.GetOrder(Request, Response);

                    Response.Write(order.markup);
                }
                else
                {
                    var flyer = WizardFlyer.GetFlyer();

                    if (flyer == null)
                    {
                        layout = Helper.GetFlyerLayout(null, FlyerTypes.Seller);
                    }
                    else
                    {
                        layout = flyer.Layout != null ? flyer.Layout : Helper.GetFlyerLayout(null, flyer.FlyerType);
                    }
                }
            }

            if (!String.IsNullOrEmpty(layout))
            {
                var innerLayout = layout;

                if (String.Compare(innerLayout, "sampleseller", true) == 0)
                {
                    innerLayout = "ac0_sampleseller";
                }
                else if (String.Compare(innerLayout, "samplebuyer", true) == 0)
                {
                    innerLayout = "ad0_samplebuyer";
                }

                var control = LoadControl(String.Format("~/flyer/markup/{0}.ascx", innerLayout));

                if (MarkupOnly)
                {
                    Controls.Add(control);
                }
                else
                {
                    var previewControl = LoadControl("~/controls/preview.ascx");

                    previewControl.FindControl("body").Controls.Add(control);
                    Controls.Add(previewControl);
                }
            }
        }
Exemplo n.º 5
0
        private void SetSessionData()
        {
            WizardFlyer flyer = null;
            var         shouldGetFlyerFromOrder = !String.IsNullOrEmpty(Request["orderid"]);

            if (shouldGetFlyerFromOrder)
            {
                var order = Helper.GetOrder(Request, Response, User.Identity.Name);

                if (String.Compare(order.status, Order.flyerstatus.Incomplete.ToString(), true) != 0)
                {
                    Helper.SetErrorResponse(HttpStatusCode.BadRequest, String.Format("Edit operation is available only for incomplete flyers. This flyer (ID = {0}) status is {1}.", order.order_id.ToString(), order.status.ToUpper()));
                }

                flyer = WizardFlyer.FromOrder(order);

                if (order.LastPageNo > 0 && order.LastPageNo < StepTransitions.Count)
                {
                    Response.Redirect(String.Format("{0}createflyer/{1}?step={2}", clsUtility.GetRootHost, PageName, StepTransitions.ElementAt(order.LastPageNo).Key), true);
                }
            }
            else
            {
                flyer = WizardFlyer.GetFlyer();

                if (flyer == null)
                {
                    flyer = WizardFlyer.SetFlyer(FlyerType);
                }

                CreateOrderIfNeeded(flyer);
            }

            currentWizardStep.SetSessionData(Request.IsGet());

            if (renderWizardStep != currentWizardStep)
            {
                renderWizardStep.SetSessionData(true);
            }
        }