예제 #1
0
        /// <summary>
        /// The insert.
        /// </summary>
        /// <param name="brand">
        /// The brand.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public int Insert(Product_Brand brand)
        {
            if (brand == null)
            {
                throw new ArgumentNullException("brand");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ProductCategoryID",
                                         SqlDbType.Int,
                                         brand.ProductCategoryID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ParentID",
                                         SqlDbType.Int,
                                         brand.ParentID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BrandName",
                                         SqlDbType.NVarChar,
                                         brand.BrandName,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BrandNameSpell",
                                         SqlDbType.NVarChar,
                                         brand.BrandNameSpell ?? string.Empty,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BrandNameEnglish",
                                         SqlDbType.NVarChar,
                                         brand.BrandNameEnglish ?? string.Empty,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "SEOKeywords",
                                         SqlDbType.NVarChar,
                                         brand.SEOKeywords ?? string.Empty,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "SEODescription",
                                         SqlDbType.NVarChar,
                                         brand.SEODescription ?? string.Empty,
                                         ParameterDirection.Input),
                                         this.SqlServer.CreateSqlParameter(
                                         "SEOTitle",
                                         SqlDbType.NVarChar,
                                         brand.SEOTitle,
                                         ParameterDirection.Input
                                         ),
                                     this.SqlServer.CreateSqlParameter(
                                         "IsDisplay",
                                         SqlDbType.Bit,
                                         brand.IsDisplay,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Layer",
                                         SqlDbType.Int,
                                         brand.Layer,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_Brand_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
 /// <summary>
 /// The modify brand category.
 /// </summary>
 /// <param name="brand">
 /// The brand.
 /// </param>
 public void ModifyBrandCategory(Product_Brand brand)
 {
     this.productBrandDA.Update(brand);
 }
예제 #3
0
        /// <summary>
        /// The update.
        /// </summary>
        /// <param name="brand">
        /// The brand.
        /// </param>
        public void Update(Product_Brand brand)
        {
            if (brand == null)
            {
                throw new ArgumentNullException("brand");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ID",
                                         SqlDbType.Int,
                                         brand.ID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ProductCategoryID",
                                         SqlDbType.Int,
                                         brand.ProductCategoryID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ParentID",
                                         SqlDbType.Int,
                                         brand.ParentID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BrandName",
                                         SqlDbType.NVarChar,
                                         brand.BrandName,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BrandNameSpell",
                                         SqlDbType.NVarChar,
                                         brand.BrandNameSpell,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "BrandNameEnglish",
                                         SqlDbType.NVarChar,
                                         brand.BrandNameEnglish,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "SEOKeywords",
                                         SqlDbType.NVarChar,
                                         brand.SEOKeywords,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "IsDisplay",
                                         SqlDbType.Bit,
                                         brand.IsDisplay,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Sorting",
                                         SqlDbType.Int,
                                         brand.Sorting,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "SEOTitle",
                                         SqlDbType.NVarChar,
                                         brand.SEOTitle,
                                         ParameterDirection.Input
                                         ),
                                         this.SqlServer.CreateSqlParameter(
                                         "SEODescription",
                                         SqlDbType.NVarChar,
                                         brand.SEODescription,
                                         ParameterDirection.Input
                                         )
                                 };
            try
            {
                this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_Brand_Update", parameters, null);
            }
            catch (Exception exception)
            {
                throw new Exception("Exception - ProductBrandDA - Update", exception);
            }
        }
 /// <summary>
 /// The add product brand.
 /// </summary>
 /// <param name="brand">
 /// The brand.
 /// </param>
 /// <returns>
 /// The <see cref="int"/>.
 /// </returns>
 public int AddProductBrand(Product_Brand brand)
 {
     return this.productBrandDA.Insert(brand);
 }