public static bool AddBrandCategory(BrandCategoryInfo brandCategory) { int brandId = ProductProvider.Instance().AddBrandCategory(brandCategory); if (brandId <= 0) { return false; } if (brandCategory.ProductTypes.Count > 0) { ProductProvider.Instance().AddBrandProductTypes(brandId, brandCategory.ProductTypes); } return true; }
public static bool AddBrandCategory(BrandCategoryInfo brandCategory) { int brandId = new BrandCategoryDao().AddBrandCategory(brandCategory); if (brandId <= 0) { return false; } if (brandCategory.ProductTypes.Count > 0) { new BrandCategoryDao().AddBrandProductTypes(brandId, brandCategory.ProductTypes); } return true; }
public override BrandCategoryInfo GetBrandCategory(int brandId) { BrandCategoryInfo info = new BrandCategoryInfo(); DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_BrandCategories WHERE BrandId = @BrandId "); this.database.AddInParameter(sqlStringCommand, "BrandId", DbType.Int32, brandId); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulateBrandCategory(reader); } } return info; }
public int AddBrandCategory(BrandCategoryInfo brandCategory) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("DECLARE @DisplaySequence AS INT SELECT @DisplaySequence = (CASE WHEN MAX(DisplaySequence) IS NULL THEN 1 ELSE MAX(DisplaySequence) + 1 END) FROM Hishop_BrandCategories;INSERT INTO Hishop_BrandCategories(BrandName, Logo, CompanyUrl,RewriteName,MetaKeywords,MetaDescription, Description, DisplaySequence) VALUES(@BrandName, @Logo, @CompanyUrl,@RewriteName,@MetaKeywords,@MetaDescription, @Description, @DisplaySequence); SELECT @@IDENTITY"); this.database.AddInParameter(sqlStringCommand, "BrandName", DbType.String, brandCategory.BrandName); this.database.AddInParameter(sqlStringCommand, "Logo", DbType.String, brandCategory.Logo); this.database.AddInParameter(sqlStringCommand, "CompanyUrl", DbType.String, brandCategory.CompanyUrl); this.database.AddInParameter(sqlStringCommand, "RewriteName", DbType.String, brandCategory.RewriteName); this.database.AddInParameter(sqlStringCommand, "MetaKeywords", DbType.String, brandCategory.MetaKeywords); this.database.AddInParameter(sqlStringCommand, "MetaDescription", DbType.String, brandCategory.MetaDescription); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, brandCategory.Description); object obj2 = this.database.ExecuteScalar(sqlStringCommand); if (obj2 != null) { return Convert.ToInt32(obj2); } return 0; }
public static BrandCategoryInfo PopulateBrandCategory(IDataRecord reader) { if (null == reader) { return null; } BrandCategoryInfo info = new BrandCategoryInfo(); info.BrandId = (int) reader["BrandId"]; info.BrandName = (string) reader["BrandName"]; if (reader["DisplaySequence"] != DBNull.Value) { info.DisplaySequence = (int) reader["DisplaySequence"]; } if (reader["Logo"] != DBNull.Value) { info.Logo = (string) reader["Logo"]; } if (reader["CompanyUrl"] != DBNull.Value) { info.CompanyUrl = (string) reader["CompanyUrl"]; } if (reader["RewriteName"] != DBNull.Value) { info.RewriteName = (string) reader["RewriteName"]; } if (reader["MetaKeywords"] != DBNull.Value) { info.MetaKeywords = (string) reader["MetaKeywords"]; } if (reader["MetaDescription"] != DBNull.Value) { info.MetaDescription = (string) reader["MetaDescription"]; } if (reader["Description"] != DBNull.Value) { info.Description = (string) reader["Description"]; } if (reader["Theme"] != DBNull.Value) { info.Theme = (string) reader["Theme"]; } return info; }
public bool UpdateBrandCategory(BrandCategoryInfo brandCategory) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Hishop_BrandCategories SET BrandName = @BrandName, Logo = @Logo, CompanyUrl = @CompanyUrl,RewriteName=@RewriteName,MetaKeywords=@MetaKeywords,MetaDescription=@MetaDescription, Description = @Description WHERE BrandId = @BrandId"); this.database.AddInParameter(sqlStringCommand, "BrandId", DbType.Int32, brandCategory.BrandId); this.database.AddInParameter(sqlStringCommand, "BrandName", DbType.String, brandCategory.BrandName); this.database.AddInParameter(sqlStringCommand, "Logo", DbType.String, brandCategory.Logo); this.database.AddInParameter(sqlStringCommand, "CompanyUrl", DbType.String, brandCategory.CompanyUrl); this.database.AddInParameter(sqlStringCommand, "RewriteName", DbType.String, brandCategory.RewriteName); this.database.AddInParameter(sqlStringCommand, "MetaKeywords", DbType.String, brandCategory.MetaKeywords); this.database.AddInParameter(sqlStringCommand, "MetaDescription", DbType.String, brandCategory.MetaDescription); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, brandCategory.Description); return (this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public BrandCategoryInfo GetBrandCategory(int brandId) { BrandCategoryInfo info = new BrandCategoryInfo(); DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_BrandCategories WHERE BrandId = @BrandId;SELECT * FROM Hishop_ProductTypeBrands WHERE BrandId = @BrandId"); this.database.AddInParameter(sqlStringCommand, "BrandId", DbType.Int32, brandId); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { info = ReaderConvert.ReaderToModel<BrandCategoryInfo>(reader); IList<int> list = new List<int>(); reader.NextResult(); while (reader.Read()) { list.Add((int) reader["ProductTypeId"]); } info.ProductTypes = list; } return info; }
public static bool UpdateBrandCategory(BrandCategoryInfo brandCategory) { bool flag = ProductProvider.Instance().UpdateBrandCategory(brandCategory); if (flag && ProductProvider.Instance().DeleteBrandProductTypes(brandCategory.BrandId)) { ProductProvider.Instance().AddBrandProductTypes(brandCategory.BrandId, brandCategory.ProductTypes); } return flag; }
void LoadCategoryHead(BrandCategoryInfo brandcategory) { if (!string.IsNullOrEmpty(brandcategory.MetaKeywords)) { MetaTags.AddMetaKeywords(brandcategory.MetaKeywords, HiContext.Current.Context); } if (!string.IsNullOrEmpty(brandcategory.MetaKeywords)) { MetaTags.AddMetaDescription(brandcategory.MetaDescription, HiContext.Current.Context); } if (!string.IsNullOrEmpty(brandcategory.BrandName)) { PageTitle.AddTitle(brandcategory.BrandName, HiContext.Current.Context); } }
public static bool UpdateBrandCategory(BrandCategoryInfo brandCategory) { bool flag = new BrandCategoryDao().UpdateBrandCategory(brandCategory); if (flag && new BrandCategoryDao().DeleteBrandProductTypes(brandCategory.BrandId)) { new BrandCategoryDao().AddBrandProductTypes(brandCategory.BrandId, brandCategory.ProductTypes); } return flag; }
private bool ValidationBrandCategory(BrandCategoryInfo brandCategory) { ValidationResults results = Hishop.Components.Validation.Validation.Validate<BrandCategoryInfo>(brandCategory, new string[] { "ValBrandCategory" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable<ValidationResult>) results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } return results.IsValid; }
private BrandCategoryInfo GetBrandCategoryInfo() { BrandCategoryInfo info = new BrandCategoryInfo { BrandId = this.brandId }; if (this.ViewState["Logo"] != null) { info.Logo = (string) this.ViewState["Logo"]; } info.BrandName = Globals.HtmlEncode(this.txtBrandName.Text.Trim()); if (!string.IsNullOrEmpty(this.txtCompanyUrl.Text)) { info.CompanyUrl = this.txtCompanyUrl.Text.Trim(); } else { info.CompanyUrl = null; } info.RewriteName = Globals.HtmlEncode(this.txtReUrl.Text.Trim()); info.MetaKeywords = Globals.HtmlEncode(this.txtkeyword.Text.Trim()); info.MetaDescription = Globals.HtmlEncode(this.txtMetaDescription.Text.Trim()); info.Description = (!string.IsNullOrEmpty(this.fckDescription.Text) && (this.fckDescription.Text.Length > 0)) ? this.fckDescription.Text : null; IList<int> list = new List<int>(); foreach (ListItem item in this.chlistProductTypes.Items) { if (item.Selected) { list.Add(int.Parse(item.Value)); } } info.ProductTypes = list; return info; }
public abstract int AddBrandCategory(BrandCategoryInfo brandCategory);
public abstract bool UpdateBrandCategory(BrandCategoryInfo brandCategory);
BrandCategoryInfo GetBrandCategoryInfo() { BrandCategoryInfo info2 = new BrandCategoryInfo(); info2.BrandName = Globals.HtmlEncode(txtBrandName.Text.Trim()); BrandCategoryInfo info = info2; if (!string.IsNullOrEmpty(txtCompanyUrl.Text)) { info.CompanyUrl = txtCompanyUrl.Text.Trim(); } else { info.CompanyUrl = null; } info.RewriteName = Globals.HtmlEncode(txtReUrl.Text.Trim()); info.MetaKeywords = Globals.HtmlEncode(txtkeyword.Text.Trim()); info.MetaDescription = Globals.HtmlEncode(txtMetaDescription.Text.Trim()); IList<int> list = new List<int>(); foreach (ListItem item in chlistProductTypes.Items) { if (item.Selected) { list.Add(int.Parse(item.Value)); } } info.ProductTypes = list; info.Description = (!string.IsNullOrEmpty(fckDescription.Text) && (fckDescription.Text.Length > 0)) ? fckDescription.Text : null; return info; }