public static Creneau One(Personnel pers) { try { return CreneauDao.getOneCreneau(pers); } catch (Exception ex) { throw new Exception("Impossible d'atteindre l'enregistrement", ex); } }
public static Personnel getAjoutPersonnel(Personnel 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); } }
public static List<Personnel> getListPersonnel(String query) { NpgsqlConnection con = Connexion.Connection(); try { List<Personnel> l = new List<Personnel>(); NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { Personnel a = new Personnel(); 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; l.Add(a); } lect.Close(); } return l; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static Creneau getOneCreneau(Personnel pers, DateTime date, DateTime heureDebut, DateTime heureFin) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select c.id as id, c.date_travail as date_travail, c.users as users, c.actif actif, h.depot as depot, h.type as type" + " from yvs_com_creneau_horaire_users c " + " inner join yvs_com_creneau_horaire h on c.creneau = h.id" + " inner join yvs_com_type_creneau_horaire t on h.type = t.id" + " where c.users = " + pers.Id + " and c.date_travail ='" + date + "' and t.heure_debut = '" + heureDebut + "' and t.heure_fin = '" + heureFin + "'"; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); Creneau a = new Creneau(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.Actif = Convert.ToBoolean((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"].ToString().Trim() : "false") : "false"); a.DateTravail = (DateTime)((lect["date_travail"] != null) ? (!lect["date_travail"].ToString().Trim().Equals("") ? lect["date_travail"] : DateTime.Now) : DateTime.Now); a.Personnel = (lect["users"] != null ? (!lect["users"].ToString().Trim().Equals("") ? BLL.PersonnelBll.One(Convert.ToInt64(lect["users"].ToString())) : new Personnel()) : new Personnel()); a.Depot = (lect["depot"] != null ? (!lect["depot"].ToString().Trim().Equals("") ? BLL.DepotBll.One(Convert.ToInt64(lect["depot"].ToString())) : new Depot()) : new Depot()); a.Tranche = (lect["type"] != null ? (!lect["type"].ToString().Trim().Equals("") ? BLL.TrancheHoraireBll.One(Convert.ToInt64(lect["type"].ToString())) : new TrancheHoraire()) : new TrancheHoraire()); a.Update = true; } lect.Close(); } return a; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static Creneau getOneCreneau(Personnel pers) { return getOneCreneau(pers, DateTime.Now); }
public static bool getUpdatePersonnel(Personnel 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); } }
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); } }
public static Creneau One(Personnel pers, DateTime date, DateTime heureDebut, DateTime heureFin) { try { return CreneauDao.getOneCreneau(pers, date, heureDebut, heureFin); } catch (Exception ex) { throw new Exception("Impossible d'atteindre l'enregistrement", ex); } }
public PersonnelBll(Personnel unPersonnel) { personnel = unPersonnel; }