Ejemplo n.º 1
0
        public int ChangeCategory(string[] categoryName)
        {
            try
            {
                StoreInforBusiness sib = new StoreInforBusiness();
                for (int i = 0; i < categoryName.Length; i++)
                {
                    if ((i + 1) != categoryName.Length)
                    {
                        if (StringComparer.CurrentCultureIgnoreCase.Equals(categoryName[i], categoryName[i + 1]))
                        {
                            return -2;
                        }
                    }

                    if (i > 0)
                    {
                        if (StringComparer.CurrentCultureIgnoreCase.Equals(categoryName[i], categoryName[i - 1]))
                        {
                            return -2;
                        }
                    }
                }

                sib.changeCategory(categoryName);
                return 1;
            }
            catch
            {
                return -1;
            }
        }
Ejemplo n.º 2
0
 public int changeDiscountQuantity(int[] quantityFrom, int[] quantityTo, int[] discountRate, string beUsing)
 {
     try
     {
         StoreInforBusiness sib = new StoreInforBusiness();
         bool boolUsing = false;
         if (beUsing == "1")
         {
             boolUsing = true;
         }
         sib.changeDiscountQuantity(quantityFrom, quantityTo, discountRate, boolUsing);
         return 1;
     }
     catch
     {
         return -1;
     }
 }
Ejemplo n.º 3
0
        public int AddCategory(string categoryName)
        {
            try
            {
                StoreInforBusiness sib = new StoreInforBusiness();
                var categoryList = db.Categories.ToList();
                for (int i = 0; i < categoryList.Count; i++)
                {
                    if (StringComparer.CurrentCultureIgnoreCase.Equals(categoryName, categoryList[i].CategoryName))
                    {
                        return -2;
                    }
                }

                sib.addCategory(categoryName);
                return 1;
            }
            catch
            {
                return -1;
            }
        }
Ejemplo n.º 4
0
 public int MinQuantity(int bound)
 {
     StoreInforBusiness sib = new StoreInforBusiness();
     try
     {
         sib.MinQuantity(bound);
         return 1;
     }
     catch
     {
         return -1;
     }
 }
Ejemplo n.º 5
0
 public int EditStoreInfoConfirm(string storeName, string ownerName, string Email, string address, string Province, string District, string phoneNumber, string Fax, string taxCode, string fileName)
 {
     try
     {
         StoreInforBusiness sib = new StoreInforBusiness();
         sib.EditStoreInfo(storeName, ownerName, Email, address, Province, District, phoneNumber, Fax, taxCode, fileName);
         return 2;
     }
     catch
     {
         return -4;
     }
 }
Ejemplo n.º 6
0
        public int DeleteCategory(int categoryId)
        {
            try
            {
                StoreInforBusiness sib = new StoreInforBusiness();
                List<Product> lstProduct = db.Products.ToList();
                for (int i = 0; i < lstProduct.Count; i++)
                {
                    if (lstProduct[i].CategoryId == categoryId)
                    {
                        return -1;
                    }
                }

                sib.deleteCategory(categoryId);
                return 1;
            }
            catch
            {
                return -2;
            }
        }
Ejemplo n.º 7
0
        public int changeMaxPrice(int maxPrice)
        {
            try
            {
                StoreInforBusiness sib = new StoreInforBusiness();
                var nowMaxPriceProduct = db.Products.OrderByDescending(i => i.ProductStandardPrice).Select(n => n.ProductStandardPrice).FirstOrDefault();
                if (maxPrice < nowMaxPriceProduct)
                {
                    return -1;
                }

                maxPrice = Convert.ToInt32(maxPrice.ToString().Replace(".", ""));
                sib.changeMaxPrice(maxPrice);
                return 1;
            }
            catch
            {
                return -2;
            }
        }