Ejemplo n.º 1
0
        public override void UpdateSettings()
        {
            try
            {
                ModuleController objModules = new ModuleController();

                objModules.UpdateModuleSetting(ModuleId, "ProductGroupsInRow", txtProductGroupsInRow.Text.Trim());
                objModules.UpdateModuleSetting(ModuleId, "Template", tplTemplate.Value);
                objModules.UpdateModuleSetting(ModuleId, "DynamicPage", urlSelectDynamicPage.Url);
                objModules.UpdateModuleSetting(ModuleId, "IncludeChilds", chkIncludeChilds.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowProductCount", chkShowProductCount.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "SetTitle", chkSetTitle.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowBreadcrumb", chkShowBreadcrumb.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowExpandCollapse", chkShowExpandCollapse.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "WrapNode", chkWrapNode.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ViewMode", rblViewMode.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "ShowIcons", chkShowIcons.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "RootLevel", cboRootLevel.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "RootLevelFixed", chkRootLevelFixed.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "DefaultProductGroup", cboDefaultProductGroup.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "ShowLevels", txtShowLevels.Text.Trim());
                objModules.UpdateModuleSetting(ModuleId, "AllGroupsImage", BBStoreHelper.GetRelativeFilePath(AllGroupsImageSelector.Url));
                objModules.UpdateModuleSetting(ModuleId, "ShowUpNavigation", chkShowUpNavigation.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowThisNode", chkShowThisNode.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowSubNodes", chkShowSubNodes.Checked.ToString());
            }

            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 2
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            lngProductGroups.UpdateLangs();
            switch (EditState)
            {
            case "new":
                ProductGroupInfo pgNew = new ProductGroupInfo();
                pgNew.ParentId         = ProductGroupId;
                pgNew.PortalId         = PortalId;
                pgNew.Image            = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                pgNew.Icon             = BBStoreHelper.GetRelativeFilePath(IconSelector.Url);
                pgNew.ProductListTabId = Convert.ToInt32(urlTarget.Url);
                pgNew.Disabled         = chkDisabled.Checked;
                pgNew.ViewOrder        = Convert.ToInt32(txtViewOrder.Text);
                int productGroupId = Controller.NewProductGroup(pgNew);
                foreach (ProductGroupLangInfo pgl in lngProductGroups.Langs)
                {
                    pgl.ProductGroupId = productGroupId;
                    Controller.NewProductGroupLang(pgl);
                }
                ProductGroupId = productGroupId;
                EditState      = "update";
                break;

            case "update":
                ProductGroupInfo pgUpdate = Controller.GetProductGroup(PortalId, ProductGroupId);
                pgUpdate.Image            = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                pgUpdate.Icon             = BBStoreHelper.GetRelativeFilePath(IconSelector.Url);
                pgUpdate.ProductListTabId = Convert.ToInt32(urlTarget.Url);
                pgUpdate.Disabled         = chkDisabled.Checked;
                pgUpdate.ViewOrder        = Convert.ToInt32(txtViewOrder.Text);
                Controller.UpdateProductGroup(pgUpdate);
                Controller.DeleteProductGroupLangs(ProductGroupId);
                foreach (ProductGroupLangInfo pgl in lngProductGroups.Langs)
                {
                    pgl.ProductGroupId = ProductGroupId;
                    Controller.NewProductGroupLang(pgl);
                }
                break;

            default:
                break;
            }
            if (Request.QueryString["adminmode"] != null)
            {
                Response.Redirect(Globals.NavigateURL(TabId, "", "adminmode=productgroup"), true);
            }
            else
            {
                Response.Redirect(EditUrl(), true);
            }
        }
Ejemplo n.º 3
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            lngFeatureListItems.UpdateLangs();
            switch (EditState)
            {
            case "new":
                FeatureListItemInfo fliNew = new FeatureListItemInfo();
                fliNew.FeatureListId = FeatureListId;
                fliNew.Image         = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                fliNew.ViewOrder     = Convert.ToInt32(txtViewOrder.Text);
                int featureListItemId = Controller.NewFeatureListItem(fliNew);
                foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs)
                {
                    featureListItemLang.FeatureListItemId = featureListItemId;
                    Controller.NewFeatureListItemLang(featureListItemLang);
                }
                FeatureListItemId = featureListItemId;
                EditState         = "update";
                break;

            case "update":
                FeatureListItemInfo fliUpdate = Controller.GetFeatureListItemById(FeatureListItemId);
                fliUpdate.Image     = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                fliUpdate.ViewOrder = Convert.ToInt32(txtViewOrder.Text);
                Controller.UpdateFeatureListItem(fliUpdate);

                Controller.DeleteFeatureListItemLangs(FeatureListItemId);
                foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs)
                {
                    featureListItemLang.FeatureListItemId = FeatureListItemId;
                    Controller.NewFeatureListItemLang(featureListItemLang);
                }
                break;

            default:
                break;
            }
            if (Request.QueryString["adminmode"] != null)
            {
                Response.Redirect(Globals.NavigateURL(TabId, "", "adminmode=featurelistitem", "featurelist=" + FeatureListId.ToString()), true);
            }
            else
            {
                Response.Redirect(EditUrl(), true);
            }
        }
