private void SearchPointeuse(List <string> adresses) { Utils.WriteLog("Recherche des appareils sur la plage " + adresses[0] + " à " + adresses[adresses.Count - 1]); int count = 1; foreach (string ip in adresses) { Appareil z = new Appareil(); if (Utils.PingAdresse(ip, ref z)) { Pointeuse p = PointeuseBLL.OneByIp(ip); if (p != null ? p.Id > 0 : false) { p.Zkemkeeper = z; } else { p = new Pointeuse(-(count)); p.Ip = ip; } object_pointeuse.WriteDataGridView(new object[] { p.Id, count, p.Ip, p.Connecter }); pointeuses.Add(p); count++; } object_pbar.UpdateBar(1); } object_pbar.UpdateBar(pbar_statut.Maximum - pbar_statut.Value); }
private void LoadView() { dgv_log.Rows.Clear(); for (int i = 0; i < pings.Count; i++) { string line = pings[i]; object_log.WriteDataGridView(new object[] { i + 1, line, false }); } }
private void Dial_View_No_Insert_Load(object sender, EventArgs e) { if (current.iCorrect) { this.Dispose(); return; } string adresse = Constantes.SOCIETE.AdresseIp; //Recherche des fiches dont l'heure definie à deja été inserée DateTime time = new DateTime(current.idwYear, current.idwMonth, current.idwDay, current.idwHour, current.idwMinute, 0); string query = "select r.* from yvs_grh_pointage p inner join yvs_grh_presence r on p.presence = r.id where r.employe = " + employe.Id + " and ((heure_entree is not null and heure_entree = '" + time + "') or (heure_sortie is not null and heure_sortie = '" + time + "'))"; presences = PresenceBLL.List(query, true, adresse); if (presences != null ? presences.Count > 0 : false) { foreach (Presence p in presences) { object[] value = new object[] { p.Id, p.Employe.NomPrenom, p.DateDebut.ToShortDateString() + " à " + p.HeureDebut.ToShortTimeString(), p.DateFin.ToShortDateString() + " à " + p.HeureFin.ToShortTimeString(), p.DateFinPrevu.ToShortDateString(), p.HeureFinPrevu.ToShortTimeString(), p.Valider }; object_presence.WriteDataGridView(value); } lb_statut.Text = "Ce pointage à deja été inseré"; } else { //Recherche des fiches dont l'heure definie se trouve dans une fiche validée query = "select * from yvs_grh_presence where employe = " + employe.Id + " and '" + current.CurrentDateTime + "' between date_debut and date_fin and valider is true"; presences = PresenceBLL.List(query, true, adresse); if (presences != null ? presences.Count > 0 : false) { foreach (Presence p in presences) { object[] value = new object[] { p.Id, p.Employe.NomPrenom, p.DateDebut.ToShortDateString() + " à " + p.HeureDebut.ToShortTimeString(), p.DateFin.ToShortDateString() + " à " + p.HeureFin.ToShortTimeString(), p.DateFinPrevu.ToShortDateString(), p.HeureFinPrevu.ToShortTimeString(), p.Valider }; object_presence.WriteDataGridView(value); } lb_statut.Text = "Ce pointage se trouve dans une fiche validée"; } else { //Recherche des fiches dont l'heure definie se trouve entre la date debut et la date de fin prevu query = "select * from yvs_grh_presence where employe = " + employe.Id + " and '" + current.CurrentDateTime + "' between date_debut and date_fin_prevu"; presences = PresenceBLL.List(query, true, adresse); if (presences != null ? presences.Count > 0 : false) { foreach (Presence p in presences) { object[] value = new object[] { p.Id, p.Employe.NomPrenom, p.DateDebut.ToShortDateString() + " à " + p.HeureDebut.ToShortTimeString(), p.DateFin.ToShortDateString() + " à " + p.HeureFin.ToShortTimeString(), p.DateFinPrevu.ToShortDateString(), p.HeureFinPrevu.ToShortTimeString(), p.Valider }; object_presence.WriteDataGridView(value); } lb_statut.Text = "Ce pointage se trouve entre la date debut et la date de fin prevu d'une fiche déjà validée"; } } } if (presences != null ? presences.Count > 0 && presences.Count < 2 : false) { loadPointage(presences[0], adresse); } }
private void LoadEmploye() { object_employe.ClearDataGridView(true); employes.Clear(); appareil.EnableDevice(pointeuse.IMachine, false); appareil.ReadAllUserID(pointeuse.IMachine);//read all the user information to the memory switch (pointeuse.Type) { case Constantes.TYPE_IFACE: { string iEnrollNumber = ""; string iName = ""; int iPrivilege = 0; string iPassword = ""; bool iEnabled = false; while (appareil.SSR_GetAllUserInfo(pointeuse.IMachine, out iEnrollNumber, out iName, out iPassword, out iPrivilege, out iEnabled)) { Employe e = new Employe(Convert.ToInt32(iEnrollNumber), iEnrollNumber, ""); e.Nom = iName; e.Password = iPassword; e.Privilege = iPrivilege; e.BEnabled = iEnabled; object_employe.WriteDataGridView(new object[] { e.Id, e.NomPrenom, e.IsPrivilege }); employes.Add(e); } break; } default: { int iEnrollNumber = 0; int iPrivilege = 0; int iEMachineNumber = 0; int iBackupNumber = 0; int iEnabled = 0; while (appareil.GetAllUserID(pointeuse.IMachine, ref iEnrollNumber, ref iEMachineNumber, ref iBackupNumber, ref iPrivilege, ref iEnabled)) { Employe e = EmployeBLL.OneById(iEnrollNumber); if (e != null ? e.Id < 1 : true) { e = new Employe(iEnrollNumber, iEnrollNumber.ToString(), ""); } object_employe.WriteDataGridView(new object[] { e.Id, e.NomPrenom, e.IsPrivilege }); } break; } } appareil.EnableDevice(pointeuse.IMachine, true); ResetEmploye(); }
private void Action(Dictionnaire y, int action, bool load)// action : 1 pour sauvegarder - 2 pour modifier - 3 pour supprimer { if (y != null ? y.Id > 0 : false) { int idx = Utils.GetRowData(dgv_dico, y.Id); object[] row = new object[] { y.Id, y.Nom, y.Langue.Code, (y.Francais != null ? y.Francais.Nom : "") }; switch (action) { case 1: objet_dico.WriteDataGridView(row); if (dgv_dico.Rows.Count > dao.max) { objet_dico.RemoveDataGridView(dgv_dico.Rows.Count - 1); } if (!load) { dao.Result.Add(y); } break; case 2: if (idx > -1) { objet_dico.RemoveDataGridView(idx); objet_dico.WriteDataGridView(idx, row); } if (!load) { idx = dao.Result.FindIndex(x => y.Id == x.Id); if (idx > -1) { dao.Result[idx] = y; } } break; default: if (idx > -1) { objet_dico.RemoveDataGridView(idx); } if (!load) { dao.Result.Remove(y); } break; } } }
private void SaveCurrent() { string fileName = Chemins.CheminBackupServeur() + DateTime.Now.ToString("dd-MM-yyyy") + ".csv"; bool deja = File.Exists(fileName); ObjectThread o_ = new ObjectThread(Constantes.PBAR_WAIT); o_.UpdateMaxBar(lIO.Count); foreach (IOEMDevice o in lIO) { Logs.WriteCsv(fileName, o); Constantes.LoadPatience(false); } if (!deja) { FileInfo file = new FileInfo(fileName); ObjectThread o1 = new ObjectThread(dgv_backup); o1.WriteDataGridView(new object[] { file.Name }); } File.Delete(Chemins.CheminDatabase() + "LogRecord.csv"); File.Create(Chemins.CheminDatabase() + "LogRecord.csv"); ObjectThread o2 = new ObjectThread(dgv_log); o2.ClearDataGridView(true); Utils.WriteLog("-- Sauvegarde du fichier courant effectuée"); Constantes.LoadPatience(true); }
public void LoadLogs(List <IOEMDevice> l, bool file) { bFile = file; ObjectThread o_ = new ObjectThread(btn_del_doublon); o_.EnableButton(file); o_ = new ObjectThread(dgv_log); o_.ClearDataGridView(true); if (l != null ? l.Count > 0 : false) { int i = 0; ObjectThread o1 = new ObjectThread(Constantes.PBAR_WAIT); o1.UpdateMaxBar(Constantes.PBAR_WAIT.Maximum + l.Count); foreach (IOEMDevice o in l) { ++i; Employe e = EmployeBLL.OneById(o.idwSEnrollNumber); if (e != null ? e.Id < 1 : true) { e = new Employe(o.idwSEnrollNumber, o.idwSEnrollNumber.ToString(), ""); } DateTime date = new DateTime(o.idwYear, o.idwMonth, o.idwDay, o.idwHour, o.idwMinute, o.idwSecond); o_.WriteDataGridView(new object[] { i, e.Id, e.Nom + " " + e.Prenom, date.ToShortDateString(), date.ToLongTimeString() }); Constantes.LoadPatience(false); } Constantes.LoadPatience(true); } else { Utils.WriteLog("La liste des logs venants " + (file ? "du fichier (" + currentFile : "de la pointeuse (" + currentPointeuse.Ip) + ") est vide"); } }
private void Action(GroupeMatiere y, int action, bool load)// action : 1 pour sauvegarder - 2 pour modifier - 3 pour supprimer { int idx = Utils.GetRowData(dgv_groupe, y.Id); object[] row = new object[] { y.Id, y.Code, y.Intitule }; switch (action) { case 1: objet_groupe.WriteDataGridView(row); if (dgv_groupe.Rows.Count > dao.max) { objet_groupe.RemoveDataGridView(dgv_groupe.Rows.Count - 1); } if (!load) { dao.Result.Add(y); } break; case 2: if (idx > -1) { objet_groupe.RemoveDataGridView(idx); objet_groupe.WriteDataGridView(idx, row); } if (!load) { idx = dao.Result.FindIndex(x => y.Id == x.Id); if (idx > -1) { dao.Result[idx] = y; } } break; default: if (idx > -1) { objet_groupe.RemoveDataGridView(idx); } if (!load) { dao.Result.Remove(y); } break; } }
private void dgv_destination_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (dgv_destination.CurrentRow.Cells["id_d"].Value != null) { int id = Convert.ToInt32(dgv_destination.CurrentRow.Cells["id_d"].Value); if (id > 0) { Pointeuse p = Constantes.POINTEUSES.Find(x => x.Id == id); if (p != null ? p.Id > 0 : false) { p = PointeuseBLL.OneById(id); } if (p != null ? p.Id > 0 : false) { int pos = Utils.GetRowData(dgv_destination, id); ObjectThread o = new ObjectThread(dgv_destination); o.RemoveDataGridView(pos); Pointeuse p_ = destinations.Find(x => x.Id == p.Id); if (p_ != null ? p_.Id > 0 : false) { destinations.RemoveAt(destinations.FindIndex(x => x.Id == p.Id)); o.WriteDataGridView(pos, new object[] { p.Id, false, p.Ip, }); } else { destinations.Add(p); o.WriteDataGridView(pos, new object[] { p.Id, true, p.Ip, }); } ResetDataDestination_(); dgv_destination.Rows[pos].Selected = true; } } else { ResetDataDestination(); } } } catch (Exception ex) { Messages.Exception("Form_Empreinte (dgv_destination_CellContentClick) ", ex); } }
private void dgv_empreinte_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (dgv_empreinte.CurrentRow.Cells["id_em"].Value != null) { int id = Convert.ToInt32(dgv_empreinte.CurrentRow.Cells["id_em"].Value); if (!IS_INFOS ? (id > 0) : true) { Empreinte p = le.Find(x => x.Id == id); if (p != null ? (!IS_INFOS ? p.Id > 0 : true) : false) { int pos = Utils.GetRowData(dgv_empreinte, id); ObjectThread o = new ObjectThread(dgv_empreinte); o.RemoveDataGridView(pos); Empreinte p_ = empreintes.Find(x => x.Id == p.Id); if (p_ != null ? (!IS_INFOS ? p_.Id > 0 : true) : false) { empreintes.RemoveAt(empreintes.FindIndex(x => x.Id == p.Id)); Finger f = (Finger)Finger.Get(p.Digital); o.WriteDataGridView(pos, new object[] { p.Id, false, pos + 1, p.Employe.Id, p.Employe.NomPrenom, f.Main, f.Doigt }); } else { empreintes.Add(p); Finger f = (Finger)Finger.Get(p.Digital); o.WriteDataGridView(pos, new object[] { p.Id, true, pos + 1, p.Employe.Id, p.Employe.NomPrenom, f.Main, f.Doigt }); } ResetDataEmpreinte_(); dgv_empreinte.Rows[pos].Selected = true; } } else { ResetDataDestination(); } } } catch (Exception ex) { Messages.Exception("Form_Empreinte (dgv_destination_CellContentClick) ", ex); } }
private void LoadDestination() { ObjectThread o = new ObjectThread(dgv_destination); o.ClearDataGridView(true); if (currentPointeuse != null ? currentPointeuse.Id > 0 : false) { foreach (Pointeuse p in Constantes.POINTEUSES) { if (currentPointeuse.Ip != p.Ip) { o.WriteDataGridView(new object[] { p.Id, false, p.Ip }); } } } else { foreach (Pointeuse p in Constantes.POINTEUSES) { o.WriteDataGridView(new object[] { p.Id, false, p.Ip, }); } } ResetDataDestination(); }
public void LoadPointeuse() { if (Constantes.POINTEUSES.Count < 1) { Societe s = SocieteBLL.ReturnSociete(); Constantes.POINTEUSES = PointeuseBLL.List("select * from yvs_pointeuse where societe = " + s.Id + " order by adresse_ip"); } dgv_pointeuse.Rows.Clear(); ObjectThread o = new ObjectThread(dgv_pointeuse); foreach (Pointeuse p in Constantes.POINTEUSES) { o.WriteDataGridView(new object[] { p.Id, p.Ip, p.Emplacement, p.Type }); } }
private void LoadEmpreinte(List <Empreinte> l) { ObjectThread o = new ObjectThread(dgv_empreinte); o.ClearDataGridView(true); ObjectThread o_ = new ObjectThread(Constantes.PBAR_WAIT); o_.UpdateMaxBar(Constantes.PBAR_WAIT.Maximum + l.Count); int i = 1; foreach (Empreinte e in l) { Finger f = (Finger)Finger.Get(e.Digital); o.WriteDataGridView(new object[] { e.Id, false, i, e.Employe.Id, e.Employe.NomPrenom, f.Main, f.Doigt }); i++; Constantes.LoadPatience(false); } Constantes.LoadPatience(true); }
private void loadPointage(Presence y, string adresse) { object_pointage.ClearDataGridView(true); if (y != null ? y.Id > 0 : false) { presence = y; string query = "select * from yvs_grh_pointage where presence = " + y.Id; List <Pointage> lp = PointageBLL.List(query, true, adresse); if (lp != null ? lp.Count > 0 : false) { foreach (Pointage p in lp) { object[] value = new object[] { p.Id, p.HeureEntree.ToShortTimeString(), p.HeureSortie.ToShortTimeString(), p.Duree, p.Valider, p.Supplementaire, false, true }; object_pointage.WriteDataGridView(value); } } } }
private void RecupererInformation(Appareil z, Empreinte y) { if (y != null ? y.Id > 0 : false) { Employe emp = EmployeBLL.OneById((int)y.Employe.Id); if (emp != null ? emp.Id > 0 : false) { bool correct = false; switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: correct = z.SSR_SetUserInfo(currentPointeuse.IMachine, (int)emp.Id, emp.NomPrenom, null, 0, true); //upload user information to the memory break; default: correct = z.SetUserInfo(currentPointeuse.IMachine, (int)emp.Id, emp.NomPrenom, null, 0, true); //upload user information to the memory break; } if (correct) { y.Employe = emp; int pos = Utils.GetRowData(dgv_empreinte, y.Id); ObjectThread o = new ObjectThread(dgv_empreinte); o.RemoveDataGridView(pos); Finger f = (Finger)Finger.Get(y.Digital); Empreinte p = empreintes.Find(x => x.Id == y.Id); bool select = (p != null ? p.Id > 0 : false); o.WriteDataGridView(pos, new object[] { y.Id, select, pos + 1, y.Employe.Id, y.Employe.NomPrenom, f.Main, f.Doigt }); Utils.WriteLog("Recuperation Effectuée pour l'employé " + y.Employe.Id); } else { Utils.WriteLog("Recuperation Impossible pour l'employé " + y.Employe.Id); } } } }
private void LoadEmpreinte() { if (appareil.EnableDevice(pointeuse.IMachine, false)) { Cursor c = Cursors.WaitCursor; if (appareil.ReadAllTemplate(pointeuse.IMachine)) { string sTemplate = ""; int longTmps = 0; int flag_ = 0; foreach (Finger f in Utils.Fingers()) { if (appareil.GetUserTmpExStr(pointeuse.IMachine, employe.Id.ToString(), f.Index, out flag_, out sTemplate, out longTmps)) { object_empreinte.WriteDataGridView(new object[] { f.Index, f.Main, f.Doigt, flag_ }); } } } appareil.RefreshData(pointeuse.IMachine);//the data in the device should be refreshed appareil.EnableDevice(pointeuse.IMachine, true); c = Cursors.Default; } }
private void LoadPointage(Presence p) { try { string adresse = Constantes.SOCIETE.AdresseIp; object_statut.SetValueBar(0); Constantes.PBAR_WAIT = pbar_statut; ObjectThread o = new ObjectThread(dgv_pointage); o.ClearDataGridView(true); string query = "select * from yvs_grh_pointage where presence = " + p.Id + " order by heure_entree, heure_sortie"; string queryCount = "select count(id) from yvs_grh_pointage where presence = " + p.Id + ""; pointages = PointageBLL.List(query, true, queryCount, adresse); for (int i = 0; i < pointages.Count; i++) { o.WriteDataGridView(new object[] { pointages[i].Id, i + 1, pointages[i].HeureEntree.ToShortTimeString(), pointages[i].HeureSortie.ToShortTimeString(), Utils.GetTime(pointages[i].Duree), pointages[i].Valider, pointages[i].Supplementaire }); } } catch (Exception ex) { Messages.Exception("Form_Presence (LoadPointage)", ex); } }
private void cbox_table_SelectedIndexChanged(object sender, EventArgs e) { try { BindingSource bs = new BindingSource(); ObjectThread data_data_table = new ObjectThread(dgv_data_table); if (connect == null) { Utils.WriteLog("Veillez reselectionner la liaison"); } if (connect.State == System.Data.ConnectionState.Closed) { connect.Open(); } data_data_table.ClearDataGridView(true); if (cbox_table.SelectedItem.Equals("users")) { //Chargement des utilisateurs de liaison bs.DataSource = employes; externe.DataSource = bs; new Thread(delegate() { Npgsql.NpgsqlCommand cmd = null; Npgsql.NpgsqlDataReader lect = null; try { string query = "SELECT coderep, CONCAT(nom, ' ', prenom), externe FROM users ORDER BY coderep"; cmd = new Npgsql.NpgsqlCommand(query, connect); lect = cmd.ExecuteReader(); if (lect.HasRows) { int i = 0; while (lect.Read()) { var _externe = lect[2]; int index = _externe != null ? employes.FindIndex(x => x.Split(',')[0].Equals(_externe.ToString())) : -1; data_data_table.WriteDataGridView(new object[] { lect[0].ToString(), lect[1].ToString(), null }); if (index > -1 ? employes.Count > index ? dgv_data_table.Rows.Count > i : false : false) { ObjectThread cell = new ObjectThread(dgv_data_table.Rows[i].Cells[2] as DataGridViewComboBoxCell); cell.ValueComboBoxCell(employes[index]); } i++; } } } catch (Exception ex) { Messages.Exception(ex); } finally { if (cmd != null) { cmd.Dispose(); } if (lect != null) { lect.Dispose(); } } }).Start(); } else if (cbox_table.SelectedItem.Equals("tranchehoraire")) { bs.DataSource = tranches; //Chargement des utilisateurs de liaison externe.DataSource = bs; new Thread(delegate() { Npgsql.NpgsqlCommand cmd = null; Npgsql.NpgsqlDataReader lect = null; try { string query = "SELECT id, CONCAT(typedejrnee, ' ', CONCAT(heure_debut, '-', heure_fin)), externe FROM tranchehoraire ORDER BY typedejrnee, heure_debut"; cmd = new Npgsql.NpgsqlCommand(query, connect); lect = cmd.ExecuteReader(); if (lect.HasRows) { int i = 0; while (lect.Read()) { var _externe = lect[2]; int index = _externe != null ? tranches.FindIndex(x => x.Split(',')[0].Equals(_externe.ToString())) : -1; data_data_table.WriteDataGridView(new object[] { lect[0].ToString(), lect[1].ToString(), null }); if (index > -1 ? tranches.Count > index ? dgv_data_table.Rows.Count > i : false : false) { var var = dgv_data_table.Rows[i].Cells[2]; if (var is DataGridViewComboBoxCell) { ObjectThread cell = new ObjectThread(var as DataGridViewComboBoxCell); cell.ValueComboBoxCell(tranches[index]); } } i++; } } } catch (Exception ex) { Messages.Exception(ex); } finally { if (cmd != null) { cmd.Dispose(); } if (lect != null) { lect.Dispose(); } } }).Start(); } } catch (Exception ex) { Messages.Exception(ex); } }