Example #1
0
 public static CategoryActionStatus AddCategory(CategoryInfo category)
 {
     if (null == category)
     {
         return CategoryActionStatus.UnknowError;
     }
     Globals.EntityCoding(category, true);
     if (SubsiteProductProvider.Instance().CreateCategory(category) > 0)
     {
         HiCache.Remove(string.Format("DataCache-SubsiteCategories{0}", HiContext.Current.User.UserId));
     }
     return CategoryActionStatus.Success;
 }
Example #2
0
 public static CategoryActionStatus AddCategory(CategoryInfo category)
 {
     if (null == category)
     {
         return CategoryActionStatus.UnknowError;
     }
     Globals.EntityCoding(category, true);
     if (ProductProvider.Instance().CreateCategory(category) > 0)
     {
         EventLogs.WriteOperationLog(Privilege.AddProductCategory, string.Format(CultureInfo.InvariantCulture, "创建了一个新的店铺分类:”{0}”", new object[] { category.Name }));
         HiCache.Remove("DataCache-Categories");
     }
     return CategoryActionStatus.Success;
 }
Example #3
0
 private void BindCategoryInfo(CategoryInfo categoryInfo)
 {
     if (categoryInfo != null)
     {
         txtCategoryName.Text = categoryInfo.Name;
         dropProductTypes.SelectedValue = categoryInfo.AssociatedProductType;
         txtRewriteName.Text = categoryInfo.RewriteName;
         txtPageKeyTitle.Text = categoryInfo.MetaTitle;
         txtPageKeyWords.Text = categoryInfo.MetaKeywords;
         txtPageDesc.Text = categoryInfo.MetaDescription;
         fckNotes1.Text = categoryInfo.Notes1;
         fckNotes2.Text = categoryInfo.Notes2;
         fckNotes3.Text = categoryInfo.Notes3;
     }
 }
Example #4
0
 private void BindCategoryInfo(CategoryInfo categoryInfo)
 {
     if (categoryInfo != null)
     {
         this.txtCategoryName.Text = categoryInfo.Name;
         this.dropProductTypes.SelectedValue = categoryInfo.AssociatedProductType;
         this.txtSKUPrefix.Text = categoryInfo.SKUPrefix;
         this.txtRewriteName.Text = categoryInfo.RewriteName;
         this.txtPageKeyTitle.Text = categoryInfo.MetaTitle;
         this.txtPageKeyWords.Text = categoryInfo.MetaKeywords;
         this.txtPageDesc.Text = categoryInfo.MetaDescription;
         this.fckNotes1.Text = categoryInfo.Notes1;
         this.fckNotes2.Text = categoryInfo.Notes2;
         this.fckNotes3.Text = categoryInfo.Notes3;
         this.imgPic.ImageUrl = categoryInfo.IconUrl;
         this.imgPic.Visible = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
         this.btnPicDelete.Visible = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
     }
 }
Example #5
0
 public static CategoryInfo ConvertDataRowToProductCategory(DataRow row)
 {
     CategoryInfo info = new CategoryInfo {
         CategoryId = (int) row["CategoryId"],
         Name = (string) row["Name"],
         DisplaySequence = (int) row["DisplaySequence"]
     };
     if (row["IconUrl"] != DBNull.Value)
     {
         info.IconUrl = (string) row["IconUrl"];
     }
     if (row["ParentCategoryId"] != DBNull.Value)
     {
         info.ParentCategoryId = new int?((int) row["ParentCategoryId"]);
     }
     info.Depth = (int) row["Depth"];
     info.Path = (string) row["Path"];
     if (row["RewriteName"] != DBNull.Value)
     {
         info.RewriteName = (string) row["RewriteName"];
     }
     info.HasChildren = (bool) row["HasChildren"];
     if (row["FirstCommission"] != DBNull.Value)
     {
         info.FirstCommission = row["FirstCommission"].ToString();
     }
     if (row["SecondCommission"] != DBNull.Value)
     {
         info.SecondCommission = row["SecondCommission"].ToString();
     }
     if (row["ThirdCommission"] != DBNull.Value)
     {
         info.ThirdCommission = row["ThirdCommission"].ToString();
     }
     return info;
 }
