public List <ProductionVModel> GetProduction()
        {
            List <Production> prodList = new List <Production>();

            using (MySqlConnection con = new MySqlConnection(connString))
            {
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandText = "GetWeeklyProduction";
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                Production product = new Production();
                                product.Date         = (DateTime)reader["Date"];
                                product.ProductName  = reader["ProductName"].ToString();
                                product.Quantity     = (int)reader["Quantity"];
                                product.ProductionId = (int)reader["ProductionId"];
                                prodList.Add(product);
                            }
                            reader.NextResult();
                        }
                    }
                }
            }
            List <ProductionVModel> viewList = new List <ProductionVModel>();

            if (prodList.Count > 0)
            {
                List <Product> list = new ProductDAL().GetProductList();
                foreach (var product in list)
                {
                    if (product.Show == "True")
                    {
                        ProductionVModel model = new ProductionVModel();
                        model.ProductName = product.ProductName;
                        model.Quantity    = 0;
                        foreach (var production in prodList)
                        {
                            if (model.ProductName == production.ProductName)
                            {
                                model.Quantity = model.Quantity + production.Quantity;
                            }
                        }
                        viewList.Add(model);
                    }
                }
            }
            else
            {
                return(viewList);
            }

            return(viewList);
        }
        public List <ProductionVModel> GetWeeklyProduction()
        {
            List <Production> prodList = new List <Production>();

            using (MySqlConnection con = new MySqlConnection(connString))
            {
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandText = "GetWeeklyProduction";
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                Production product = new Production();
                                product.Date         = (DateTime)reader["Date"];
                                product.ProductName  = reader["ProductName"].ToString();
                                product.Quantity     = (int)reader["Quantity"];
                                product.ProductionId = (int)reader["ProductionId"];
                                prodList.Add(product);
                            }
                            reader.NextResult();
                        }
                    }
                }
            }
            List <ProductionVModel> viewList = new List <ProductionVModel>();

            if (prodList.Count > 0)
            {
                List <Product> list = new ProductDAL().GetProductList();

                foreach (var production in prodList)
                {
                    Product          product = list.Where(p => p.ProductName == production.ProductName).FirstOrDefault();
                    ProductionVModel model   = new ProductionVModel();
                    model.ProductName = product.ProductName;
                    model.Quantity    = production.Quantity;
                    model.Date        = production.Date;
                    model.ImagePath   = product.ImagePath;
                    model.ProductId   = product.ProductID;
                    model.Category    = product.Category;
                    model.Id          = production.ProductionId;

                    if (model.Quantity > 0)
                    {
                        viewList.Add(model);
                    }
                }
            }
            else
            {
                return(viewList);
            }

            return(viewList);
        }