protected void LoadStaticPage() { var page = StaticPageService.GetStaticPage(StaticPageId); if (page == null) { spAuxFoundNotification.InnerHtml = Resource.Client_AuxView_AuxNotFound; return; } lblHead.Text = page.PageName; txtPageName.Text = page.PageName; chkEnabled.Checked = page.Enabled; chkIndexAtSitemap.Checked = page.IndexAtSiteMap; txtSynonym.Text = page.UrlPath; txtSortOrder.Text = page.SortOrder.ToString(); if (page.Parent != null) { lblParentName.Text = page.Parent.PageName; } hfParentId.Value = page.ParentId.ToString(); //meta //hfMetaId.Value = page.MetaId.ToString(); page.Meta = MetaInfoService.GetMetaInfo(StaticPageId, MetaType.StaticPage) ?? new MetaInfo(0, 0, MetaType.StaticPage, string.Empty, string.Empty, string.Empty); txtPageTitle.Text = page.Meta.Title; txtMetaKeywords.Text = page.Meta.MetaKeywords; txtMetaDescription.Text = page.Meta.MetaDescription; //ddlParentPage.SelectedValue = page.ParentPageId.ToString(); fckPageText.Text = page.PageText; popTree.ExceptId = StaticPageId; //popTree.UpdateTree(); }
private void LoadNewsById(int newsId) { NewsItem news = NewsService.GetNewsById(newsId); if (news == null) { MsgErr("News with this ID not exist"); return; } txtStringID.Text = news.UrlPath; txtDate.Text = news.AddingDate.ToShortDateString(); txtTime.Text = news.AddingDate.ToString("HH:mm"); txtTitle.Text = news.Title; if (news.Picture != null) { lblImage.Text = news.Picture.PhotoName; pnlImage.Visible = true; Image1.ImageUrl = FoldersHelper.GetPath(FolderType.News, news.Picture.PhotoName, true); Image1.ToolTip = news.Picture.PhotoName; } else { lblImage.Text = @"No picture"; pnlImage.Visible = false; } FCKTextToPublication.Text = news.TextToPublication; CKEditorControlAnnatation.Text = news.TextAnnotation; chkOnMainPage.Checked = news.ShowOnMainPage; //FCKTextToEmail.Text = news.TextToEmail; //hfMetaId.Text = news.MetaId.ToString(); news.Meta = MetaInfoService.GetMetaInfo(newsId, MetaType.News) ?? new MetaInfo(0, 0, MetaType.News, string.Empty, string.Empty, string.Empty, string.Empty); txtHeadTitle.Text = news.Meta.Title; txtH1.Text = news.Meta.H1; txtMetaKeys.Text = news.Meta.MetaKeywords; txtMetaDescription.Text = news.Meta.MetaDescription; dboNewsCategory.DataBind(); dboNewsCategory.SelectedValue = news.NewsCategoryID.ToString(CultureInfo.InvariantCulture); }
protected void LoadCategory(int catId) { try { Category category = CategoryService.GetCategory(catId); txtName.Text = category.Name; if (category.Picture != null && File.Exists(FoldersHelper.GetImageCategoryPathAbsolut(CategoryImageType.Big, category.Picture.PhotoName))) { Label10.Text = category.Picture.PhotoName; pnlImage.Visible = true; Image1.ImageUrl = FoldersHelper.GetImageCategoryPath(CategoryImageType.Big, category.Picture.PhotoName, true); Image1.ToolTip = category.Picture.PhotoName; } else { Label10.Text = @"No picture"; pnlImage.Visible = false; } if (category.MiniPicture != null && File.Exists(FoldersHelper.GetImageCategoryPathAbsolut(CategoryImageType.Small, category.MiniPicture.PhotoName))) { lblMiniPictureFileName.Text = category.MiniPicture.PhotoName; pnlMiniImage.Visible = true; imgMiniPicture.ImageUrl = FoldersHelper.GetImageCategoryPath(CategoryImageType.Small, category.MiniPicture.PhotoName, true); imgMiniPicture.ToolTip = category.MiniPicture.PhotoName; } else { lblMiniPictureFileName.Text = @"No picture"; pnlMiniImage.Visible = false; } if (category.Icon != null && File.Exists(FoldersHelper.GetImageCategoryPathAbsolut(CategoryImageType.Icon, category.Icon.PhotoName))) { lblIconFileName.Text = category.Icon.PhotoName; pnlIcon.Visible = true; imgIcon.ImageUrl = FoldersHelper.GetImageCategoryPath(CategoryImageType.Icon, category.Icon.PhotoName, true); imgIcon.ToolTip = category.Icon.PhotoName; } else { lblIconFileName.Text = @"No picture"; pnlIcon.Visible = false; } SubCategoryDisplayStyle.SelectedValue = category.DisplayStyle; //ChkDisplayChildProducts.Checked = category.DisplayChildProducts; ChkDisplayBrands.Checked = category.DisplayBrandsInMenu; ChkDisplaySubCategories.Checked = category.DisplaySubCategoriesInMenu; fckDescription.Text = category.Description; fckBriefDescription.Text = category.BriefDescription; txtSortIndex.Text = category.SortOrder.ToString(); ChkEnableCategory.Checked = category.Enabled; txtSynonym.Text = category.UrlPath; ddlSorting.SelectedValue = ((int)category.Sorting).ToString(); var meta = MetaInfoService.GetMetaInfo(catId, MetaType.Category); if (meta == null) { category.Meta = new MetaInfo(0, 0, MetaType.Product, string.Empty, string.Empty, string.Empty, string.Empty); chbDefaultMeta.Checked = true; } else { chbDefaultMeta.Checked = false; category.Meta = meta; txtTitle.Text = category.Meta.Title; txtMetaKeywords.Text = category.Meta.MetaKeywords; txtMetaDescription.Text = category.Meta.MetaDescription; txtH1.Text = category.Meta.H1; } } catch (Exception ex) { MsgErr(ex.Message + " at LoadCategory"); Debug.LogError(ex, "at LoadCategory"); } }
private void LoadProduct(Product product) { lProductName.Text = product.Name; lbIsProductActive.ForeColor = _product.Enabled ? System.Drawing.Color.FromArgb(2, 125, 194) : System.Drawing.Color.Red; lbIsProductActive.Visible = !AddingNewProduct; lbIsProductActive.Text = _product.Enabled ? Resource.Admin_m_Product_Active : Resource.Admin_Catalog_ProductDisabled; btnSave.Text = AddingNewProduct ? Resource.Admin_Product_AddProduct : Resource.Admin_Product_Save; btnAdd.Visible = !AddingNewProduct; if (product.ProductId != 0) { btnAdd.OnClientClick = string.Format("window.location=\'Product.aspx?CategoryID={0}\';return false;", CategoryID > 0 ? CategoryID : 0); lblProductId.Text = product.ProductId.ToString(); txtStockNumber.Text = product.ArtNo; txtName.Text = product.Name; txtSynonym.Text = product.UrlPath; chkEnabled.Checked = product.Enabled; chkOrderByRequest.Checked = product.OrderByRequest; txtWeight.Text = product.Weight.ToString(); var temp = product.Size.Split('|'); if (temp.Length == 3) { txtSizeLength.Text = temp[0]; txtSizeWidth.Text = temp[1]; txtSizeHeight.Text = temp[2]; } else { txtSizeLength.Text = string.IsNullOrEmpty(product.Size) ? "0" : product.Size; } popUpBrand.SelectBrandId = product.BrandId; lBrand.Text = product.BrandId == 0 ? Resource.Admin_Product_NotSelected : product.Brand.Name; chkBestseller.Checked = product.BestSeller; chkRecommended.Checked = product.Recomended; chkNew.Checked = product.New; chkOnSale.Checked = product.OnSale; var flagEnabled = ProductService.GetCountOfCategoriesByProductId(product.ProductId) > 0; chkBestseller.Enabled = flagEnabled; chkRecommended.Enabled = flagEnabled; chkNew.Enabled = flagEnabled; chkOnSale.Enabled = flagEnabled; lblMarkersDisabled.Visible = !flagEnabled; txtSupplyPrice.Text = product.Offers.First().SupplyPrice.ToString("#0.00") ?? "0"; txtPrice.Text = product.Offers.First().Price.ToString("#0.00") ?? "0"; txtShippingPrice.Text = product.Offers.First().ShippingPrice.ToString("#0.00") ?? "0"; txtAmount.Text = product.Offers.First().Amount.ToString(); txtUnit.Text = product.Offers.First().Unit; txtMaxAmount.Text = product.Offers.First().MaxAmount.ToString(); txtMinAmount.Text = product.Offers.First().MinAmount.ToString(); txtMultiplicity.Text = product.Offers.First().Multiplicity.ToString(); txtDiscount.Text = product.Discount.ToString(); fckDescription.Text = product.Description; fckBriefDescription.Text = product.BriefDescription; var meta = MetaInfoService.GetMetaInfo(product.ProductId, MetaType.Product); if (meta == null) { _product.Meta = new MetaInfo(0, 0, MetaType.Product, string.Empty, string.Empty, string.Empty); chbDefaultMeta.Checked = true; } else { chbDefaultMeta.Checked = false; _product.Meta = meta; txtTitle.Text = _product.Meta.Title; txtMetaKeywords.Text = _product.Meta.MetaKeywords; txtMetaDescription.Text = _product.Meta.MetaDescription; } LoadCategoryTree(); } }
private void WriteItem(ICsvWriter writer, Product product) { var meta = MetaInfoService.GetMetaInfo(product.ID, MetaType.Product) ?? new MetaInfo(0, 0, MetaType.Product, string.Empty, string.Empty, string.Empty, string.Empty); foreach (var item in _fieldMapping) { if (item == ProductFields.Sku) { writer.WriteField(product.ArtNo); } if (item == ProductFields.Name) { writer.WriteField(product.Name); } if (item == ProductFields.ParamSynonym) { writer.WriteField(product.UrlPath); } if (item == ProductFields.Category) { writer.WriteField((CategoryService.GetCategoryStringByProductId(product.ProductId, _columSeparator))); } if (item == ProductFields.Sorting) { writer.WriteField((CategoryService.GetCategoryStringByProductId(product.ProductId, _columSeparator, true))); } if (item == ProductFields.Enabled) { writer.WriteField(product.Enabled ? "+" : "-"); } if (!product.HasMultiOffer) { var offer = product.Offers.FirstOrDefault() ?? new Offer(); if (item == ProductFields.Price) { writer.WriteField(offer.Price.ToString("F2")); } if (item == ProductFields.PurchasePrice) { writer.WriteField(offer.SupplyPrice.ToString("F2")); } if (item == ProductFields.Amount) { writer.WriteField(offer.Amount.ToString(CultureInfo.InvariantCulture)); } if (item == ProductFields.MultiOffer) { writer.WriteField(string.Empty); } } else { if (item == ProductFields.Price) { writer.WriteField(string.Empty); } if (item == ProductFields.PurchasePrice) { writer.WriteField(string.Empty); } if (item == ProductFields.Amount) { writer.WriteField(string.Empty); } if (item == ProductFields.MultiOffer) { writer.WriteField(OfferService.OffersToString(product.Offers, _columSeparator, _propertySeparator)); } } if (item == ProductFields.Unit) { writer.WriteField(product.Unit); } if (item == ProductFields.ShippingPrice) { writer.WriteField(product.ShippingPrice.ToString("F2")); } if (item == ProductFields.Discount) { writer.WriteField(product.Discount.ToString("F2")); } if (item == ProductFields.Weight) { writer.WriteField(product.Weight.ToString("F2")); } if (item == ProductFields.Size) { writer.WriteField(product.Size.Replace("|", " x ")); } if (item == ProductFields.BriefDescription) { writer.WriteField(product.BriefDescription); } if (item == ProductFields.Description) { writer.WriteField(product.Description); } if (item == ProductFields.Title) { writer.WriteField(meta.Title); } if (item == ProductFields.H1) { writer.WriteField(meta.H1); } if (item == ProductFields.MetaKeywords) { writer.WriteField(meta.MetaKeywords); } if (item == ProductFields.MetaDescription) { writer.WriteField(meta.MetaDescription); } if (item == ProductFields.Markers) { writer.WriteField(ProductService.MarkersToString(product, _columSeparator)); } if (item == ProductFields.Photos) { writer.WriteField(PhotoService.PhotoToString(product.ProductPhotos, _columSeparator, _propertySeparator)); } if (item == ProductFields.Videos) { writer.WriteField(ProductVideoService.VideoToString(product.ProductVideos, _columSeparator)); } if (item == ProductFields.Properties) { writer.WriteField(PropertyService.PropertiesToString(product.ProductPropertyValues, _columSeparator, _propertySeparator)); } if (item == ProductFields.Producer) { writer.WriteField(BrandService.BrandToString(product.BrandId)); } if (item == ProductFields.OrderByRequest) { writer.WriteField(product.AllowPreOrder ? "+" : "-"); } if (item == ProductFields.SalesNotes) { writer.WriteField(product.SalesNote); } if (item == ProductFields.Related) { writer.WriteField(ProductService.LinkedProductToString(product.ProductId, RelatedType.Related, _columSeparator)); } if (item == ProductFields.Alternative) { writer.WriteField(ProductService.LinkedProductToString(product.ProductId, RelatedType.Alternative, _columSeparator)); } if (item == ProductFields.CustomOption) { writer.WriteField(CustomOptionsService.CustomOptionsToString(CustomOptionsService.GetCustomOptionsByProductId(product.ProductId))); } if (item == ProductFields.Gtin) { writer.WriteField(product.Gtin); } if (item == ProductFields.GoogleProductCategory) { writer.WriteField(product.GoogleProductCategory); } if (item == ProductFields.Adult) { writer.WriteField(product.Adult ? "+" : "-"); } if (item == ProductFields.ManufacturerWarranty) { writer.WriteField(product.ManufacturerWarranty ? "+" : "-"); } } writer.NextRecord(); }
private void LoadProduct(Product product) { SetMeta(GetPageTitle()); lProductName.Text = product.Name; lbIsProductActive.ForeColor = _product.Enabled ? System.Drawing.Color.FromArgb(2, 125, 194) : System.Drawing.Color.Red; lbIsProductActive.Visible = !AddingNewProduct; lbIsProductActive.Text = _product.Enabled ? Resource.Admin_m_Product_Active : Resource.Admin_Catalog_ProductDisabled; //btnAdd.Visible = !AddingNewProduct; if (product.ProductId != 0) { //btnAdd.OnClientClick = string.Format("window.location=\'Product.aspx?CategoryID={0}\';return false;", CategoryID > 0 ? CategoryID : 0); lblProductId.Text = product.ProductId.ToString(); txtStockNumber.Text = product.ArtNo; txtName.Text = product.Name; txtSynonym.Text = product.UrlPath; chkEnabled.Checked = product.Enabled; chkAllowPreOrder.Checked = product.AllowPreOrder; txtWeight.Text = product.Weight.ToString(); txtPopularityManually.Text = product.PopularityManually.ToString(); var temp = product.Size.Split('|'); if (temp.Length == 3) { txtSizeLength.Text = temp[0]; txtSizeWidth.Text = temp[1]; txtSizeHeight.Text = temp[2]; } else { txtSizeLength.Text = string.IsNullOrEmpty(product.Size) ? "0" : product.Size; } popUpBrand.SelectBrandId = product.BrandId; lBrand.Text = product.BrandId == 0 ? Resource.Admin_Product_NotSelected : product.Brand.Name; chkBestseller.Checked = product.BestSeller; chkRecommended.Checked = product.Recomended; chkNew.Checked = product.New; chkOnSale.Checked = product.OnSale; var flagEnabled = ProductService.GetCountOfCategoriesByProductId(product.ProductId) > 0; chkBestseller.Enabled = flagEnabled; chkRecommended.Enabled = flagEnabled; chkNew.Enabled = flagEnabled; chkOnSale.Enabled = flagEnabled; lblMarkersDisabled.Visible = !flagEnabled; txtShippingPrice.Text = product.ShippingPrice.ToString("#0.00") ?? "0"; txtUnit.Text = product.Unit; txtMaxAmount.Text = product.MaxAmount.ToString(); txtMinAmount.Text = product.MinAmount.ToString(); txtMultiplicity.Text = product.Multiplicity.ToString(); txtSalesNote.Text = product.SalesNote; txtGtin.Text = product.Gtin; txtGoogleProductCategory.Text = product.GoogleProductCategory; chbAdult.Checked = product.Adult; chbManufacturerWarranty.Checked = product.ManufacturerWarranty; txtDiscount.Text = product.Discount.ToString(); fckDescription.Text = product.Description; fckBriefDescription.Text = product.BriefDescription; productOffers.Offers = product.Offers; productOffers.HasMultiOffer = product.HasMultiOffer; productOffers.ProductID = ProductId; productOffers.ArtNo = product.ArtNo; var meta = MetaInfoService.GetMetaInfo(product.ProductId, MetaType.Product); if (meta == null) { _product.Meta = new MetaInfo(0, 0, MetaType.Product, string.Empty, string.Empty, string.Empty, string.Empty); chbDefaultMeta.Checked = true; } else { chbDefaultMeta.Checked = false; _product.Meta = meta; txtTitle.Text = _product.Meta.Title; txtMetaKeywords.Text = _product.Meta.MetaKeywords; txtMetaDescription.Text = _product.Meta.MetaDescription; txtH1.Text = _product.Meta.H1; } LoadCategoryTree(); } else { productOffers.HasMultiOffer = false; productOffers.ProductID = 0; } }
public static void SaveProductsToCsv(string path, Encodings.EncodingsEnum encodeType, Separators.SeparatorsEnum delimetr, List <ProductFields.Fields> fieldMapping) { using (var writer = new CsvHelper.CsvWriter(new StreamWriter(path, false, Encodings.GetEncoding(encodeType)))) { writer.Configuration.Delimiter = Separators.GetCharSeparator(delimetr); //var fields = new List<string> { "SKU", "Name*", "ParamSynonym", "Category", "Enabled*", "Price*", "PurchasePrice*", "Amount*", "Unit", "Discount", "ShippingPrice", "Weight", "Size", "BriefDescription", "Description" }; //foreach (var item in fields) // writer.WriteField(item); foreach (var item in fieldMapping) { writer.WriteField(ProductFields.GetStringNameByEnum(item)); } writer.NextRecord(); var items = ProductService.GetProducts(); if (items == null) { return; } var regex = new Regex("^[0-9]+$"); for (int j = 0; j < items.Count; j++) { var product = items[j]; if (!ExportStatistic.IsRun) { return; } var offer = product.Offers.FirstOrDefault() ?? new Offer { Amount = 0, Price = 0, SupplyPrice = 0, Unit = "", ShippingPrice = 0 }; var meta = MetaInfoService.GetMetaInfo(product.ID, MetaType.Product) ?? new MetaInfo(0, 0, MetaType.Product, string.Empty, string.Empty, string.Empty); for (int i = 0; i < fieldMapping.Count; i++) { var item = fieldMapping[i]; //Changed by Evgeni to insert dotes if (item == ProductFields.Fields.Sku) { string art = product.ArtNo; //if (art.Contains("-") == false && art.Length > 7) // { // art = art.Insert(7, ".").Insert(4, ".").Insert(1, "."); // } // writer.WriteField(art); // writer.WriteField(product.ArtNo); } // if (item == ProductFields.Fields.Name) { writer.WriteField(product.Name); } if (item == ProductFields.Fields.ParamSynonym) { if (regex.IsMatch(product.UrlPath)) { writer.WriteField("IPD" + product.UrlPath); } else { writer.WriteField(product.UrlPath); } } if (item == ProductFields.Fields.Category) { writer.WriteField((GetCategoryStringByProductID(product.ProductId))); } if (item == ProductFields.Fields.Enabled) { writer.WriteField(product.Enabled ? "+" : "-"); } if (item == ProductFields.Fields.Price) { writer.WriteField(offer.Price.ToString("F2")); } if (item == ProductFields.Fields.PurchasePrice) { writer.WriteField(offer.SupplyPrice.ToString("F2")); } if (item == ProductFields.Fields.Amount) { writer.WriteField(offer.Amount.ToString()); } if (item == ProductFields.Fields.Unit) { writer.WriteField(offer.Unit); } if (item == ProductFields.Fields.ShippingPrice) { writer.WriteField(offer.ShippingPrice.ToString("F2")); } if (item == ProductFields.Fields.Discount) { writer.WriteField(product.Discount.ToString("F2")); } if (item == ProductFields.Fields.Weight) { writer.WriteField(product.Weight.ToString("F2")); } if (item == ProductFields.Fields.Size) { writer.WriteField(product.Size.Replace("|", " x ")); } if (item == ProductFields.Fields.BriefDescription) { writer.WriteField(product.BriefDescription); } if (item == ProductFields.Fields.Description) { writer.WriteField(product.Description); } if (item == ProductFields.Fields.Title) { writer.WriteField(meta.Title); } if (item == ProductFields.Fields.MetaKeywords) { writer.WriteField(meta.MetaKeywords); } if (item == ProductFields.Fields.MetaDescription) { writer.WriteField(meta.MetaDescription); } if (item == ProductFields.Fields.Markers) { writer.WriteField(MarkersToString(product)); } if (item == ProductFields.Fields.Photos) { writer.WriteField(PhotoToString(product.ProductPhotos)); } if (item == ProductFields.Fields.Properties) { writer.WriteField(PropertiesToString(product.ProductPropertyValues)); } //Changed by Evgeni if (item == ProductFields.Fields.EAN) { writer.WriteField(product.EAN); } if (item == ProductFields.Fields.SubBrandId) { writer.WriteField(product.SubBrandId); } // if (item == ProductFields.Fields.Producer) { var brand = BrandService.GetBrandById(product.BrandId); writer.WriteField(brand != null ? brand.Name : string.Empty); } if (item == ProductFields.Fields.OrderByRequest) { writer.WriteField(product.OrderByRequest ? "+" : "-"); } } writer.NextRecord(); ExportStatistic.RowPosition++; } } }