Example #6
0
 private CategoryInfo GetCategory()
 {
     string str = string.Empty;
     if (this.fileUpload.HasFile)
     {
         try
         {
             str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile);
         }
         catch
         {
         }
     }
     CategoryInfo target = new CategoryInfo {
         IconUrl = str,
         Name = this.txtCategoryName.Text.Trim(),
         ParentCategoryId = this.dropCategories.SelectedValue,
         SKUPrefix = this.txtSKUPrefix.Text.Trim(),
         AssociatedProductType = this.dropProductTypes.SelectedValue
     };
     if (!string.IsNullOrEmpty(this.txtRewriteName.Text.Trim()))
     {
         target.RewriteName = this.txtRewriteName.Text.Trim();
     }
     else
     {
         target.RewriteName = null;
     }
     target.MetaTitle = this.txtPageKeyTitle.Text.Trim();
     target.MetaKeywords = this.txtPageKeyWords.Text.Trim();
     target.MetaDescription = this.txtPageDesc.Text.Trim();
     target.Notes1 = this.fckNotes1.Text;
     target.Notes2 = this.fckNotes2.Text;
     target.Notes3 = this.fckNotes3.Text;
     target.DisplaySequence = 0;
     if (target.ParentCategoryId.HasValue)
     {
         CategoryInfo category = CatalogHelper.GetCategory(target.ParentCategoryId.Value);
         if ((category == null) || (category.Depth >= 5))
         {
             this.ShowMsg(string.Format("您选择的上级分类有误,商品分类最多只支持{0}级分类", 5), false);
             return null;
         }
         if (string.IsNullOrEmpty(target.Notes1))
         {
             target.Notes1 = category.Notes1;
         }
         if (string.IsNullOrEmpty(target.Notes2))
         {
             target.Notes2 = category.Notes2;
         }
         if (string.IsNullOrEmpty(target.Notes3))
         {
             target.Notes3 = category.Notes3;
         }
         if (string.IsNullOrEmpty(target.RewriteName))
         {
             target.RewriteName = category.RewriteName;
         }
     }
     if (((string.IsNullOrEmpty(this.txtfirst.Text) || string.IsNullOrEmpty(this.txtseoncdtoone.Text)) || (string.IsNullOrEmpty(this.txtthirdtoone.Text) || string.IsNullOrEmpty(this.txtsecond.Text))) || (string.IsNullOrEmpty(this.txtsecondtothree.Text) || string.IsNullOrEmpty(this.txtthird.Text)))
     {
         this.ShowMsg("分佣设置不允许为空!", false);
         return null;
     }
     target.FirstCommission = this.txtfirst.Text + "|" + this.txtseoncdtoone.Text + "|" + this.txtthirdtoone.Text;
     target.SecondCommission = this.txtsecond.Text + "|" + this.txtsecondtothree.Text;
     target.ThirdCommission = this.txtthird.Text;
     ValidationResults results = Hishop.Components.Validation.Validation.Validate<CategoryInfo>(target, new string[] { "ValCategory" });
     string msg = string.Empty;
     if (results.IsValid)
     {
         return target;
     }
     foreach (ValidationResult result in (IEnumerable<ValidationResult>) results)
     {
         msg = msg + Formatter.FormatErrorMessage(result.Message);
     }
     this.ShowMsg(msg, false);
     return null;
 }
Example #7
0
 void LoadPageSearch(CategoryInfo category)
 {
     if (!string.IsNullOrEmpty(category.MetaKeywords))
     {
         MetaTags.AddMetaKeywords(category.MetaKeywords, HiContext.Current.Context);
     }
     if (!string.IsNullOrEmpty(category.MetaDescription))
     {
         MetaTags.AddMetaDescription(category.MetaDescription, HiContext.Current.Context);
     }
     if (!string.IsNullOrEmpty(category.MetaTitle))
     {
         PageTitle.AddTitle(category.MetaTitle, HiContext.Current.Context);
     }
     else
     {
         PageTitle.AddTitle(category.Name, HiContext.Current.Context);
     }
 }