Ejemplo n.º 4
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // First lets save the product
                SimpleProductInfo SimpleProduct = null;
                bool isNew = false;

                if (ProductId >= 0)
                {
                    SimpleProduct = Controller.GetSimpleProductByProductId(PortalId, ProductId);
                }
                else
                {
                    isNew = true;
                }

                if (SimpleProduct != null)
                {
                    SimpleProduct.Image                = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                    SimpleProduct.ItemNo               = txtItemNo.Text.Trim();
                    SimpleProduct.UnitCost             = taxUnitCost.NetPrice;
                    SimpleProduct.OriginalUnitCost     = taxOriginalUnitCost.NetPrice;
                    SimpleProduct.TaxPercent           = Convert.ToDecimal(txtTaxPercent.Text.Trim());
                    SimpleProduct.LastModifiedByUserId = UserId;
                    SimpleProduct.LastModifiedOnDate   = DateTime.Now;
                    SimpleProduct.Disabled             = chkDisabled.Checked;
                    SimpleProduct.HideCost             = chkHideCost.Checked;
                    SimpleProduct.NoCart               = chkNoCart.Checked;
                    SimpleProduct.SupplierId           = String.IsNullOrEmpty(cboSupplier.SelectedValue) ? -1 : Convert.ToInt32(cboSupplier.SelectedValue);
                    SimpleProduct.UnitId               = String.IsNullOrEmpty(ddlUnit.SelectedValue) ? -1 : Convert.ToInt32(ddlUnit.SelectedValue);
                    SimpleProduct.Weight               = Convert.ToDecimal(txtWeight.Text.Trim());
                    Controller.UpdateSimpleProduct(SimpleProduct);
                }
                else
                {
                    SimpleProduct                      = new SimpleProductInfo();
                    SimpleProduct.PortalId             = PortalId;
                    SimpleProduct.Image                = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                    SimpleProduct.ItemNo               = txtItemNo.Text.Trim();
                    SimpleProduct.UnitCost             = taxUnitCost.NetPrice;
                    SimpleProduct.OriginalUnitCost     = taxOriginalUnitCost.NetPrice;
                    SimpleProduct.TaxPercent           = Convert.ToDecimal(txtTaxPercent.Text.Trim());
                    SimpleProduct.CreatedOnDate        = DateTime.Now;
                    SimpleProduct.LastModifiedOnDate   = DateTime.Now;
                    SimpleProduct.CreatedByUserId      = UserId;
                    SimpleProduct.LastModifiedByUserId = UserId;
                    SimpleProduct.Disabled             = chkDisabled.Checked;
                    SimpleProduct.HideCost             = chkHideCost.Checked;
                    SimpleProduct.NoCart               = chkNoCart.Checked;
                    SimpleProduct.SupplierId           = String.IsNullOrEmpty(cboSupplier.SelectedValue) ? -1 : Convert.ToInt32(cboSupplier.SelectedValue);
                    SimpleProduct.UnitId               = String.IsNullOrEmpty(ddlUnit.SelectedValue) ? -1 : Convert.ToInt32(ddlUnit.SelectedValue);
                    SimpleProduct.Weight               = Convert.ToDecimal(txtWeight.Text.Trim());
                    ProductId = Controller.NewSimpleProduct(SimpleProduct);
                }

                // Lets update the ShippingModel
                Controller.DeleteProductShippingModelByProduct(ProductId);
                int shippingModelId = -1;
                if (cboShippingModel.SelectedValue != null && Int32.TryParse(cboShippingModel.SelectedValue, out shippingModelId))
                {
                    Controller.InsertProductShippingModel(new ProductShippingModelInfo()
                    {
                        ShippingModelId = shippingModelId, SimpleProductId = ProductId
                    });
                }


                // Now lets update Language information
                lngSimpleProducts.UpdateLangs();
                Controller.DeleteSimpleProductLangs(ProductId);
                foreach (SimpleProductLangInfo si in lngSimpleProducts.Langs)
                {
                    si.SimpleProductId = ProductId;
                    Controller.NewSimpleProductLang(si);
                }

                // Lets handle the Product Groups
                int redirProductGroupId = 0;
                if (HasProductGroupModule)
                {
                    if (Request.QueryString["productgroup"] != null)
                    {
                        redirProductGroupId = Convert.ToInt32(Request.QueryString["productgroup"]);
                    }


                    Controller.DeleteProductInGroups(ProductId);
                    foreach (TreeNode node in treeProductGroup.CheckedNodes)
                    {
                        int ProductGroupId = Convert.ToInt32(node.Value.Substring(1));
                        Controller.NewProductInGroup(ProductId, ProductGroupId);
                        if (redirProductGroupId == 0)
                        {
                            redirProductGroupId = ProductGroupId;
                        }
                    }
                }

                // If we created a new product, we bound this as a fixed product to the module
                if (isNew && this.Parent.NamingContainer.ID != "ViewAdmin")
                {
                    ModuleController module = new ModuleController();
                    module.UpdateModuleSetting(ModuleId, "ProductId", ProductId.ToString());
                }
                FeatureGrid.SaveFeatures();

                List <string> addParams = new List <string>();

                if (Request["adminmode"] != null)
                {
                    addParams.Add("adminmode=productlist");
                }
                if (redirProductGroupId > 0)
                {
                    addParams.Add("productgroup=" + redirProductGroupId.ToString());
                }
                addParams.Add("productId=" + ProductId.ToString());

                Response.Redirect(Globals.NavigateURL(TabId, "", addParams.ToArray()), true);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }