Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            int productId = Request.QueryStringNativeInt("productId");
            int groupId   = Request.QueryStringNativeInt("groupId");
            int kitItemId = Request.QueryStringNativeInt("itemId");

            KitProductData kitProduct = KitProductData.Find(productId, Customer.Current);

            KitData = kitProduct;

            if (kitProduct != null)
            {
                KitGroupData kitGroup = kitProduct.GetGroup(groupId);
                if (kitGroup != null)
                {
                    KitItemData item = kitGroup.GetItem(kitItemId);
                    if (item != null)
                    {
                        KitItem = item;
                        kitProduct.TempFileStub = Request.QueryStringCanBeDangerousContent("stub");
                    }
                }
            }

            base.OnInit(e);
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = -1;
            Response.AddHeader("pragma", "no-cache");

            ThisCustomer = Customer.Current;

            int kitId   = Request.QueryStringNativeInt("kitId");
            int groupId = Request.QueryStringNativeInt("groupId");

            KitProductData kit = KitProductData.Find(kitId, ThisCustomer);

            KitGroup = kit.GetGroup(groupId);

            BindData();


            base.OnInit(e);
        }
        private void UpdateKitItems(bool updateAll)
        {
            foreach (RepeaterItem rptItemKit in dlMappedKits.Items)
            {
                if (rptItemKit.ItemType == ListItemType.Item ||
                    rptItemKit.ItemType == ListItemType.AlternatingItem)
                {
                    HiddenField hdfKitProductId = rptItemKit.FindControl <HiddenField>("hdfKitProductId");
                    int         kitId           = hdfKitProductId.Value.ToNativeInt();

                    KitProductData kit = MappedKitProducts.Find(k => k.Id == kitId);
                    if (kit != null)
                    {
                        Repeater rptKitGroups = rptItemKit.FindControl <Repeater>("rptKitGroups");
                        foreach (RepeaterItem rptItemGroup in rptKitGroups.Items)
                        {
                            if (rptItemGroup.ItemType == ListItemType.Item ||
                                rptItemGroup.ItemType == ListItemType.AlternatingItem)
                            {
                                HiddenField hdfGroupId = rptItemGroup.FindControl <HiddenField>("hdfGroupId");
                                int         groupId    = hdfGroupId.Value.ToNativeInt();

                                KitGroupData group = kit.GetGroup(groupId);
                                if (group != null)
                                {
                                    Repeater rptKitItems = rptItemGroup.FindControl <Repeater>("rptKitItems");
                                    foreach (RepeaterItem rptKitItem in rptKitItems.Items)
                                    {
                                        if (rptKitItem.ItemType == ListItemType.Item ||
                                            rptKitItem.ItemType == ListItemType.AlternatingItem)
                                        {
                                            HiddenField hdfKitItemtId = rptKitItem.FindControl <HiddenField>("hdfKitItemtId");
                                            int         kitItemId     = hdfKitItemtId.Value.ToNativeInt();

                                            CheckBox chkUpdate = rptKitItem.FindControl <CheckBox>("chkUpdate");
                                            if (chkUpdate.Checked)
                                            {
                                                KitItemData kitItem = group.GetItem(kitItemId);
                                                if (kitItem != null)
                                                {
                                                    kitItem.Name        = XmlCommon.GetLocaleEntry(Variant.Name, LocaleSetting, false);
                                                    kitItem.Description = XmlCommon.GetLocaleEntry(Variant.Description, LocaleSetting, false);

                                                    if (updateAll)
                                                    {
                                                        kitItem.PriceDelta  = Variant.SalePrice > decimal.Zero ? Variant.SalePrice : Variant.Price;
                                                        kitItem.WeightDelta = Variant.Weight;
                                                    }
                                                    kitItem.Save(LocaleSetting);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            BindData();
        }