// Product Category Editor
        private void LoadProductCategoryEditor(ProductCategory q)
        {
            List <MerchantTribe.Commerce.Catalog.CategorySnapshot> allCats   = MyPage.MTApp.CatalogServices.Categories.FindAll();
            Collection <System.Web.UI.WebControls.ListItem>        available = MerchantTribe.Commerce.Catalog.Category.ListFullTreeWithIndents(allCats, true);

            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentCategoryIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t = available.Where(y => y.Value == bvin).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.Text;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstProductCategories.Items.Clear();
            foreach (System.Web.UI.WebControls.ListItem li in available)
            {
                this.lstProductCategories.Items.Add(li);
            }

            this.gvProductCategories.DataSource = displayData;
            this.gvProductCategories.DataBind();
        }
Пример #2
0
        public override void LoadQualification()
        {
            var allCats   = HccApp.CatalogServices.Categories.FindAll();
            var available = CategoriesHelper.ListFullTreeWithIndents(allCats, true);

            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var bvin in TypedQualification.CurrentCategoryIds())
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t = available.FirstOrDefault(y => y.Value == bvin);
                if (t != null)
                {
                    item.DisplayName = t.Text;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            lstProductCategories.Items.Clear();
            foreach (var li in available)
            {
                lstProductCategories.Items.Add(li);
            }

            gvProductCategories.DataSource = displayData;
            gvProductCategories.DataBind();
        }
        // Product Type Editor
        private void LoadProductTypeEditor(ProductType q)
        {
            List <MerchantTribe.Commerce.Catalog.ProductType> allTypes = MyPage.MTApp.CatalogServices.ProductTypes.FindAll();

            allTypes.Insert(0, new MerchantTribe.Commerce.Catalog.ProductType()
            {
                Bvin = "0", ProductTypeName = "Generic"
            });

            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentTypeIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t = allTypes.Where(y => y.Bvin == bvin).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.ProductTypeName;
                    allTypes.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstProductTypes.DataSource     = allTypes;
            this.lstProductTypes.DataValueField = "Bvin";
            this.lstProductTypes.DataTextField  = "ProductTypeName";
            this.lstProductTypes.DataBind();

            this.gvProductTypes.DataSource = displayData;
            this.gvProductTypes.DataBind();
        }
        // User Is in Group
        private void LoadUserIsInGroupEditor(UserIsInGroup q)
        {
            List <MerchantTribe.Commerce.Contacts.PriceGroup> allGroups = MyPage.MTApp.ContactServices.PriceGroups.FindAll();

            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentGroupIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t = allGroups.Where(y => y.Bvin == bvin).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.Name;
                    allGroups.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstUserIsInGroup.DataSource     = allGroups;
            this.lstUserIsInGroup.DataValueField = "Bvin";
            this.lstUserIsInGroup.DataTextField  = "Name";
            this.lstUserIsInGroup.DataBind();

            this.gvUserIsInGroup.DataSource = displayData;
            this.gvUserIsInGroup.DataBind();
        }
Пример #5
0
        public override void LoadQualification()
        {
            var available = HccApp.OrderServices.ShippingMethods.FindAll(HccApp.CurrentStore.Id);

            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var itemid in TypedQualification.ItemIds())
            {
                var item = new FriendlyBvinDisplay
                {
                    bvin        = itemid,
                    DisplayName = itemid
                };

                var t = available.FirstOrDefault(y => y.Bvin.ToUpperInvariant() == itemid.ToUpperInvariant());
                if (t != null)
                {
                    item.DisplayName = t.Name;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            lstShippingMethodIs.Items.Clear();
            lstShippingMethodIs.DataSource     = available;
            lstShippingMethodIs.DataTextField  = "Name";
            lstShippingMethodIs.DataValueField = "Bvin";
            lstShippingMethodIs.DataBind();

            gvShippingMethodIs.DataSource = displayData;
            gvShippingMethodIs.DataBind();
        }
        // Shipping Method Is
        private void LoadShippingMethodIsEditor(ShippingMethodIs q)
        {
            List <ShippingMethod> available = MyPage.MTApp.OrderServices.ShippingMethods.FindAll(MyPage.MTApp.CurrentStore.Id);

            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string itemid in q.ItemIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = itemid;
                item.DisplayName = itemid;

                var t = available.Where(y => y.Bvin == itemid).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.Name;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstShippingMethodIs.Items.Clear();
            this.lstShippingMethodIs.DataSource     = available;
            this.lstShippingMethodIs.DataTextField  = "Name";
            this.lstShippingMethodIs.DataValueField = "Bvin";
            this.lstShippingMethodIs.DataBind();

            this.gvShippingMethodIs.DataSource = displayData;
            this.gvShippingMethodIs.DataBind();
        }
        public override void LoadAction()
        {
            ProductPickerOrderProducts.LoadSearch();
            var displayData = new List <FriendlyBvinDisplay>();
            var products    = TypedAction.GetQuantities();

            foreach (var bvin in products.Keys)
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;
                item.Quantity    = products[bvin];

                var p = HccApp.CatalogServices.Products.FindWithCache(item.bvin);

                if (p != null)
                {
                    item.DisplayName = string.Format("[{0}]{1}", p.Sku, p.ProductName);
                }

                displayData.Add(item);
            }

            gvProducts.DataSource = displayData;
            gvProducts.DataBind();
        }
Пример #8
0
        public override void LoadQualification()
        {
            var allGroups = HccApp.ContactServices.PriceGroups.FindAll();

            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var bvin in TypedQualification.CurrentGroupIds())
            {
                var item = new FriendlyBvinDisplay
                {
                    bvin        = bvin,
                    DisplayName = bvin
                };

                var t = allGroups.FirstOrDefault(y => y.Bvin == bvin);
                if (t != null)
                {
                    item.DisplayName = t.Name;
                    allGroups.Remove(t);
                }
                displayData.Add(item);
            }

            lstUserIsInGroup.DataSource     = allGroups;
            lstUserIsInGroup.DataValueField = "Bvin";
            lstUserIsInGroup.DataTextField  = "Name";
            lstUserIsInGroup.DataBind();

            gvUserIsInGroup.DataSource = displayData;
            gvUserIsInGroup.DataBind();
        }
        public override void LoadQualification()
        {
            var allTypes = HccApp.CatalogServices.ProductTypes.FindAll();

            if (TypedQualification is ProductTypeIs)
            {
                var pti = (ProductTypeIs)TypedQualification;
                cbIsNot.Checked = pti.IsNotMode;
            }

            if (TypedQualification is ProductType)
            {
                var pti = (ProductType)TypedQualification;
                cbIsNot.Checked = pti.IsNotMode;
            }

            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var bvin in TypedQualification.CurrentIds())
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t = allTypes.FirstOrDefault(y => y.Bvin == bvin);
                if (t != null)
                {
                    item.DisplayName = t.ProductTypeName;
                    allTypes.Remove(t);
                }
                displayData.Add(item);
            }

            if (allTypes != null)
            {
                allTypes = allTypes.Where(y => !string.IsNullOrEmpty(y.ProductTypeName)).ToList();
            }

            if (displayData != null)
            {
                displayData = displayData.Where(y => !string.IsNullOrEmpty(y.DisplayName)).ToList();
            }
            lstProductTypes.DataSource     = allTypes;
            lstProductTypes.DataValueField = "Bvin";
            lstProductTypes.DataTextField  = "ProductTypeName";
            lstProductTypes.DataBind();

            gvProductTypes.DataSource = displayData;
            gvProductTypes.DataBind();
        }
        // Order has Coupon Editor
        private void LoadOrderHasCouponEditor(OrderHasCoupon q)
        {
            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string coupon in q.CurrentCoupons())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = coupon;
                item.DisplayName = coupon;
                displayData.Add(item);
            }
            this.gvOrderCoupons.DataSource = displayData;
            this.gvOrderCoupons.DataBind();
        }
