private void LoadWrapStyles()
        {
            WrapGroup wrapGroup = WrapGroupDataSource.Load(this.WrapGroupId);

            if (wrapGroup != null)
            {
                _WrapStyles = wrapGroup.WrapStyles;
            }
        }
Exemplo n.º 2
0
 protected void AddButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         WrapGroup wrapGroup = new WrapGroup();
         wrapGroup.Name = AddName.Text;
         wrapGroup.Save();
         Response.Redirect("EditWrapGroup.aspx?WrapGroupId=" + wrapGroup.Id.ToString());
     }
 }
        protected void Page_Init(object sender, EventArgs e)
        {
            int wrapGroupId = AlwaysConvert.ToInt(Request.QueryString["WrapGroupId"]);

            _WrapGroup = WrapGroupDataSource.Load(wrapGroupId);
            if (_WrapGroup == null)
            {
                Response.Redirect("Default.aspx");
            }
            Caption.Text = string.Format(Caption.Text, _WrapGroup.Name);
            _IconPath    = AbleCommerce.Code.PageHelper.GetAdminThemeIconPath(this.Page);
            FindAssignProducts1.AssignmentValue  = _WrapGroup.Id;
            FindAssignProducts1.OnAssignProduct += new AssignProductEventHandler(FindAssignProducts1_AssignProduct);
            FindAssignProducts1.OnLinkCheck     += new AssignProductEventHandler(FindAssignProducts1_LinkCheck);
            FindAssignProducts1.OnCancel        += new EventHandler(FindAssignProducts1_CancelButton);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            BasketItem item      = BasketItemDataSource.Load(BasketItemId);
            WrapGroup  wrapGroup = item.Product.WrapGroup;

            if (wrapGroup != null)
            {
                _wrapStyles = wrapGroup.WrapStyles;
            }

            BuildWrapStyleList();

            if (!Page.IsPostBack)
            {
                // load initial values from calling parent control
                this.InnerGiftMessage.Text = _GiftMessage;
            }
        }
        private void InitializeGiftWrapChoices()
        {
            BasketItem item      = BasketItemDataSource.Load(_BasketItemId);
            WrapGroup  wrapGroup = item.Product.WrapGroup;

            if (wrapGroup != null)
            {
                _wrapStyles = wrapGroup.WrapStyles;
            }

            BuildWrapStyleList();

            if (string.IsNullOrEmpty(InnerGiftMessage.Text))
            {
                // load initial values from calling parent control
                this.InnerGiftMessage.Text = _GiftMessage;
            }
        }
