protected void btnUpload_Click(object sender, EventArgs e) { if (!fuIcon.HasFile) { return; } if (!FileHelpers.CheckFileExtension(fuIcon.FileName, FileHelpers.eAdvantShopFileTypes.Image)) { OnErr(new ErrorEventArgs { Message = Resource.Admin_ErrorMessage_WrongImageExtension }); return; } PhotoService.DeletePhotos(PaymentMethodID, PhotoType.Payment); var tempName = PhotoService.AddPhoto(new Photo(0, PaymentMethodID, PhotoType.Payment) { OriginName = fuIcon.FileName }); if (string.IsNullOrWhiteSpace(tempName)) { return; } using (System.Drawing.Image image = System.Drawing.Image.FromStream(fuIcon.FileContent)) { FileHelpers.SaveResizePhotoFile(FoldersHelper.GetPathAbsolut(FolderType.PaymentLogo, tempName), SettingsPictureSize.PaymentIconWidth, SettingsPictureSize.PaymentIconHeight, image); } imgIcon.ImageUrl = FoldersHelper.GetPath(FolderType.PaymentLogo, tempName, true); imgIcon.Visible = true; }
public void DeletePhotos() { photoService.DeletePhotos(SelectedPhotos); SelectedPhotos.Clear(); IsDeleteDialogVisible = false; ReloadData(); }
public static void DeleteCarousel(int id) { SQLDataAccess.ExecuteNonQuery("[CMS].[sp_DeleteCarousel]", CommandType.StoredProcedure, new SqlParameter { ParameterName = "@CarouselID", Value = id }); PhotoService.DeletePhotos(id, PhotoType.Carousel); }
protected void btnDeleteIcon_Click(object sender, EventArgs e) { if (_mode == eCategoryMode.Edit) { PhotoService.DeletePhotos(_categoryId, PhotoType.CategoryIcon); pnlIcon.Visible = false; } }
protected void btnDeleteMiniImage_Click(object sender, EventArgs e) { if (_mode == eCategoryMode.Edit) { PhotoService.DeletePhotos(_categoryId, PhotoType.CategorySmall); pnlMiniImage.Visible = false; } }
private void SaveNews() { MsgErr(true); // Clean try { var news = new NewsItem { NewsID = NewsId, AddingDate = SQLDataHelper.GetDateTime(txtDate.Text + " " + txtTime.Text), Title = txtTitle.Text, //Picture = file, TextToPublication = FCKTextToPublication.Text, TextAnnotation = CKEditorControlAnnatation.Text, TextToEmail = string.Empty,//rbNo.Checked ? String.Empty : FCKTextToEmail.Text, NewsCategoryID = dboNewsCategory.SelectedValue.TryParseInt(), ShowOnMainPage = chkOnMainPage.Checked, UrlPath = txtStringID.Text, //MetaId = SQLDataHelper.GetInt(hfMetaId.Text), Meta = new MetaInfo { ObjId = NewsId, Title = txtHeadTitle.Text, H1 = txtH1.Text, MetaKeywords = txtMetaKeys.Text, MetaDescription = txtMetaDescription.Text, Type = MetaType.News } }; news.UrlPath = txtStringID.Text; NewsService.UpdateNews(news); if (FileUpload1.HasFile) { if (!FileHelpers.CheckFileExtension(FileUpload1.FileName, FileHelpers.eAdvantShopFileTypes.Image)) { MsgErr(Resource.Admin_ErrorMessage_WrongImageExtension); return; } PhotoService.DeletePhotos(NewsId, PhotoType.News); var tempName = PhotoService.AddPhoto(new Photo(0, NewsId, PhotoType.News) { OriginName = FileUpload1.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { using (var image = Image.FromStream(FileUpload1.FileContent)) FileHelpers.SaveResizePhotoFile(FoldersHelper.GetPathAbsolut(FolderType.News, tempName), SettingsPictureSize.NewsImageWidth, SettingsPictureSize.NewsImageHeight, image); } } } catch (Exception ex) { MsgErr(ex.Message + " SaveNews main"); Debug.LogError(ex); } }
protected void SaveBrand() { try { var brand = new Brand { BrandId = BrandId, Name = txtName.Text.Trim(), //BrandLogo = logo, Description = FCKDescription.Text, BriefDescription = FCKBriefDescription.Text, Enabled = chkEnabled.Checked, UrlPath = txtURL.Text.Trim(), SortOrder = txtSortOrder.Text.TryParseInt(), CountryId = SQLDataHelper.GetInt(ddlCountry.SelectedValue), BrandSiteUrl = txtBrandSiteUrl.Text, Meta = new MetaInfo { ObjId = BrandId, Type = MetaType.Brand, Title = txtHeadTitle.Text, H1 = txtH1.Text, MetaKeywords = txtMetaKeys.Text, MetaDescription = txtMetaDescription.Text }, }; BrandService.UpdateBrand(brand); if (!FileUpload1.HasFile) { return; } PhotoService.DeletePhotos(BrandId, PhotoType.Brand); var tempName = PhotoService.AddPhoto(new Photo(0, BrandId, PhotoType.Brand) { OriginName = FileUpload1.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { using (var image = Image.FromStream(FileUpload1.FileContent)) { FileHelpers.SaveResizePhotoFile(FoldersHelper.GetPathAbsolut(FolderType.BrandLogo, tempName), SettingsPictureSize.BrandLogoWidth, SettingsPictureSize.BrandLogoHeight, image); } } } catch (Exception ex) { MsgErr(ex.Message + " SaveBrand main"); Debug.LogError(ex); } }
protected void btnUpload_Click(object sender, EventArgs e) { if (fuIcon.HasFile) { PhotoService.DeletePhotos(PaymentMethodID, PhotoType.Payment); var tempName = PhotoService.AddPhoto(new Photo(0, PaymentMethodID, PhotoType.Payment) { OriginName = fuIcon.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { using (System.Drawing.Image image = System.Drawing.Image.FromStream(fuIcon.FileContent)) { FileHelpers.SaveResizePhotoFile(FoldersHelper.GetPathAbsolut(FolderType.PaymentLogo, tempName), SettingsPictureSize.PaymentIconWidth, SettingsPictureSize.PaymentIconHeight, image); } imgIcon.ImageUrl = FoldersHelper.GetPath(FolderType.PaymentLogo, tempName, true); imgIcon.Visible = true; } } }
public static void DeleteShippingMethod(int shippingId) { PhotoService.DeletePhotos(shippingId, PhotoType.Shipping); SQLDataAccess.ExecuteNonQuery("DELETE FROM [Order].[ShippingMethod] WHERE ShippingMethodID = @shippingId", CommandType.Text, new SqlParameter("@shippingId", shippingId)); }
protected void btnDeleteIcon_Click(object sender, EventArgs e) { PhotoService.DeletePhotos(PaymentMethodID, PhotoType.Payment); imgIcon.Visible = false; btnDeleteIcon.Visible = false; }
private void SaveMenuItem() { if (_mode == eMenuMode.Err) { return; } if (!ValidateData()) { return; } var url = string.Empty; if (txtUrl.Text.Contains("www.")) { url = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text; } else { url = txtUrl.Text; } lblError.Text = String.Empty; var mItem = new AdvMenuItem { MenuItemID = _menuItemId, MenuItemName = txtName.Text, MenuItemParentID = string.IsNullOrEmpty(hParent.Value) ? 0 : Convert.ToInt32(hParent.Value), MenuItemUrlPath = url, SortOrder = Convert.ToInt32(txtSortOrder.Text), Blank = ckbBlank.Checked, Enabled = ckbEnabled.Checked, MenuItemUrlType = (EMenuItemUrlType)Convert.ToInt32(rblLinkType.SelectedValue), ShowMode = (EMenuItemShowMode)Convert.ToInt32(ddlShowMode.SelectedValue), NoFollow = ckbNofollow.Checked }; if (IconFileUpload.HasFile) { PhotoService.DeletePhotos(_menuItemId, PhotoType.MenuIcon); using (IconFileUpload.FileContent) { var tempName = PhotoService.AddPhoto(new Photo(0, _menuItemId, PhotoType.MenuIcon) { OriginName = IconFileUpload.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { IconFileUpload.SaveAs(FoldersHelper.GetPathAbsolut(FolderType.MenuIcons, tempName)); } mItem.MenuItemIcon = tempName; } } else { mItem.MenuItemIcon = pnlIcon.Visible ? imgIcon.ToolTip : null; } MenuService.UpdateMenuItem(mItem, _type); if (_type == MenuService.EMenuType.Top) { CacheManager.RemoveByPattern(CacheNames.GetMainMenuCacheObjectName()); CacheManager.RemoveByPattern(CacheNames.GetMainMenuAuthCacheObjectName()); } else if (_type == MenuService.EMenuType.Bottom) { var cacheName = CacheNames.GetBottomMenuCacheObjectName(); if (CacheManager.Contains(cacheName)) { CacheManager.Remove(cacheName); } var cacheAuthName = CacheNames.GetBottomMenuAuthCacheObjectName(); if (CacheManager.Contains(cacheAuthName)) { CacheManager.Remove(cacheAuthName); } } }
public static void DeletePaymentMethod(int paymentMethodId) { PhotoService.DeletePhotos(paymentMethodId, PhotoType.Payment); SQLDataAccess.ExecuteNonQuery("DELETE FROM [Order].[PaymentMethod] WHERE [PaymentMethodID] = @PaymentMethodID", CommandType.Text, new SqlParameter("@PaymentMethodID", paymentMethodId)); }
public static void DeleteNewsImage(int newsId) { PhotoService.DeletePhotos(newsId, PhotoType.News); }
protected void btnDeleteIcon_Click(object sender, EventArgs e) { PhotoService.DeletePhotos(ShippingMethodId, PhotoType.Shipping); imgIcon.Visible = false; btnDeleteIcon.Visible = false; }
protected void SaveCategory() { if (_mode == eCategoryMode.Err) { return; } int categoryID = _categoryId; lblError.Text = string.Empty; string synonym = txtSynonym.Text.Trim(); if (String.IsNullOrEmpty(synonym)) { MsgErr(Resource.Admin_m_Category_NoSynonym); return; } string oldSynonym = UrlService.GetObjUrlFromDb(ParamType.Category, categoryID); if (oldSynonym != synonym) { var reg = new Regex("^[a-zA-Z0-9_-]*$"); if (!reg.IsMatch(synonym)) { MsgErr(Resource.Admin_m_Category_SynonymInfo); return; } if (!UrlService.IsAvailableUrl(categoryID, ParamType.Category, synonym)) { MsgErr(Resource.Admin_SynonymExist); return; } } var c = new Category { CategoryId = categoryID, Name = txtName.Text, ParentCategoryId = tree.SelectedValue.TryParseInt(), Description = fckDescription.Text == "<br />" || fckDescription.Text == " " || fckDescription.Text == "\r\n" ? string.Empty : fckDescription.Text, BriefDescription = fckBriefDescription.Text == "<br />" || fckBriefDescription.Text == " " || fckBriefDescription.Text == "\r\n" ? string.Empty : fckBriefDescription.Text, Enabled = ChkEnableCategory.Checked, DisplayStyle = SubCategoryDisplayStyle.SelectedValue, DisplayChildProducts = false, //ChkDisplayChildProducts.Checked, DisplayBrandsInMenu = ChkDisplayBrands.Checked, DisplaySubCategoriesInMenu = ChkDisplaySubCategories.Checked, UrlPath = synonym, SortOrder = txtSortIndex.Text.TryParseInt(), Sorting = (ESortOrder)ddlSorting.SelectedValue.TryParseInt() }; FileHelpers.UpdateDirectories(); if (PictureFileUpload.HasFile) { if (!FileHelpers.CheckFileExtension(PictureFileUpload.FileName, FileHelpers.eAdvantShopFileTypes.Image)) { MsgErr(Resource.Admin_ErrorMessage_WrongImageExtension); return; } PhotoService.DeletePhotos(_categoryId, PhotoType.CategoryBig); var tempName = PhotoService.AddPhoto(new Photo(0, categoryID, PhotoType.CategoryBig) { OriginName = PictureFileUpload.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { using (Image image = Image.FromStream(PictureFileUpload.FileContent)) FileHelpers.SaveResizePhotoFile(FoldersHelper.GetImageCategoryPathAbsolut(CategoryImageType.Big, tempName), SettingsPictureSize.BigCategoryImageWidth, SettingsPictureSize.BigCategoryImageHeight, image); } } if (MiniPictureFileUpload.HasFile) { if (!FileHelpers.CheckFileExtension(MiniPictureFileUpload.FileName, FileHelpers.eAdvantShopFileTypes.Image)) { MsgErr(Resource.Admin_ErrorMessage_WrongImageExtension); return; } PhotoService.DeletePhotos(_categoryId, PhotoType.CategorySmall); var tempName = PhotoService.AddPhoto(new Photo(0, categoryID, PhotoType.CategorySmall) { OriginName = MiniPictureFileUpload.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { using (Image image = Image.FromStream(MiniPictureFileUpload.FileContent)) FileHelpers.SaveResizePhotoFile(FoldersHelper.GetImageCategoryPathAbsolut(CategoryImageType.Small, tempName), SettingsPictureSize.SmallCategoryImageWidth, SettingsPictureSize.SmallCategoryImageHeight, image); } } if (IconFileUpload.HasFile) { if (!FileHelpers.CheckFileExtension(IconFileUpload.FileName, FileHelpers.eAdvantShopFileTypes.Image)) { MsgErr(Resource.Admin_ErrorMessage_WrongImageExtension); return; } PhotoService.DeletePhotos(_categoryId, PhotoType.CategoryIcon); var tempName = PhotoService.AddPhoto(new Photo(0, categoryID, PhotoType.CategoryIcon) { OriginName = IconFileUpload.FileName }); if (!string.IsNullOrWhiteSpace(tempName)) { using (Image image = Image.FromStream(IconFileUpload.FileContent)) FileHelpers.SaveResizePhotoFile(FoldersHelper.GetImageCategoryPathAbsolut(CategoryImageType.Icon, tempName), SettingsPictureSize.IconCategoryImageWidth, SettingsPictureSize.IconCategoryImageHeight, image); } } c.Meta = new MetaInfo(0, c.CategoryId, MetaType.Category, txtTitle.Text, txtMetaKeywords.Text, txtMetaDescription.Text, txtH1.Text); var isParentCategoryChanged = CategoryService.GetCategory(_categoryId).ParentCategoryId != c.ParentCategoryId; if (!CategoryService.UpdateCategory(c, true)) { MsgErr("Failed to save category"); } if (isParentCategoryChanged) { CategoryService.RecalculateProductsCountManual(); CategoryService.ClearCategoryCache(); } }