예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            /*
            Response.Write("<br>Page_load2 ");
            if (Page.IsPostBack)
                Response.Write("<br>Postback2 ");
            */

            /*
            if (Page.IsPostBack)
            {
                labelLog.Text = labelLog.Text + "<br>Page load PostBack" + DateTime.Now.ToString();
                int cat1 = -1;
                int.TryParse(DropDownList1.SelectedValue, out cat1);
                int cat2 = -1;
                int.TryParse(DropDownList2.SelectedValue, out cat2);
                labelLog.Text = labelLog.Text + "<br>dd1: " + cat1.ToString() + " dd2: " + cat2.ToString() + DateTime.Now.ToString();
            }
            else
            {
                labelLog.Text = labelLog.Text + "<br>Page load - Not a PostBack" + DateTime.Now.ToString();
            } */
                //Response.Write("Page_PreRender");

                npTitle = Localization.GetString("NPTitle.Text", this.LocalResourceFile);
                fpTitle = Localization.GetString("FPTitle.Text", this.LocalResourceFile);
                ppTitle = Localization.GetString("PPTitle.Text", this.LocalResourceFile);
                cpTitle = Localization.GetString("CPTitle.Text", this.LocalResourceFile);

                try
                {
                    if (storeInfo == null)
                    {
                        StoreController storeController = new StoreController();
                        storeInfo = storeController.GetStoreInfo(PortalId);
                        if (storeInfo.PortalTemplates)
                        {
                            templatesPath = PortalSettings.HomeDirectoryMapPath + "Store\\";
                            CssTools.AddCss(this.Page, PortalSettings.HomeDirectory + "Store", PortalId);
                        }
                        else
                        {
                            templatesPath = MapPath(ModulePath) + "\\";
                            CssTools.AddCss(this.Page, this.TemplateSourceDirectory, PortalId);
                        }
                    }

                    moduleSettings = new ModuleSettings(this.ModuleId, this.TabId);

                    catalogNav = new CatalogNavigation(Request.QueryString);

                    if (catalogNav.CategoryID == Null.NullInteger)
                    {
                        if (bool.Parse(moduleSettings.General.UseDefaultCategory))
                        {
                            catalogNav.CategoryID = int.Parse(moduleSettings.General.DefaultCategoryID);
                        }
                    }

                    if (catalogNav.ProductID != Null.NullInteger)
                    {
                        ProductController productController = new ProductController();
                        productInfo = productController.GetProduct(catalogNav.ProductID);
                        catalogNav.CategoryID = productInfo.CategoryID;
                    }

                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        CategoryController categoryController = new CategoryController();
                        categoryInfo = categoryController.GetCategory(catalogNav.CategoryID);
                    }

                    this.Controls.Add(TemplateController.ParseTemplate(templatesPath, moduleSettings.General.Template, new ProcessTokenDelegate(processToken)));

                    // Canadean changed: added current categoryid on a hidden dropdown, to use on the cascade categories
                    /*
                    if (catalogNav.CategoryID != Null.NullInteger)
                    {
                        ddHidden.Items.Add(new ListItem(catalogNav.CategoryID.ToString(), catalogNav.CategoryID.ToString()));
                    }
                    */

                }
                catch (Exception ex)
                {
                    string ErrorSettings = Localization.GetString("ErrorSettings", this.LocalResourceFile);
                    Response.Write("<br>" + ex.Message);
                    Response.Write("<br>" + ex.StackTrace);

                    //Exceptions.ProcessModuleLoadException(ErrorSettings, this, ex, true);
                }
                if (DotNetNuke.Framework.AJAX.IsInstalled())
                {
                    DotNetNuke.Framework.AJAX.RegisterScriptManager();
                }

            //}
        }
