//---------------CONSULTA DE VARIOS PRODUCTOS------------------

        //No esta terminado, falta
        public static List <ShowProductModel> SelectMultipleProducts(ShowProductModel showProduct)
        {
            try
            {
                using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
                {
                    showProduct.Code        = $"%{ showProduct.Code }%";
                    showProduct.Category    = $"%{ showProduct.Category }%";
                    showProduct.Subcategory = $"%{ showProduct.Subcategory }%";
                    showProduct.Description = $"%{ showProduct.Description }%";

                    var output = cnn.Query <ShowProductModel>("" +
                                                              "SELECT Id_Product, Code, B.Name as Brand, C.Name as Category, S.Name as Subcategory, Description, " +
                                                              "Quantity_Stock, Price, Lower_Price, Image, Ivi " +
                                                              "FROM Tbl_Product P INNER JOIN Tbl_Brand B ON P.Id_Brand = B.Id_Brand " +
                                                              "INNER JOIN Tbl_Subcategory S ON P.Id_Subcategory = S.Id_Subcategory " +
                                                              "INNER JOIN Tbl_Category C ON S.Id_Category = C.Id_Category " +
                                                              "WHERE Code like @Code OR Category like @Category OR Subcategory like @Subcategory OR Description like @Description", showProduct);

                    return(output.ToList());
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Example #2
0
        //---------------METODOS DE BUSQUEDA DE VARIOS PRODUCTOS------------------

        public static List <ShowProductModel> SelectMultipleProducts(string text)
        {
            try
            {
                string code        = text;
                string brand       = text;
                string category    = text;
                string subcategory = text;
                string description = text;

                string[] product = new string[] { code, brand, category, subcategory, description };

                ShowProductModel showProduct = new ShowProductModel()
                {
                    Code        = code,
                    Brand       = brand,
                    Category    = category,
                    Subcategory = subcategory,
                    Description = description
                };
                return(ProductConnection.SelectMultipleProducts(showProduct));
            }
            catch (Exception ex)
            {
                //Log4Net
                return(null);
            }
        }
Example #3
0
        private void ReduceQuantity(ShowProductModel product)
        {
            int index = GetIndexOfProduct(product.Codigo);

            if (index > -1)
            {
                listOfProductsAction[index].Agregados--;
            }
        }
Example #4
0
 private void AddToCart(ShowProductModel product)
 {
     if (product.Agregados > 0)
     {
         int index = GetIndexOfProduct(product.Codigo);
         var obj   = productsAddesToShoppingCar.Where(x => x.Codigo.Equals(product.Codigo)).FirstOrDefault();
         if (obj != null)
         {
             int index2 = GetIndexOfProductOfSale(obj.Codigo);
             productsAddesToShoppingCar[index2].Quantiy += product.Agregados;
         }
         else
         {
             float       priceAtSale = product.PrecioMostrar;
             int         qty         = product.Agregados;
             SaleProduct newProdct   = new SaleProduct(product.Codigo, product.Nombre, product.Imagen, product.Existencia,
                                                       product.Precio_compra, product.Precio_publico, product.Precio_distribuidor, product.Precio_minimo, priceAtSale, qty);
             productsAddesToShoppingCar.Add(newProdct);
         }
         listOfProductsAction[index].Existencia -= product.Agregados;
     }
     //await pageService.DisplayAlert("Not", productsAddesToShoppingCar[productsAddesToShoppingCar.Count - 1].PrecioMostrar.ToString("$0.00"),"ok");
 }