Пример #11
0
        public override void LoadQualification()
        {
            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var coupon in TypedQualification.CurrentCoupons())
            {
                var item = new FriendlyBvinDisplay
                {
                    bvin        = coupon,
                    DisplayName = coupon
                };
                displayData.Add(item);
            }
            gvOrderCoupons.DataSource = displayData;
            gvOrderCoupons.DataBind();
        }
Пример #12
0
        public override void LoadQualification()
        {
            if (IsNotMode)
            {
                pnlHasHeader.Visible    = pnlHas.Visible = false;
                pnlHasNotHeader.Visible = pnlHasNot.Visible = true;
            }
            else
            {
                var ohp = (OrderHasProducts)TypedQualification;

                pnlHas.Visible    = true;
                pnlHasNot.Visible = false;

                if (lstOrderProductSetMode.Items.Count == 0)
                {
                    lstOrderProductSetMode.Items.Add(new ListItem(Localization.GetString("Any"), "1"));
                    lstOrderProductSetMode.Items.Add(new ListItem(Localization.GetString("All"), "0"));
                }

                var typedQty = 1;
                int.TryParse(ohp.Quantity.ToString(), out typedQty);

                OrderProductQuantityField.Text = typedQty == 0 ? "1" : ohp.Quantity.ToString();
            }

            ProductPickerOrderProducts.LoadSearch();
            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var bvin in TypedQualification.CurrentIds())
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var p = HccApp.CatalogServices.Products.FindWithCache(item.bvin);
                if (p != null)
                {
                    item.DisplayName = "[" + p.Sku + "] " + p.ProductName;
                }
                displayData.Add(item);
            }

            gvOrderProducts.DataSource = displayData;
            gvOrderProducts.DataBind();
        }
