Пример #1
0
        public DistributionCarteVue findById(int id)
        {
            conn = new DB().getConn();
            DistributionCarteVue dcarte = null;

            try
            {
                string query = "select * from distribution_carte_vue where id=" + id;
                cmd    = new NpgsqlCommand(query, conn);
                reader = cmd.ExecuteReader();
                if (reader.Read() == true)
                {
                    dcarte = new DistributionCarteVue(reader.GetInt32(0), reader.GetString(1),
                                                      reader.GetString(2), reader.GetInt32(3), reader.GetDateTime(4));
                }
            }
            catch (Exception e)
            {
                throw new Exception("Erreur dans DistributionCarteDao=>findBydId " + e.Message);
            }
            finally
            {
                conn.Close();
                reader.Close();
            }
            return(dcarte);
        }
Пример #2
0
        public List <DistributionCarteVue> getAll()
        {
            List <DistributionCarteVue> listAll = new List <DistributionCarteVue>();

            conn = new DB().getConn();
            try
            {
                string query = "select * from distribution_carte_vue order by id DESC";
                cmd    = new NpgsqlCommand(query, conn);
                reader = cmd.ExecuteReader();
                while (reader.Read() == true)
                {
                    DistributionCarteVue dcarte = new DistributionCarteVue(reader.GetInt32(0), reader.GetString(1),
                                                                           reader.GetString(2), reader.GetInt32(3), reader.GetDateTime(4));
                    listAll.Add(dcarte);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Erreur dans DistributionCarteVue->getAll" + e.Message);
            }
            finally
            {
                conn.Close();
                reader.Close();
            }
            return(listAll);
        }
Пример #3
0
        // GET ID Distribution carte
        public ActionResult DetailDistribution(int id)
        {
            distribCarteService = new DistributionCarteService();
            DistributionCarteVue distCarteId = distribCarteService.findById(id);

            ViewBag.DetailCarte    = distCarteId.Carte;
            ViewBag.DetailQuantite = distCarteId.Quantite;
            ViewBag.DetailEmploye  = distCarteId.Employe;
            ViewBag.DetailDate     = distCarteId.Date;
            return(View());
        }
        public List <DistributionCarteVue> search(DistributionCarteVue carte)
        {
            List <DistributionCarteVue> listDistribCarte;

            try
            {
                listDistribCarte = distributionDAO.search(carte);
            }
            catch (Exception e)
            {
                throw new Exception("Erreur dans DistributionCarteService => search:" + e.Message);
            }
            return(listDistribCarte);
        }
Пример #5
0
        public List <DistributionCarteVue> search(DistributionCarteVue dcarte)
        {
            conn = new DB().getConn();
            List <DistributionCarteVue> listAll = new List <DistributionCarteVue>();

            try
            {
                string query = "select * from distribution_carte_vue where ";
                if (dcarte.Carte != null)
                {
                    query += "carte =" + dcarte.Carte;
                }
                if (dcarte.Employe != null)
                {
                    query += " and employe =" + dcarte.Employe;
                }
                if (dcarte.Quantite != null)
                {
                    query += " and quantite =" + dcarte.Quantite;
                }
                if (dcarte.Date != null)
                {
                    query += " and date =" + dcarte.Date;
                }

                cmd    = new NpgsqlCommand(query, conn);
                reader = cmd.ExecuteReader();
                while (reader.Read() == true)
                {
                    DistributionCarteVue c = new DistributionCarteVue(reader.GetInt16(0), reader.GetString(1),
                                                                      reader.GetString(2), reader.GetInt32(3), reader.GetDateTime(4));
                    listAll.Add(c);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Erreur dans DistributinDao=>search " + e.Message);
            }
            finally
            {
                conn.Close();
                reader.Close();
            }
            return(listAll);
        }