예제 #2
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    PortalSecurity security = new PortalSecurity();

                    ProductInfo product = new ProductInfo();
                    product = ((ProductInfo)CBO.InitializeObject(product, typeof(ProductInfo)));

                    product.ProductID		= _nav.ProductID;
                    product.PortalID		= this.PortalId;
                    product.Manufacturer    = ""; // security.InputFilter(txtManufacturer.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.MultiLine);
                    product.ModelName		= security.InputFilter(txtModelName.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.MultiLine);
                    product.ModelNumber		= security.InputFilter(txtModelNumber.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.MultiLine);
                    //product.Summary			= security.InputFilter(txtSummary.Text, PortalSecurity.FilterFlag.MultiLine);
                    product.Summary         = security.InputFilter(txtSummary.Text, PortalSecurity.FilterFlag.NoScripting);
                    product.UnitCost		= Decimal.Parse(txtUnitPrice.Text);
                    product.PriceStr        = tbPriceStr.Text;
                    //product.ProductImage	= GetImageUrl(image1);
                    product.CategoryID      = 4; // int.Parse(cmbCategory.SelectedValue);
                    product.Archived		= chkArchived.Checked;
                    product.Featured        = false;  // chkFeatured.Checked;
                    product.Description     = security.InputFilter(txtDescription.Text, PortalSecurity.FilterFlag.NoScripting);
                    product.DescriptionTwo  = security.InputFilter(txtDescriptionTwo.Text, PortalSecurity.FilterFlag.NoScripting);
                    product.DescriptionThree = security.InputFilter(txtDescriptionThree.Text, PortalSecurity.FilterFlag.NoScripting);
                    product.CreatedByUser = this.UserId.ToString();
                    product.CreatedDate		= DateTime.Now;
                    product.ProductWeight   = 0; //txtUnitWeight.Text.Length > 0 ? Decimal.Parse(txtUnitWeight.Text) : -1;
                    product.ProductHeight   = 0; //txtUnitHeight.Text.Length > 0 ? Decimal.Parse(txtUnitHeight.Text) : -1;
                    product.ProductLength   = 0; //txtUnitLength.Text.Length > 0 ? Decimal.Parse(txtUnitLength.Text) : -1;
                    product.ProductWidth    = 0; //txtUnitWidth.Text.Length > 0 ? Decimal.Parse(txtUnitWidth.Text) : -1;
                    product.SaleStartDate   = calSaleStartDate.SelectedDate != Null.NullDate ? calSaleStartDate.SelectedDate : DateTime.Parse("01/01/9999");
                    product.SaleEndDate     = calSaleEndDate.SelectedDate != Null.NullDate ? calSaleEndDate.SelectedDate : DateTime.Parse("01/01/9999");
                    product.SalePrice       = txtSalePrice.Text.Length > 0 ? Decimal.Parse(txtSalePrice.Text) : -1;

                    // canadean changed: added new parameters
                    product.CategoryID1 = int.Parse(cmbCategory1.SelectedValue);
                    product.CategoryID2 = int.Parse(cmbCategory2.SelectedValue);
                    product.CategoryID3 = int.Parse(cmbCategory3.SelectedValue);
                    product.NumPages = txtNumPages.Text.Length > 0 ? int.Parse(txtNumPages.Text) : -1;
                    ///product.PublishDate = calPublishDate.SelectedDate != Null.NullDate ? calPublishDate.SelectedDate : DateTime.Parse("01/01/9999");

                    CultureInfo ukCulture = new CultureInfo("en-GB");
                    product.PublishDate = tbPublishDate.Text != "" ? DateTime.Parse(tbPublishDate.Text, ukCulture.DateTimeFormat) : DateTime.Parse("01/01/9999");
                    //product.DeliveryMethod = txtDeliveryMethod.Text.Length > 0 ? int.Parse(txtDeliveryMethod.Text) : -1;
                    product.DeliveryMethod = int.Parse(cmbDeliveryMethod.SelectedValue);
                    //product.AvailableOnline = true; // chkAvailableOnline.Checked;
                    product.AvailableOnline = chkAvailableOnline.Checked;
                    //product.ProductImage2 = GetImageUrl(image2);
                    //product.ProductImage3 = GetImageUrl(image3);
                    product.DescriptionTag = tbDescriptionTag.Text;
                    product.TOC_Html = txtTOC_Html.Text;

                    product.ProductFile = GetImageUrl(file1);
                    product.ProductPreview = GetImageUrl(preview1);

                    //product.ProductFile = tbFile1.Text;
                    //product.ProductPreview = tbPreview1.Text;

                    calSaleStartDate.SelectedDate = product.SaleStartDate == Null.NullDate ? Null.NullDate : product.SaleStartDate;
                    calSaleEndDate.SelectedDate = product.SaleEndDate == Null.NullDate ? Null.NullDate : product.SaleEndDate;
                    txtSalePrice.Text = product.SalePrice == Null.NullDecimal ? string.Empty : product.SalePrice.ToString("0.00");

                    ProductController controller = new ProductController();
                    if (Null.IsNull(product.ProductID))
                    {
                        controller.AddProduct(product);
                    }
                    else
                    {
                        // Ajouté pour contourner le bug System.NullReferenceException
                        if (product.ProductImage.StartsWith("http:///"))
                        {
                            product.ProductImage = product.ProductImage.Replace("http://", "");
                        }
                        if (product.ProductImage2.StartsWith("http:///"))
                        {
                            product.ProductImage2 = product.ProductImage2.Replace("http://", "");
                        }
                        if (product.ProductImage3.StartsWith("http:///"))
                        {
                            product.ProductImage3 = product.ProductImage3.Replace("http://", "");
                        }
                        if (product.ProductFile.StartsWith("http:///"))
                        {
                            product.ProductFile = product.ProductFile.Replace("http://", "");
                        }
                        if (product.ProductPreview.StartsWith("http:///"))
                        {
                            product.ProductPreview = product.ProductPreview.Replace("http://", "");
                        }

                        controller.UpdateProduct(product);
                    }

                    invokeEditComplete();
                }
            }
            catch(Exception ex)
            {
                Response.Write(ex.Message);
                Response.Write(ex.StackTrace);

                //Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
예제 #3
0
 protected bool HasTOC_Html(String productId)
 {
     ProductController productController = new ProductController();
     productInfo = productController.GetProduct(Int32.Parse(productId));
     if (productInfo.TOC_Html != "")
         return true;
     else
         return false;
 }
예제 #4
0
        private void lstProducts_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            productInfo = (ProductInfo)e.Item.DataItem;

            e.Item.Width = columnWidth;

            HtmlTable listTable = new HtmlTable();
            listTable.Border = 0;
            listTable.CellPadding = 0;
            listTable.CellSpacing = 0;
            listTable.Height = "100%";
            listTable.Width = columnWidth.ToString();

            HtmlTableRow listRow = new HtmlTableRow();

            HtmlTableCell listCell = new HtmlTableCell();
            listCell.Height = "100%";
            listCell.Width = columnWidth.ToString();

            ProductDetail productListItem = (ProductDetail)LoadControl(ModulePath + "ProductDetail.ascx");
            productListItem.Template = template;
            productListItem.ParentControl = this.ParentControl;
            productListItem.CategoryID = productInfo.CategoryID;
            productListItem.ShowThumbnail = ShowThumbnail;
            productListItem.ThumbnailWidth = ThumbnailWidth;
            productListItem.DataSource = productInfo;
            productListItem.DetailID = detailPageID;
            productListItem.InList = true;

            listCell.Controls.Add(productListItem);
            listRow.Controls.Add(listCell);
            listTable.Controls.Add(listRow);

            e.Item.Controls.Add(listTable);
        }