Пример #13
0
        public override void LoadQualification()
        {
            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var bvin in TypedQualification.UserIds())
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var c = HccApp.MembershipServices.Customers.Find(item.bvin);
                if (c != null)
                {
                    item.DisplayName = c.Email;
                }
                displayData.Add(item);
            }

            gvUserIs.DataSource = displayData;
            gvUserIs.DataBind();
        }
        // User Is Editor
        private void LoadUserIsEditor(UserIs q)
        {
            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string bvin in q.UserIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                MerchantTribe.Commerce.Membership.CustomerAccount c = MyPage.MTApp.MembershipServices.Customers.Find(item.bvin);
                if (c != null)
                {
                    item.DisplayName = c.Email;
                }
                displayData.Add(item);
            }

            this.gvUserIs.DataSource = displayData;
            this.gvUserIs.DataBind();
        }
        public override void LoadQualification()
        {
            if (ddlCalcMode.Items.Count == 0)
            {
                ddlCalcMode.Items.Add(new ListItem(Localization.GetString("TotalPrice"), "0"));
                ddlCalcMode.Items.Add(new ListItem(Localization.GetString("TotalCount"), "1"));
            }

            var allCats   = HccApp.CatalogServices.Categories.FindAll();
            var available = CategoriesHelper.ListFullTreeWithIndents(allCats, true);

            var displayData = new List <FriendlyBvinDisplay>();

            foreach (var bvin in TypedQualification.CategoryIds())
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t = available.FirstOrDefault(y => y.Value == bvin);
                if (t != null)
                {
                    item.DisplayName = t.Text;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            lstLineItemCategories.Items.Clear();
            foreach (var li in available)
            {
                lstLineItemCategories.Items.Add(li);
            }

            ddlCalcMode.SelectedValue = ((int)TypedQualification.CalculationMode).ToString();
            txtSumOrCount.Text        = TypedQualification.SumAmount.ToString();

            gvLineItemCategories.DataSource = displayData;
            gvLineItemCategories.DataBind();
        }
        // Order has Products Editor
        private void LoadOrderProductEditor(OrderHasProducts q)
        {
            this.ProductPickerOrderProducts.LoadSearch();

            List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentProductIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                MerchantTribe.Commerce.Catalog.Product p = MyPage.MTApp.CatalogServices.Products.Find(item.bvin);
                if (p != null)
                {
                    item.DisplayName = "[" + p.Sku + "] " + p.ProductName;
                }
                displayData.Add(item);
            }

            this.gvOrderProducts.DataSource = displayData;
            this.gvOrderProducts.DataBind();
        }
        // Order has Coupon Editor
        private void LoadOrderHasCouponEditor(OrderHasCoupon q)
        {
            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string coupon in q.CurrentCoupons())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = coupon;
                item.DisplayName = coupon;
                displayData.Add(item);
            }
            this.gvOrderCoupons.DataSource = displayData;
            this.gvOrderCoupons.DataBind();
        }
        // Product Category Editor
        private void LoadProductCategoryEditor(ProductCategory q)
        {
            List<MerchantTribe.Commerce.Catalog.CategorySnapshot> allCats = MyPage.MTApp.CatalogServices.Categories.FindAll();
            Collection<System.Web.UI.WebControls.ListItem> available = MerchantTribe.Commerce.Catalog.Category.ListFullTreeWithIndents(allCats, true);

            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentCategoryIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = bvin;
                item.DisplayName = bvin;

                var t = available.Where(y => y.Value == bvin).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.Text;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstProductCategories.Items.Clear();
            foreach (System.Web.UI.WebControls.ListItem li in available)
            {
                this.lstProductCategories.Items.Add(li);
            }

            this.gvProductCategories.DataSource = displayData;
            this.gvProductCategories.DataBind();
        }
        // Product Type Editor
        private void LoadProductTypeEditor(ProductType q)
        {
            List<MerchantTribe.Commerce.Catalog.ProductType> allTypes = MyPage.MTApp.CatalogServices.ProductTypes.FindAll();
            allTypes.Insert(0, new MerchantTribe.Commerce.Catalog.ProductType() { Bvin = "0", ProductTypeName = "Generic" });

            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentTypeIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = bvin;
                item.DisplayName = bvin;

                var t = allTypes.Where(y => y.Bvin == bvin).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.ProductTypeName;
                    allTypes.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstProductTypes.DataSource = allTypes;
            this.lstProductTypes.DataValueField = "Bvin";
            this.lstProductTypes.DataTextField = "ProductTypeName";
            this.lstProductTypes.DataBind();

            this.gvProductTypes.DataSource = displayData;
            this.gvProductTypes.DataBind();
        }
        // Shipping Method Is
        private void LoadShippingMethodIsEditor(ShippingMethodIs q)
        {
            List<ShippingMethod> available = MyPage.MTApp.OrderServices.ShippingMethods.FindAll(MyPage.MTApp.CurrentStore.Id);

            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string itemid in q.ItemIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = itemid;
                item.DisplayName = itemid;

                var t = available.Where(y => y.Bvin == itemid).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.Name;
                    available.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstShippingMethodIs.Items.Clear();
            this.lstShippingMethodIs.DataSource = available;
            this.lstShippingMethodIs.DataTextField = "Name";
            this.lstShippingMethodIs.DataValueField = "Bvin";
            this.lstShippingMethodIs.DataBind();

            this.gvShippingMethodIs.DataSource = displayData;
            this.gvShippingMethodIs.DataBind();
        }
        // User Is Editor
        private void LoadUserIsEditor(UserIs q)
        {
            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string bvin in q.UserIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = bvin;
                item.DisplayName = bvin;

                MerchantTribe.Commerce.Membership.CustomerAccount c = MyPage.MTApp.MembershipServices.Customers.Find(item.bvin);
                if (c != null)
                {
                    item.DisplayName = c.Email;
                }
                displayData.Add(item);
            }

            this.gvUserIs.DataSource = displayData;
            this.gvUserIs.DataBind();
        }
        // User Is in Group
        private void LoadUserIsInGroupEditor(UserIsInGroup q)
        {
            List<MerchantTribe.Commerce.Contacts.PriceGroup> allGroups = MyPage.MTApp.ContactServices.PriceGroups.FindAll();

            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentGroupIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = bvin;
                item.DisplayName = bvin;

                var t = allGroups.Where(y => y.Bvin == bvin).FirstOrDefault();
                if (t != null)
                {
                    item.DisplayName = t.Name;
                    allGroups.Remove(t);
                }
                displayData.Add(item);
            }

            this.lstUserIsInGroup.DataSource = allGroups;
            this.lstUserIsInGroup.DataValueField = "Bvin";
            this.lstUserIsInGroup.DataTextField = "Name";
            this.lstUserIsInGroup.DataBind();

            this.gvUserIsInGroup.DataSource = displayData;
            this.gvUserIsInGroup.DataBind();
        }
