Exemplo n.º 1
0
        public static List<Users> getListUsers(String query)
        {
            NpgsqlConnection con = Connexion.Connection();
            try
            {
                List<Users> l = new List<Users>();
                NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        Users a = new Users();

                        a.Admin = false;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return l;
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return null;
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Exemplo n.º 2
0
 public static Personnel One(Users users)
 {
     try
     {
         return PersonnelDao.getOnePersonnel(users);
     }
     catch (Exception ex)
     {
         throw new Exception("Impossible d'atteindre l'enregistrement", ex);
     }
 }
Exemplo n.º 3
0
 public static Users getAjoutUsers(Users 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);
     }
 }
Exemplo n.º 4
0
 public bool correct(Users users)
 {
     if (users.codeUsers == null || users.codeUsers.Trim().Equals(""))
     {
         Messages.ShowErreur("Le code ne peut pas être null!");
         return false;
     }
     if (users.password == null || users.password.Trim().Equals(""))
     {
         Messages.ShowErreur("Le mot de passe ne peut pas être null!");
         return false;
     }
     return true;
 }
Exemplo n.º 5
0
 private Users RecopiewView()
 {
     Users u = new Users();
     u.CodeUsers = txt_email.Text.Trim();
     u.Password = txt_pwd.Text.Trim();
     return u;
 }
Exemplo n.º 6
0
 public static Users getOneUsers(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_users where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Users a = new Users();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Civilite = lect["civilite"].ToString().Trim();
                 a.NomUser = lect["nom_users"].ToString().Trim();
                 a.CodeUsers = lect["code_users"].ToString().Trim();
                 a.Password = lect["password_user"].ToString().Trim();
                 a.Photo = lect["photo"].ToString().Trim();
                 a.Actif = Convert.ToBoolean((lect["actif"].ToString() != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"].ToString().Trim() : "false") : "false");
                 a.Connected = Convert.ToBoolean((lect["connecte"].ToString() != null) ? (!lect["connecte"].ToString().Trim().Equals("") ? lect["connecte"].ToString().Trim() : "false") : "false");
                 a.Agence = (lect["agence"] != null
                     ? (!lect["agence"].ToString().Trim().Equals("")
                     ? BLL.AgenceBll.One(Convert.ToInt32(lect["agence"].ToString()))
                     : new Agence())
                     : new Agence());
                 a.Admin = false;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 7
0
 public static bool getUpdateUsers(Users 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);
     }
 }
Exemplo n.º 8
0
 public UsersBll(Users unUsers)
 {
     users = unUsers;
 }
Exemplo n.º 9
0
 public static Personnel getOnePersonnel(Users users)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_com_personnel where users = " + users.Id + " limit 1";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Personnel a = new Personnel();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Users = (lect["users"] != null
                     ? (!lect["users"].ToString().Trim().Equals("")
                     ? BLL.UsersBll.One(Convert.ToInt64(lect["users"].ToString()))
                     : new Users())
                     : new Users());
                 a.Commission = (lect["plan_commission"] != null
                     ? (!lect["plan_commission"].ToString().Trim().Equals("")
                     ? BLL.PlanCommissionBll.One(Convert.ToInt64(lect["plan_commission"].ToString()))
                     : new PlanCommission())
                     : new PlanCommission());
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }