示例#1
0
        public bool Add(Promotion promo)
        {
            DateTime StartDate = validate.ValidateDateTime(promo.StartDate);
            DateTime EndDate   = validate.ValidateDateTime(promo.EndDate);

            try
            {
                SqlParameter[] parameter =
                {
                    new SqlParameter("@PromotionName",    promo.Name),
                    new SqlParameter("@PromotionDetails", promo.Details),
                    new SqlParameter("@BrandId",          promo.BrandId),
                    new SqlParameter("@ShopId",           promo.ShopId),
                    new SqlParameter("@StartDate",        StartDate),
                    new SqlParameter("@EndDate",          EndDate),
                    new SqlParameter("@Promocode",        promo.PromoCode),
                    new SqlParameter("@isShop",           promo.isShop),
                    new SqlParameter("@isBrand",          promo.isBrand)
                };
                return(_db.ExecuteNonQuery(SpConstants.SP_ADD_PROMOTION, parameter));
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
示例#2
0
 public bool Add(Brand brand)
 {
     try
     {
         SqlParameter[] parameters =
         {
             new SqlParameter("@Name",       brand.Id),
             new SqlParameter("@ShopNumber", brand.ShopNumbers),
             new SqlParameter("@Owner",      brand.ownername),
             new SqlParameter("@ImagePath",  brand.logopath)
         };
         return(_db.ExecuteNonQuery(SpConstants.SP_ADD_BRAND, parameters));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#3
0
 public bool Add(Product product)
 {
     try
     {
         SqlParameter[] parameter =
         {
             new SqlParameter("@ShopId",       product.ShopId),
             new SqlParameter("@BrandId",      product.BrandId),
             new SqlParameter("@ProductName",  product.ProductName),
             new SqlParameter("@ProductColor", product.ProductColor),
             new SqlParameter("@ImagePath",    product.ProductImage)
         };
         return(_db.ExecuteNonQuery(SpConstants.SP_ADD_NEW_PRODUCT, parameter));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#4
0
 public bool AddShop(Shop shop)
 {
     try
     {
         SqlParameter[] dbParameter =
         {
             new SqlParameter("@shopname",  shop.ShopName),
             new SqlParameter("@ownername", shop.OwnerName),
             new SqlParameter("@longitude", shop.Longitude),
             new SqlParameter("@latitude",  shop.Latitude),
             new SqlParameter("@imagepath", shop.Imagepath)
         };
         isCreated = db.ExecuteNonQuery(SpConstants.SP_ADD_NEW_SHOP, dbParameter);
         return(isCreated);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#5
0
        public bool AddEvent(Event _event)
        {
            DateTime dateTime = validate.ValidateDateTime(_event.DateTime);

            try
            {
                SqlParameter[] parameter =
                {
                    new SqlParameter("@shopid",       _event.ShopId),
                    new SqlParameter("@brandid",      _event.BrandId),
                    new SqlParameter("@eventname",    _event.Name),
                    new SqlParameter("@eventdetails", _event.Details),
                    new SqlParameter("@eventdate",    dateTime)
                };
                return(db.ExecuteNonQuery(SpConstants.SP_ADD_EVENT, parameter));
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public int ExecuteNonQuery(string query)
        {
            var retValue = -1;

            try
            {
                retValue = _iDBhelper.ExecuteNonQuery(query);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retValue);
        }