public static CategoryActionStatus DeleteCategory(int categoryId) { CategoryActionStatus unknowError = CategoryActionStatus.UnknowError; unknowError = SubsiteProductProvider.Instance().DeleteCategory(categoryId); if (unknowError == CategoryActionStatus.Success) { HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId)); } return(unknowError); }
public static CategoryActionStatus DeleteCategory(int categoryId) { ManagerHelper.CheckPrivilege(Privilege.DeleteProductCategory); CategoryActionStatus status = ProductProvider.Instance().DeleteCategory(categoryId); if (status == CategoryActionStatus.Success) { EventLogs.WriteOperationLog(Privilege.DeleteProductCategory, string.Format(CultureInfo.InvariantCulture, "删除了编号为 “{0}” 的店铺分类", new object[] { categoryId })); HiCache.Remove("DataCache-Categories"); } return(status); }
public static CategoryActionStatus UpdateCategory(CategoryInfo category) { if (null == category) { return(CategoryActionStatus.UnknowError); } Globals.EntityCoding(category, true); CategoryActionStatus status = ProductProvider.Instance().UpdateCategory(category); if (status == CategoryActionStatus.Success) { EventLogs.WriteOperationLog(Privilege.EditProductCategory, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的店铺分类", new object[] { category.CategoryId })); HiCache.Remove("DataCache-Categories"); } return(status); }
public static CategoryActionStatus UpdateCategory(CategoryInfo category) { if (null == category) { return(CategoryActionStatus.UnknowError); } Globals.EntityCoding(category, true); CategoryActionStatus unknowError = CategoryActionStatus.UnknowError; unknowError = SubsiteProductProvider.Instance().UpdateCategory(category); if (unknowError == CategoryActionStatus.Success) { HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId)); } return(unknowError); }
public static CategoryActionStatus UpdateCategory(CategoryInfo category) { if (category == null) { return(CategoryActionStatus.UnknowError); } Globals.EntityCoding(category, true); CategoryActionStatus categoryActionStatus = (!new CategoryDao().Update(category, null)) ? CategoryActionStatus.UnknowError : CategoryActionStatus.Success; if (categoryActionStatus == CategoryActionStatus.Success) { EventLogs.WriteOperationLog(Privilege.EditProductCategory, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的商品分类", new object[1] { category.CategoryId }), false); HiCache.Remove("DataCache-Categories"); } return(categoryActionStatus); }
public static CategoryActionStatus UpdateCategory(CategoryInfo category) { CategoryActionStatus categoryActionStatu; if (null != category) { Globals.EntityCoding(category, true); CategoryActionStatus categoryActionStatu1 = (new CategoryDao()).UpdateCategory(category); if (categoryActionStatu1 == CategoryActionStatus.Success) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] categoryId = new object[] { category.CategoryId }; EventLogs.WriteOperationLog(Privilege.EditProductCategory, string.Format(invariantCulture, "修改了编号为 “{0}” 的店铺分类", categoryId)); HiCache.Remove("DataCache-Categories"); } categoryActionStatu = categoryActionStatu1; } else { categoryActionStatu = CategoryActionStatus.UnknowError; } return(categoryActionStatu); }
private void btnSaveCategory_Click(object sender, System.EventArgs e) { if (this.categoryid > 0) { CategoryInfo category = CatalogHelper.GetCategory(this.categoryid); if (category == null) { this.ShowMsg("编缉商品分类错误,未知", false); return; } string arg_2D_0 = string.Empty; category.IconUrl = this.uploader1.UploadedImageUrl; category.Name = this.txtCategoryName.Text; category.SKUPrefix = this.txtSKUPrefix.Text; category.RewriteName = this.txtRewriteName.Text; category.MetaTitle = this.txtPageKeyTitle.Text; category.MetaKeywords = this.txtPageKeyWords.Text; category.MetaDescription = this.txtPageDesc.Text; category.AssociatedProductType = this.dropProductTypes.SelectedValue; category.DelayDays = Convert.ToInt32(this.txtDelayDays.Text); category.Notes1 = ""; category.Notes2 = ""; category.Notes3 = ""; if (category.Depth > 1) { CategoryInfo category2 = CatalogHelper.GetCategory(category.ParentCategoryId.Value); if (string.IsNullOrEmpty(category.Notes1)) { category.Notes1 = category2.Notes1; } if (string.IsNullOrEmpty(category.Notes2)) { category.Notes2 = category2.Notes2; } if (string.IsNullOrEmpty(category.Notes3)) { category.Notes3 = category2.Notes3; } } ValidationResults validationResults = Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); return; } CategoryActionStatus categoryActionStatus = CatalogHelper.UpdateCategory(category); if (categoryActionStatus == CategoryActionStatus.Success) { this.ShowMsgAndReUrl(this.operatorName + "成功", true, this.reurl); return; } if (categoryActionStatus == CategoryActionStatus.UpdateParentError) { this.ShowMsg("不能自己成为自己的上级分类", false); return; } this.ShowMsg(this.operatorName + "商品分类错误", false); return; } else { CategoryInfo category3 = this.GetCategory(); if (category3 == null) { return; } if (CatalogHelper.AddCategory(category3) == CategoryActionStatus.Success) { this.ShowMsgAndReUrl("成功" + this.operatorName + "了商品分类", true, this.reurl); return; } this.ShowMsg(this.operatorName + "失败", false); return; } }
private void btnSaveCategory_Click(object sender, EventArgs e) { CategoryInfo category = SubsiteCatalogHelper.GetCategory(categoryId); if (category == null) { ShowMsg("编缉店铺分类错误,未知", false); } else { category.AssociatedProductType = dropProductTypes.SelectedValue; category.Name = txtCategoryName.Text; category.RewriteName = txtRewriteName.Text; category.MetaTitle = txtPageKeyTitle.Text; category.MetaKeywords = txtPageKeyWords.Text; category.MetaDescription = txtPageDesc.Text; category.Notes1 = fckNotes1.Text; category.Notes2 = fckNotes2.Text; category.Notes3 = fckNotes3.Text; if (category.Depth > 1) { CategoryInfo info2 = SubsiteCatalogHelper.GetCategory(category.ParentCategoryId.Value); if (string.IsNullOrEmpty(category.Notes1)) { category.Notes1 = info2.Notes1; } if (string.IsNullOrEmpty(category.Notes2)) { category.Notes2 = info2.Notes2; } if (string.IsNullOrEmpty(category.Notes3)) { category.Notes3 = info2.Notes3; } if (string.IsNullOrEmpty(category.Notes4)) { category.Notes4 = info2.Notes4; } if (string.IsNullOrEmpty(category.Notes5)) { category.Notes5 = info2.Notes5; } } ValidationResults results = Hishop.Components.Validation.Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } ShowMsg(msg, false); } else { CategoryActionStatus status = SubsiteCatalogHelper.UpdateCategory(category); if (status == CategoryActionStatus.Success) { ShowMsg("成功修改了当前店铺分类", true); BindCategoryInfo(category); } else if (status == CategoryActionStatus.UpdateParentError) { ShowMsg("不能自己成为自己的上级分类", false); } else { ShowMsg("编缉店铺分类错误,未知", false); } } } }
private void btnSaveCategory_Click(object sender, System.EventArgs e) { CategoryInfo category = CatalogHelper.GetCategory(this.categoryId); if (category == null) { this.ShowMsg("编缉商品分类错误,未知", false); } else { string str = string.Empty; if (this.fileUpload.HasFile) { try { str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); } catch { } } category.IconUrl = str; category.Name = this.txtCategoryName.Text; category.SKUPrefix = this.txtSKUPrefix.Text; category.RewriteName = this.txtRewriteName.Text; category.MetaTitle = this.txtPageKeyTitle.Text; //category.MetaKeywords = this.txtPageKeyWords.Text; //将keywords换成了分类大图的imgUrl. //保存背景图 string backimgUrl = bannerImg.ImageUrl; if (!string.IsNullOrEmpty(bannerImgUpload.FileName) && bannerImgUpload.FileContent.Length > 0) { string fileName = category.CategoryId + Path.GetExtension(bannerImgUpload.FileName); bannerImgUpload.SaveAs(Server.MapPath("/Storage/master/topic/") + fileName); backimgUrl = ("/Storage/master/topic/" + fileName); } else if (string.IsNullOrEmpty(bannerImg.ImageUrl)) { backimgUrl = (""); } category.MetaKeywords = backimgUrl; category.MetaDescription = this.txtPageDesc.Text; category.AssociatedProductType = this.dropProductTypes.SelectedValue; category.Notes1 = this.fckNotes1.Text; category.Notes2 = this.fckNotes2.Text; category.Notes3 = this.fckNotes3.Text; if (category.Depth > 1) { CategoryInfo info2 = CatalogHelper.GetCategory(category.ParentCategoryId.Value); if (string.IsNullOrEmpty(category.Notes1)) { category.Notes1 = info2.Notes1; } if (string.IsNullOrEmpty(category.Notes2)) { category.Notes2 = info2.Notes2; } if (string.IsNullOrEmpty(category.Notes3)) { category.Notes3 = info2.Notes3; } } ValidationResults results = Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results) { msg += Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else { CategoryActionStatus categoryActionStatus = CatalogHelper.UpdateCategory(category); if (categoryActionStatus != CategoryActionStatus.Success) { if (categoryActionStatus != CategoryActionStatus.UpdateParentError) { this.ShowMsg("编缉商品分类错误,未知", false); } else { this.ShowMsg("不能自己成为自己的上级分类", false); } } else { //保存成功后清空分类缓存 HiCache.Remove("DataCache-CategoriesRange"); base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/ManageCategories.aspx"), true); } } } }
private void btnSaveCategory_Click(object sender, System.EventArgs e) { CategoryInfo category = SubsiteCatalogHelper.GetCategory(this.categoryId); if (category == null) { this.ShowMsg("编缉商品分类错误,未知", false); return; } //if (this.fileUpload.HasFile) //{ // try // { // ResourcesHelper.DeleteImage(category.Icon); // category.Icon = SubsiteCatalogHelper.UploadCategoryIcon(this.fileUpload.PostedFile); // } // catch // { // this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); // return; // } //} category.AssociatedProductType = this.dropProductTypes.SelectedValue; category.Name = this.txtCategoryName.Text; category.RewriteName = this.txtRewriteName.Text; category.MetaTitle = this.txtPageKeyTitle.Text; category.MetaKeywords = this.txtPageKeyWords.Text; category.MetaDescription = this.txtPageDesc.Text; category.Notes1 = this.fckNotes1.Text; category.Notes2 = this.fckNotes2.Text; category.Notes3 = this.fckNotes3.Text; if (category.Depth > 1) { CategoryInfo category2 = SubsiteCatalogHelper.GetCategory(category.ParentCategoryId.Value); if (string.IsNullOrEmpty(category.Notes1)) { category.Notes1 = category2.Notes1; } if (string.IsNullOrEmpty(category.Notes2)) { category.Notes2 = category2.Notes2; } if (string.IsNullOrEmpty(category.Notes3)) { category.Notes3 = category2.Notes3; } if (string.IsNullOrEmpty(category.Notes4)) { category.Notes4 = category2.Notes4; } if (string.IsNullOrEmpty(category.Notes5)) { category.Notes5 = category2.Notes5; } } ValidationResults validationResults = Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); } else { CategoryActionStatus categoryActionStatus = SubsiteCatalogHelper.UpdateCategory(category); if (categoryActionStatus == CategoryActionStatus.Success) { this.ShowMsg("成功修改了当前商品分类", true); this.BindCategoryInfo(category); return; } if (categoryActionStatus == CategoryActionStatus.UpdateParentError) { this.ShowMsg("不能自己成为自己的上级分类", false); return; } this.ShowMsg("编缉商品分类错误,未知", false); return; } }
private void btnSaveCategory_Click(object sender, System.EventArgs e) { CategoryInfo category = CatalogHelper.GetCategory(this.categoryId); if (category == null) { this.ShowMsg("编缉商品分类错误,未知", false); return; } if (this.fileUpload.HasFile) { try { ResourcesHelper.DeleteImage(category.Icon); category.IconUrl = CatalogHelper.UploadCategoryIcon(this.fileUpload.PostedFile); } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } else { category.IconUrl = category.Icon; } category.Name = this.txtCategoryName.Text; category.SKUPrefix = this.txtSKUPrefix.Text; category.RewriteName = this.txtRewriteName.Text; category.MetaTitle = this.txtPageKeyTitle.Text; category.MetaKeywords = this.txtPageKeyWords.Text; category.MetaDescription = this.txtPageDesc.Text; category.AssociatedProductType = this.dropProductTypes.SelectedValue; category.Notes1 = this.fckNotes1.Text; //category.TaxRateId = this.dropTaxRate.SelectedValue; category.CategoryType = (CategoryType)System.Enum.Parse(typeof(CategoryType), this.ddlType.SelectedValue); int isIdsadble = 0; int.TryParse(this.radioButton.SelectedValue, out isIdsadble); category.IsDisable = isIdsadble; category.Notes2 = this.fckNotes2.Text; category.Notes3 = this.fckNotes3.Text; if (category.Depth > 1) { CategoryInfo category2 = CatalogHelper.GetCategory(category.ParentCategoryId.Value); if (string.IsNullOrEmpty(category.Notes1)) { category.Notes1 = category2.Notes1; } if (string.IsNullOrEmpty(category.Notes2)) { category.Notes2 = category2.Notes2; } if (string.IsNullOrEmpty(category.Notes3)) { category.Notes3 = category2.Notes3; } } ValidationResults validationResults = Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); } else { CategoryActionStatus categoryActionStatus = CatalogHelper.UpdateCategory(category); if (categoryActionStatus == CategoryActionStatus.Success) { base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/ManageCategories.aspx"), true); return; } if (categoryActionStatus == CategoryActionStatus.UpdateParentError) { this.ShowMsg("不能自己成为自己的上级分类", false); return; } this.ShowMsg("编缉商品分类错误,未知", false); return; } }
private void btnSaveCategory_Click(object sender, System.EventArgs e) { CategoryInfo category = CatalogHelper.GetCategory(this.categoryId); if (category == null) { this.ShowMsg("编缉商品分类错误,未知", false); } else { string str = string.Empty; if (this.fileUpload.HasFile) { try { str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); } catch { } } category.IconUrl = str; category.Name = this.txtCategoryName.Text; category.SKUPrefix = this.txtSKUPrefix.Text; category.RewriteName = this.txtRewriteName.Text; category.MetaTitle = this.txtPageKeyTitle.Text; category.MetaKeywords = this.txtPageKeyWords.Text; category.MetaDescription = this.txtPageDesc.Text; category.AssociatedProductType = this.dropProductTypes.SelectedValue; category.Notes1 = this.fckNotes1.Text; category.Notes2 = this.fckNotes2.Text; category.Notes3 = this.fckNotes3.Text; if (category.Depth > 1) { CategoryInfo info2 = CatalogHelper.GetCategory(category.ParentCategoryId.Value); if (string.IsNullOrEmpty(category.Notes1)) { category.Notes1 = info2.Notes1; } if (string.IsNullOrEmpty(category.Notes2)) { category.Notes2 = info2.Notes2; } if (string.IsNullOrEmpty(category.Notes3)) { category.Notes3 = info2.Notes3; } } ValidationResults results = Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results) { msg += Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else { CategoryActionStatus categoryActionStatus = CatalogHelper.UpdateCategory(category); if (categoryActionStatus != CategoryActionStatus.Success) { if (categoryActionStatus != CategoryActionStatus.UpdateParentError) { this.ShowMsg("编缉商品分类错误,未知", false); } else { this.ShowMsg("不能自己成为自己的上级分类", false); } } else { base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/ManageCategories.aspx"), true); } } } }