Example #1
0
        public static List <PlanRemise> getListPlanRemise(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <PlanRemise> l    = new List <PlanRemise>();
                NpgsqlCommand     Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader  lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        PlanRemise a = new PlanRemise();
                        a.Id        = Convert.ToInt64(lect["id"].ToString());
                        a.DateDebut = (DateTime)((lect["date_debut"] != null) ? (!lect["date_debut"].ToString().Trim().Equals("") ? lect["date_debut"] : DateTime.Now) : DateTime.Now);
                        a.DateFin   = (DateTime)((lect["date_fin"] != null) ? (!lect["date_fin"].ToString().Trim().Equals("") ? lect["date_fin"] : DateTime.Now) : DateTime.Now);
                        a.Actif     = (Boolean)((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"] : false) : false);
                        a.Remise    = (lect["remise"] != null
                            ? (!lect["remise"].ToString().Trim().Equals("")
                            ? BLL.RemiseBll.One(Convert.ToInt64(lect["remise"].ToString()))
                            : new Remise())
                            : new Remise());
                        a.Article = (lect["article"] != null
                            ? (!lect["article"].ToString().Trim().Equals("")
                            ? BLL.ArticleComBll.One(Convert.ToInt32(lect["article"].ToString()))
                            : new ArticleCom())
                            : new ArticleCom());
                        a.Update = true;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return(l);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #2
0
        public static PlanRemise getOnePlanRemise(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_com_plan_remise where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                PlanRemise       a      = new PlanRemise();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id        = Convert.ToInt64(lect["id"].ToString());
                        a.DateDebut = (DateTime)((lect["date_debut"] != null) ? (!lect["date_debut"].ToString().Trim().Equals("") ? lect["date_debut"] : DateTime.Now) : DateTime.Now);
                        a.DateFin   = (DateTime)((lect["date_fin"] != null) ? (!lect["date_fin"].ToString().Trim().Equals("") ? lect["date_fin"] : DateTime.Now) : DateTime.Now);
                        a.Actif     = (Boolean)((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"] : false) : false);
                        a.Remise    = (lect["remise"] != null
                            ? (!lect["remise"].ToString().Trim().Equals("")
                            ? BLL.RemiseBll.One(Convert.ToInt64(lect["remise"].ToString()))
                            : new Remise())
                            : new Remise());
                        a.Article = (lect["article"] != null
                            ? (!lect["article"].ToString().Trim().Equals("")
                            ? BLL.ArticleComBll.One(Convert.ToInt32(lect["article"].ToString()))
                            : new ArticleCom())
                            : new ArticleCom());
                        a.Update = true;
                    }
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #3
0
        public static PlanRemise getAjoutPlanRemise(PlanRemise a)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        insert = "";
                NpgsqlCommand cmd    = new NpgsqlCommand(insert, con);
                cmd.ExecuteNonQuery();
                a.Id = getCurrent();
                return(a);
            }
            catch
            {
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #4
0
        public static bool getUpdatePlanRemise(PlanRemise a)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        update = "";
                NpgsqlCommand Ucmd   = new NpgsqlCommand(update, con);
                Ucmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception e)
            {
                Messages.Exception(e);
                return(false);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #5
0
 public PlanRemiseBll(PlanRemise unPlanRemise)
 {
     plan = unPlanRemise;
 }