Example #8
0
 public static CategoryInfo ConvertDataRowToProductCategory(DataRow row)
 {
     CategoryInfo info = new CategoryInfo();
     info.CategoryId = (int) row["CategoryId"];
     info.Name = (string) row["Name"];
     info.DisplaySequence = (int) row["DisplaySequence"];
     if (row["Meta_Title"] != DBNull.Value)
     {
         info.MetaTitle = (string) row["Meta_Title"];
     }
     if (row["Meta_Description"] != DBNull.Value)
     {
         info.MetaDescription = (string) row["Meta_Description"];
     }
     if (row["Meta_Keywords"] != DBNull.Value)
     {
         info.MetaKeywords = (string) row["Meta_Keywords"];
     }
     if (row["Description"] != DBNull.Value)
     {
         info.Description = (string) row["Description"];
     }
     if (row["SKUPrefix"] != DBNull.Value)
     {
         info.SKUPrefix = (string) row["SKUPrefix"];
     }
     if (row["AssociatedProductType"] != DBNull.Value)
     {
         info.AssociatedProductType = new int?((int) row["AssociatedProductType"]);
     }
     if (row["Notes1"] != DBNull.Value)
     {
         info.Notes1 = (string) row["Notes1"];
     }
     if (row["Notes2"] != DBNull.Value)
     {
         info.Notes2 = (string) row["Notes2"];
     }
     if (row["Notes3"] != DBNull.Value)
     {
         info.Notes3 = (string) row["Notes3"];
     }
     if (row["Notes4"] != DBNull.Value)
     {
         info.Notes4 = (string) row["Notes4"];
     }
     if (row["Notes5"] != DBNull.Value)
     {
         info.Notes5 = (string) row["Notes5"];
     }
     if (row["ParentCategoryId"] != DBNull.Value)
     {
         info.ParentCategoryId = new int?((int) row["ParentCategoryId"]);
     }
     info.Depth = (int) row["Depth"];
     info.Path = (string) row["Path"];
     if (row["RewriteName"] != DBNull.Value)
     {
         info.RewriteName = (string) row["RewriteName"];
     }
     if (row["Theme"] != DBNull.Value)
     {
         info.Theme = (string) row["Theme"];
     }
     info.HasChildren = (bool) row["HasChildren"];
     return info;
 }
Example #9
0
 public static CategoryInfo PopulateProductCategory(IDataRecord reader)
 {
     if (null == reader)
     {
         return null;
     }
     CategoryInfo info = new CategoryInfo();
     info.CategoryId = (int) reader["CategoryId"];
     info.Name = (string) reader["Name"];
     info.DisplaySequence = (int) reader["DisplaySequence"];
     if (reader["Meta_Description"] != DBNull.Value)
     {
         info.MetaDescription = (string) reader["Meta_Description"];
     }
     if (reader["Meta_Keywords"] != DBNull.Value)
     {
         info.MetaKeywords = (string) reader["Meta_Keywords"];
     }
     if (reader["Description"] != DBNull.Value)
     {
         info.Description = (string) reader["Description"];
     }
     if (reader["Notes1"] != DBNull.Value)
     {
         info.Notes1 = (string) reader["Notes1"];
     }
     if (reader["Notes2"] != DBNull.Value)
     {
         info.Notes2 = (string) reader["Notes2"];
     }
     if (reader["Notes3"] != DBNull.Value)
     {
         info.Notes3 = (string) reader["Notes3"];
     }
     if (reader["Notes4"] != DBNull.Value)
     {
         info.Notes4 = (string) reader["Notes4"];
     }
     if (reader["Notes5"] != DBNull.Value)
     {
         info.Notes5 = (string) reader["Notes5"];
     }
     if (reader["ParentCategoryId"] != DBNull.Value)
     {
         info.ParentCategoryId = new int?((int) reader["ParentCategoryId"]);
     }
     info.Depth = (int) reader["Depth"];
     info.Path = (string) reader["Path"];
     if (reader["RewriteName"] != DBNull.Value)
     {
         info.RewriteName = (string) reader["RewriteName"];
     }
     if (reader["SKUPrefix"] != DBNull.Value)
     {
         info.SKUPrefix = (string) reader["SKUPrefix"];
     }
     if (reader["Theme"] != DBNull.Value)
     {
         info.Theme = (string) reader["Theme"];
     }
     info.HasChildren = (bool) reader["HasChildren"];
     return info;
 }
