Пример #1
0
 public static List<Commission> getListCommission(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<Commission> l = new List<Commission>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 Commission a = new Commission();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Nature = lect["nature_montant"].ToString();
                 a.DateDebut = Convert.ToDateTime((lect["date_debut"] != null) ? (!lect["date_debut"].ToString().Trim().Equals("") ? lect["date_debut"].ToString().Trim() : "00/00/0000") : "00/00/0000");
                 a.DateFin = Convert.ToDateTime((lect["date_fin"] != null) ? (!lect["date_fin"].ToString().Trim().Equals("") ? lect["date_fin"].ToString().Trim() : "00/00/0000") : "00/00/0000");
                 a.Actif = Convert.ToBoolean((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"].ToString().Trim() : "false") : "false");
                 a.Permanent = Convert.ToBoolean((lect["permanent"] != null) ? (!lect["permanent"].ToString().Trim().Equals("") ? lect["permanent"].ToString().Trim() : "false") : "false");
                 a.Montant = (Double)((lect["montant_commission"] != null) ? (!lect["montant_commission"].ToString().Trim().Equals("") ? lect["montant_commission"] : 0.0) : 0.0);
                 a.MontantMaximal = (Double)((lect["montant_maximal"] != null) ? (!lect["montant_maximal"].ToString().Trim().Equals("") ? lect["montant_maximal"] : 0.0) : 0.0);
                 a.MontantMinimal = (Double)((lect["montant_minimun"] != null) ? (!lect["montant_minimun"].ToString().Trim().Equals("") ? lect["montant_minimun"] : 0.0) : 0.0);
                 a.Article = (lect["article"] != null
                     ? (!lect["article"].ToString().Trim().Equals("")
                     ? BLL.ArticleComBll.One(Convert.ToInt64(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);
     }
 }
Пример #2
0
 public static Commission getAjoutCommission(Commission 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);
     }
 }
Пример #3
0
 public CommissionBll(Commission unCommission)
 {
     commission = unCommission;
 }
Пример #4
0
 public static bool getUpdateCommission(Commission 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);
     }
 }