Exemplo n.º 6
0
 protected void WrapGroupGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Copy")
     {
         int       wrapGroupId = (int)WrapGroupGrid.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value;
         WrapGroup copy        = WrapGroup.Copy(wrapGroupId, true);
         if (copy != null)
         {
             // THE NAME SHOULD NOT EXCEED THE MAX 50 CHARS
             String newName = "Copy of " + copy.Name;
             if (newName.Length > 50)
             {
                 newName = newName.Substring(0, 47) + "...";
             }
             copy.Name = newName;
             copy.Save();
             WrapGroupGrid.DataBind();
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int wrapGroupId = AlwaysConvert.ToInt(Request.QueryString["WrapGroupId"]);

            _WrapGroup = WrapGroupDataSource.Load(wrapGroupId);
            if (_WrapGroup == null)
            {
                Response.Redirect("Default.aspx");
            }
            _WrapGroup.WrapStyles.Sort("OrderBy");
            if (!Page.IsPostBack)
            {
                Name.Text            = _WrapGroup.Name;
                ViewState["Caption"] = Caption.Text;
                Caption.Text         = string.Format(Caption.Text, _WrapGroup.Name);
                //INITIALIZE THE ADD WRAP GROUP DIALOG
                AddWrapStyleDialog addDialog = AbleCommerce.Code.PageHelper.RecursiveFindControl(this, "AddWrapStyleDialog1") as AddWrapStyleDialog;
                if (addDialog != null)
                {
                    addDialog.WrapGroupId = wrapGroupId;
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Create or gets the groups of elements that will form rows/colums.
        /// </summary>
        // ReSharper disable once ReturnTypeCanBeEnumerable.Local
        private List<WrapGroup> GetGroups(Size size)
        {
            if (!groupsInvalidated)
                return groupCache;
            var maxLength = GetStackLength(size); // Size of one row/column

            var groups = new List<WrapGroup>();
            var group = new WrapGroup();

            for (var i = 0; i < Elements.Count; i++)
            {
                var child = Elements[i];
                var childSize = GetStackLength(child.DesiredSize);

                // If the group length + this child is more than the column/row length, start a new group.
                if (group.Length + childSize > maxLength)
                {
                    groups.Add(group);
                    group = new WrapGroup();
                }

                group.AddElement(child);
                group.Length += childSize;
            }

            groups.Add(group);
            groupsInvalidated = false;
            groupCache = groups;
            return groups;
        }
Exemplo n.º 9
0
        private void ProcessRules(BreadCrumbItem breadCrumbItem)
        {
            int id;

            if (breadCrumbItem.Url == "#")
            {
                return;
            }
            switch (breadCrumbItem.Url.ToLowerInvariant())
            {
            case "~/admin/orders/shipments/editshipment.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]);
                breadCrumbItem.Url  += "?OrderShipmentId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, id);
                break;

            case "~/admin/products/editproduct.aspx":
            case "~/admin/products/variants/variants.aspx":
            case "~/admin/products/variants/options.aspx":
            case "~/admin/products/digitalgoods/digitalgoods.aspx":
            case "~/admin/products/kits/editkit.aspx":
            case "~/admin/products/assets/images.aspx":
            case "~/admin/products/editproducttemplate.aspx":
            case "~/admin/products/specials/default.aspx":
                int categoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
                id = AbleCommerce.Code.PageHelper.GetProductId();
                Product product = ProductDataSource.Load(id);
                if (categoryId > 0)
                {
                    breadCrumbItem.Url += "?CategoryId=" + categoryId + "&ProductId=" + id;
                }
                else
                {
                    breadCrumbItem.Url += "?ProductId=" + id;
                }
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, product.Name);
                break;

            case "~/admin/orders/vieworder.aspx":
            case "~/admin/orders/edit/editorderitems.aspx":
            case "~/admin/orders/viewdigitalgoods.aspx":
            case "~/admin/orders/payments/default.aspx":
            case "~/admin/orders/shipments/default.aspx":
                id = AbleCommerce.Code.PageHelper.GetOrderId();
                Order order = OrderDataSource.Load(id);
                breadCrumbItem.Url  += "?OrderNumber=" + order.OrderNumber;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, order.OrderNumber);
                break;

            case "~/admin/marketing/coupons/editcoupon.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["CouponId"]);
                Coupon coupon = CouponDataSource.Load(id);
                breadCrumbItem.Url  += "?CouponId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, coupon.Name);
                break;

            case "~/admin/products/variants/editoption.aspx":
            case "~/admin/products/variants/editchoices.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["OptionId"]);
                Option option = OptionDataSource.Load(id);
                breadCrumbItem.Url  += "?OptionId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, option.Name);
                break;

            case "~/admin/products/giftwrap/editwrapgroup.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["WrapGroupId"]);
                WrapGroup wrapGroup = WrapGroupDataSource.Load(id);
                breadCrumbItem.Url  += "?WrapGroupId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, wrapGroup.Name);
                break;

            case "~/admin/marketing/email/managelist.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["EmailListId"]);
                EmailList emailList = EmailListDataSource.Load(id);
                if (emailList != null)
                {
                    breadCrumbItem.Url  += "?EmailListId=" + id;
                    breadCrumbItem.Title = string.Format(breadCrumbItem.Title, emailList.Name);
                }
                break;

            case "~/admin/marketing/discounts/editdiscount.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["VolumeDiscountId"]);
                VolumeDiscount discount = VolumeDiscountDataSource.Load(id);
                breadCrumbItem.Url  += "?VolumeDiscountId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, discount.Name);
                break;

            case "~/admin/catalog/editwebpage.aspx":
                id = AbleCommerce.Code.PageHelper.GetWebpageId();
                Webpage webpage = WebpageDataSource.Load(id);
                breadCrumbItem.Url  += "?WebpageId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, webpage.Name);
                break;

            case "~/admin/catalog/editLink.aspx":
                id = AbleCommerce.Code.PageHelper.GetLinkId();
                Link link = LinkDataSource.Load(id);
                breadCrumbItem.Url  += "?LinkId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, link.Name);
                break;

            case "~/admin/people/users/edituser.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["UserId"]);
                User user = UserDataSource.Load(id);
                breadCrumbItem.Url  += "?UserId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, user.UserName);
                break;

            case "~/admin/digitalgoods/editdigitalgood.aspx":
            case "~/admin/digitalgoods/serialkeyproviders/defaultprovider/configure.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);
                DigitalGood dg = DigitalGoodDataSource.Load(id);
                if (dg != null)
                {
                    breadCrumbItem.Url  += "?DigitalGoodId=" + id;
                    breadCrumbItem.Title = string.Format(breadCrumbItem.Title, dg.Name);
                }
                break;

            case "~/admin/products/producttemplates/editproducttemplate.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["ProductTemplateId"]);
                ProductTemplate template = ProductTemplateDataSource.Load(id);
                if (template == null)
                {
                    InputField field = InputFieldDataSource.Load(AlwaysConvert.ToInt(Request.QueryString["InputFieldId"]));
                    if (field != null)
                    {
                        template = field.ProductTemplate;
                        id       = template.Id;
                    }
                }
                if (template != null)
                {
                    breadCrumbItem.Url  += "?ProductTemplateId=" + id;
                    breadCrumbItem.Title = string.Format(breadCrumbItem.Title, template.Name);
                }
                else
                {
                }
                break;

            case "~/admin/reports/dailyabandonedbaskets.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["BasketId"]);
                Basket basket = BasketDataSource.Load(id);
                if (basket != null)
                {
                    breadCrumbItem.Url += "?ReportDate=" + basket.User.LastActivityDate.Value.ToShortDateString();
                }
                break;
            }

            // resolve relative urls
            if (breadCrumbItem.Url.StartsWith("~/"))
            {
                breadCrumbItem.Url = Page.ResolveUrl(breadCrumbItem.Url);
            }
        }
Exemplo n.º 10
0
 private void Awake()
 {
     _eventSystem = EventSystem.current;
     _wrapGroup   = _itemsContainer.GetComponent <WrapGroup>();
     _itemsContainer.gameObject.SetActive(false);
 }