Example #10
0
 public int CreateCategory(CategoryInfo category)
 {
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("cp_Category_Create");
     this.database.AddOutParameter(storedProcCommand, "CategoryId", DbType.Int32, 4);
     this.database.AddInParameter(storedProcCommand, "Name", DbType.String, category.Name);
     this.database.AddInParameter(storedProcCommand, "SKUPrefix", DbType.String, category.SKUPrefix);
     this.database.AddInParameter(storedProcCommand, "DisplaySequence", DbType.Int32, category.DisplaySequence);
     if (!string.IsNullOrEmpty(category.IconUrl))
     {
         this.database.AddInParameter(storedProcCommand, "IconUrl", DbType.String, category.IconUrl);
     }
     if (!string.IsNullOrEmpty(category.MetaTitle))
     {
         this.database.AddInParameter(storedProcCommand, "Meta_Title", DbType.String, category.MetaTitle);
     }
     if (!string.IsNullOrEmpty(category.MetaDescription))
     {
         this.database.AddInParameter(storedProcCommand, "Meta_Description", DbType.String, category.MetaDescription);
     }
     if (!string.IsNullOrEmpty(category.MetaKeywords))
     {
         this.database.AddInParameter(storedProcCommand, "Meta_Keywords", DbType.String, category.MetaKeywords);
     }
     if (!string.IsNullOrEmpty(category.Notes1))
     {
         this.database.AddInParameter(storedProcCommand, "Notes1", DbType.String, category.Notes1);
     }
     if (!string.IsNullOrEmpty(category.Notes2))
     {
         this.database.AddInParameter(storedProcCommand, "Notes2", DbType.String, category.Notes2);
     }
     if (!string.IsNullOrEmpty(category.Notes3))
     {
         this.database.AddInParameter(storedProcCommand, "Notes3", DbType.String, category.Notes3);
     }
     if (!string.IsNullOrEmpty(category.Notes4))
     {
         this.database.AddInParameter(storedProcCommand, "Notes4", DbType.String, category.Notes4);
     }
     if (!string.IsNullOrEmpty(category.Notes5))
     {
         this.database.AddInParameter(storedProcCommand, "Notes5", DbType.String, category.Notes5);
     }
     if (category.ParentCategoryId.HasValue)
     {
         this.database.AddInParameter(storedProcCommand, "ParentCategoryId", DbType.Int32, category.ParentCategoryId.Value);
     }
     else
     {
         this.database.AddInParameter(storedProcCommand, "ParentCategoryId", DbType.Int32, 0);
     }
     if (category.AssociatedProductType.HasValue)
     {
         this.database.AddInParameter(storedProcCommand, "AssociatedProductType", DbType.Int32, category.AssociatedProductType.Value);
     }
     if (!string.IsNullOrEmpty(category.RewriteName))
     {
         this.database.AddInParameter(storedProcCommand, "RewriteName", DbType.String, category.RewriteName);
     }
     this.database.AddInParameter(storedProcCommand, "FirstCommission", DbType.String, string.Join("|", new string[] { category.FirstCommission }));
     this.database.AddInParameter(storedProcCommand, "SecondCommission", DbType.String, string.Join("|", new string[] { category.SecondCommission }));
     this.database.AddInParameter(storedProcCommand, "ThirdCommission", DbType.String, category.ThirdCommission);
     this.database.ExecuteNonQuery(storedProcCommand);
     return (int) this.database.GetParameterValue(storedProcCommand, "CategoryId");
 }
Example #11
0
 public abstract CategoryActionStatus UpdateCategory(CategoryInfo category);
Example #12
0
 public CategoryActionStatus UpdateCategory(CategoryInfo category)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_Categories SET [Name] = @Name, SKUPrefix = @SKUPrefix,AssociatedProductType = @AssociatedProductType, Meta_Title=@Meta_Title,Meta_Description = @Meta_Description, IconUrl = @IconUrl,Meta_Keywords = @Meta_Keywords, Notes1 = @Notes1, Notes2 = @Notes2, Notes3 = @Notes3,  Notes4 = @Notes4, Notes5 = @Notes5, RewriteName = @RewriteName,FirstCommission=@FirstCommission,SecondCommission=@SecondCommission,ThirdCommission=@ThirdCommission WHERE CategoryId = @CategoryId;UPDATE Hishop_Categories SET RewriteName = @RewriteName WHERE ParentCategoryId = @CategoryId");
     this.database.AddInParameter(sqlStringCommand, "CategoryId", DbType.Int32, category.CategoryId);
     this.database.AddInParameter(sqlStringCommand, "Name", DbType.String, category.Name);
     this.database.AddInParameter(sqlStringCommand, "SKUPrefix", DbType.String, category.SKUPrefix);
     this.database.AddInParameter(sqlStringCommand, "AssociatedProductType", DbType.Int32, category.AssociatedProductType);
     this.database.AddInParameter(sqlStringCommand, "Meta_Title", DbType.String, category.MetaTitle);
     this.database.AddInParameter(sqlStringCommand, "Meta_Description", DbType.String, category.MetaDescription);
     this.database.AddInParameter(sqlStringCommand, "IconUrl", DbType.String, category.IconUrl);
     this.database.AddInParameter(sqlStringCommand, "Meta_Keywords", DbType.String, category.MetaKeywords);
     this.database.AddInParameter(sqlStringCommand, "Notes1", DbType.String, category.Notes1);
     this.database.AddInParameter(sqlStringCommand, "Notes2", DbType.String, category.Notes2);
     this.database.AddInParameter(sqlStringCommand, "Notes3", DbType.String, category.Notes3);
     this.database.AddInParameter(sqlStringCommand, "Notes4", DbType.String, category.Notes4);
     this.database.AddInParameter(sqlStringCommand, "Notes5", DbType.String, category.Notes5);
     this.database.AddInParameter(sqlStringCommand, "RewriteName", DbType.String, category.RewriteName);
     this.database.AddInParameter(sqlStringCommand, "FirstCommission", DbType.String, category.FirstCommission);
     this.database.AddInParameter(sqlStringCommand, "SecondCommission", DbType.String, category.SecondCommission);
     this.database.AddInParameter(sqlStringCommand, "ThirdCommission", DbType.String, category.ThirdCommission);
     return ((this.database.ExecuteNonQuery(sqlStringCommand) >= 1) ? CategoryActionStatus.Success : CategoryActionStatus.UnknowError);
 }