Пример #23
0
        public override void LoadQualification()
        {
            var vendors       = HccApp.ContactServices.Vendors.FindAll();
            var manufacturers = HccApp.ContactServices.Manufacturers.FindAll();

            var displayData = new List <FriendlyBvinDisplay>();

            cbIsNot.Checked = TypedQualification.IsNotMode;

            foreach (var bvin in TypedQualification.CurrentIds())
            {
                var item = new FriendlyBvinDisplay();
                item.bvin        = bvin;
                item.DisplayName = bvin;

                var t =
                    vendors
                    .FirstOrDefault(y => y.Bvin.Trim().ToLowerInvariant() == bvin.Trim().ToLowerInvariant());

                if (t != null)
                {
                    item.DisplayName = t.DisplayName;
                    vendors.Remove(t);
                }

                if (t == null)
                {
                    t =
                        manufacturers
                        .FirstOrDefault(y => y.Bvin.Trim().ToLowerInvariant() == bvin.Trim().ToLowerInvariant());

                    if (t != null)
                    {
                        item.DisplayName = t.DisplayName;
                        manufacturers.Remove(t);
                    }
                }

                displayData.Add(item);
            }

            var sepText = "---------------------------------------";

            var list = new List <VendorManufacturer>();

            list.AddRange(vendors);
            list.Add(new VendorManufacturer {
                DisplayName = sepText, Bvin = string.Empty
            });
            list.AddRange(manufacturers);

            lstItems.DataSource     = list;
            lstItems.DataValueField = "Bvin";
            lstItems.DataTextField  = "DisplayName";
            lstItems.DataBind();

            var sepitem = lstItems.Items.FindByText(sepText);

            if (sepitem != null)
            {
                sepitem.Attributes.Add("disabled", "disabled");
            }

            gvItems.DataSource = displayData;
            gvItems.DataBind();
        }
        // Product Bvin Editor
        private void LoadProductBvinEditor(ProductBvin q)
        {
            this.ProductPicker1.LoadSearch();

            List<FriendlyBvinDisplay> displayData = new List<FriendlyBvinDisplay>();

            foreach (string bvin in q.CurrentProductIds())
            {
                FriendlyBvinDisplay item = new FriendlyBvinDisplay();
                item.bvin = bvin;
                item.DisplayName = bvin;

                MerchantTribe.Commerce.Catalog.Product p = MyPage.MTApp.CatalogServices.Products.Find(item.bvin);
                if (p != null)
                {
                    item.DisplayName = "[" + p.Sku + "] " + p.ProductName;
                }
                displayData.Add(item);
            }

            this.gvProductBvins.DataSource = displayData;
            this.gvProductBvins.DataBind();
        }