Beispiel #1
0
        public ActionResult sortie()
        {
            ESModel model = produitBusiness.getProduitsAndAtelierStock();

            model.utilisateur = GetChefFromCookie();

            return(View(model));
        }
Beispiel #2
0
        /// <summary>
        /// 返回单条(by id)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="indexName"></param>
        /// <param name="typeName"></param>
        /// <param name="mustDic"></param>
        /// <returns></returns>
        public ESModel <T> Find(string indexName, string typeName, string id)
        {
            var request  = new GetRequest <T>(indexName, typeName, id);
            var result   = new ESModel <T>();
            var response = _es.Get <T>(request);

            if (response.IsValid)
            {
                result.UniqueId  = response.Id;
                result.IndexName = response.Index;
                result.TypeName  = response.Type;
                result.Data      = response.Source;
            }
            return(result);
        }
Beispiel #3
0
        public ESModel getProduitsAndStock()
        {
            using (IDbConnection connection = ConnectionHandler.Instance.getConnection())
            {
                ESModel model = new ESModel();
                String  query = $"SELECT * FROM `produit` ORDER BY id ";
                model.ProduitList = connection.Query <Produit>(query).ToList();

                query           = $"SELECT * FROM `stock` Order by idProduit; ";
                model.stockList = connection.Query <Stock>(query).ToList();

                query            = $"SELECT DISTINCT groupProduit FROM `produit`  Order by id ";
                model.groups     = connection.Query <String>(query).ToList();
                query            = $"SELECT DISTINCT categorie FROM `produit`  Order by id ";
                model.categories = connection.Query <String>(query).ToList();
                return(model);
            }
        }
Beispiel #4
0
        public ESModel getProduitsAndAtelierStock()
        {
            using (IDbConnection connection = ConnectionHandler.Instance.getConnection())
            {
                ESModel model = new ESModel();
                model.stockList  = new List <Stock>();
                model.categories = new List <String>();
                List <ES> esList = new List <ES>();
                String    query  = $"SELECT * FROM `produit` ORDER BY id ";
                model.ProduitList = connection.Query <Produit>(query).ToList();
                query             = $"SELECT * FROM `es`  ";
                esList            = connection.Query <ES>(query).ToList();
                foreach (Produit item in model.ProduitList)
                {
                    Stock stock = new Stock();
                    stock.qteEstimee = 0;
                    foreach (ES es in esList)
                    {
                        if (es.idProduit == item.id)
                        {
                            if (es.type == 'S')
                            {
                                stock.qteEstimee = stock.qteEstimee - es.qte;
                            }
                            if (es.type == 'E')
                            {
                                stock.qteEstimee = stock.qteEstimee + es.qte;
                            }
                        }
                    }
                    model.stockList.Add(stock);
                }
                query            = $"SELECT DISTINCT groupProduit FROM `produit`  Order by id ";
                model.groups     = connection.Query <String>(query).ToList();
                query            = $"SELECT DISTINCT categorie FROM `produit`  Order by id ";
                model.categories = connection.Query <String>(query).ToList();


                return(model);
            }
        }