Example #13
0
 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;
 }
Example #14
0
 public override int CreateCategory(CategoryInfo category)
 {
     DbCommand storedProcCommand = database.GetStoredProcCommand("cp_Category_Create");
     database.AddOutParameter(storedProcCommand, "CategoryId", DbType.Int32, 4);
     database.AddInParameter(storedProcCommand, "Name", DbType.String, category.Name);
     database.AddInParameter(storedProcCommand, "SKUPrefix", DbType.String, category.SKUPrefix);
     database.AddInParameter(storedProcCommand, "DisplaySequence", DbType.Int32, category.DisplaySequence);
     if (!string.IsNullOrEmpty(category.MetaTitle))
     {
         database.AddInParameter(storedProcCommand, "Meta_Title", DbType.String, category.MetaTitle);
     }
     if (!string.IsNullOrEmpty(category.MetaDescription))
     {
         database.AddInParameter(storedProcCommand, "Meta_Description", DbType.String, category.MetaDescription);
     }
     if (!string.IsNullOrEmpty(category.MetaKeywords))
     {
         database.AddInParameter(storedProcCommand, "Meta_Keywords", DbType.String, category.MetaKeywords);
     }
     if (!string.IsNullOrEmpty(category.Description))
     {
         database.AddInParameter(storedProcCommand, "Description", DbType.String, category.Description);
     }
     if (!string.IsNullOrEmpty(category.Notes1))
     {
         database.AddInParameter(storedProcCommand, "Notes1", DbType.String, category.Notes1);
     }
     if (!string.IsNullOrEmpty(category.Notes2))
     {
         database.AddInParameter(storedProcCommand, "Notes2", DbType.String, category.Notes2);
     }
     if (!string.IsNullOrEmpty(category.Notes3))
     {
         database.AddInParameter(storedProcCommand, "Notes3", DbType.String, category.Notes3);
     }
     if (!string.IsNullOrEmpty(category.Notes4))
     {
         database.AddInParameter(storedProcCommand, "Notes4", DbType.String, category.Notes4);
     }
     if (!string.IsNullOrEmpty(category.Notes5))
     {
         database.AddInParameter(storedProcCommand, "Notes5", DbType.String, category.Notes5);
     }
     if (category.ParentCategoryId.HasValue)
     {
         database.AddInParameter(storedProcCommand, "ParentCategoryId", DbType.Int32, category.ParentCategoryId.Value);
     }
     else
     {
         database.AddInParameter(storedProcCommand, "ParentCategoryId", DbType.Int32, 0);
     }
     if (category.AssociatedProductType.HasValue)
     {
         database.AddInParameter(storedProcCommand, "AssociatedProductType", DbType.Int32, category.AssociatedProductType.Value);
     }
     if (!string.IsNullOrEmpty(category.RewriteName))
     {
         database.AddInParameter(storedProcCommand, "RewriteName", DbType.String, category.RewriteName);
     }
     database.ExecuteNonQuery(storedProcCommand);
     return (int)database.GetParameterValue(storedProcCommand, "CategoryId");
 }
Example #15
0
 public override CategoryActionStatus UpdateCategory(CategoryInfo category)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_Categories SET [Name] = @Name, SKUPrefix = @SKUPrefix,AssociatedProductType = @AssociatedProductType, Meta_Title=@Meta_Title,Meta_Description = @Meta_Description, Meta_Keywords = @Meta_Keywords, Description = @Description, Notes1 = @Notes1, Notes2 = @Notes2, Notes3 = @Notes3,  Notes4 = @Notes4, Notes5 = @Notes5, RewriteName = @RewriteName WHERE CategoryId = @CategoryId");
     database.AddInParameter(sqlStringCommand, "CategoryId", DbType.Int32, category.CategoryId);
     database.AddInParameter(sqlStringCommand, "Name", DbType.String, category.Name);
     database.AddInParameter(sqlStringCommand, "SKUPrefix", DbType.String, category.SKUPrefix);
     database.AddInParameter(sqlStringCommand, "AssociatedProductType", DbType.Int32, category.AssociatedProductType);
     database.AddInParameter(sqlStringCommand, "Meta_Title", DbType.String, category.MetaTitle);
     database.AddInParameter(sqlStringCommand, "Meta_Description", DbType.String, category.MetaDescription);
     database.AddInParameter(sqlStringCommand, "Meta_Keywords", DbType.String, category.MetaKeywords);
     database.AddInParameter(sqlStringCommand, "Description", DbType.String, category.Description);
     database.AddInParameter(sqlStringCommand, "Notes1", DbType.String, category.Notes1);
     database.AddInParameter(sqlStringCommand, "Notes2", DbType.String, category.Notes2);
     database.AddInParameter(sqlStringCommand, "Notes3", DbType.String, category.Notes3);
     database.AddInParameter(sqlStringCommand, "Notes4", DbType.String, category.Notes4);
     database.AddInParameter(sqlStringCommand, "Notes5", DbType.String, category.Notes5);
     database.AddInParameter(sqlStringCommand, "RewriteName", DbType.String, category.RewriteName);
     return ((database.ExecuteNonQuery(sqlStringCommand) >= 1) ? CategoryActionStatus.Success : CategoryActionStatus.UnknowError);
 }
Example #16
0
        private CategoryInfo GetCategory()
        {
            CategoryInfo target = new CategoryInfo();
            target.Name = txtCategoryName.Text.Trim();
            target.ParentCategoryId = dropCategories.SelectedValue;
            target.AssociatedProductType = dropProductTypes.SelectedValue;

            if (!string.IsNullOrEmpty(txtRewriteName.Text.Trim()))
            {
                target.RewriteName = txtRewriteName.Text.Trim();
            }
            else
            {
                target.RewriteName = null;
            }

            target.MetaTitle = txtPageKeyTitle.Text.Trim();
            target.MetaKeywords = txtPageKeyWords.Text.Trim();
            target.MetaDescription = txtPageDesc.Text.Trim();
            target.Notes1 = fckNotes1.Text;
            target.Notes2 = fckNotes2.Text;
            target.Notes3 = fckNotes3.Text;
            target.DisplaySequence = 1;

            if (target.ParentCategoryId.HasValue)
            {
                CategoryInfo category = SubsiteCatalogHelper.GetCategory(target.ParentCategoryId.Value);
                if ((category == null) || (category.Depth >= 5))
                {
                    ShowMsg(string.Format("您选择的上级分类有误,店铺分类最多只支持{0}级分类", 5), false);
                    return null;
                }
                if (string.IsNullOrEmpty(target.Notes1))
                {
                    target.Notes1 = category.Notes1;
                }
                if (string.IsNullOrEmpty(target.Notes2))
                {
                    target.Notes2 = category.Notes2;
                }
                if (string.IsNullOrEmpty(target.Notes3))
                {
                    target.Notes3 = category.Notes3;
                }
                if (string.IsNullOrEmpty(target.RewriteName))
                {
                    target.RewriteName = category.RewriteName;
                }
            }
            ValidationResults results = Hishop.Components.Validation.Validation.Validate<CategoryInfo>(target, new string[] { "ValCategory" });
            string msg = string.Empty;
            if (results.IsValid)
            {
                return target;
            }
            foreach (ValidationResult result in (IEnumerable<ValidationResult>)results)
            {
                msg = msg + Formatter.FormatErrorMessage(result.Message);
            }
            ShowMsg(msg, false);
            return null;
        }
Example #17
0
 public abstract int CreateCategory(CategoryInfo category);