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"); } }
public void LoadAdresse() { if (adresses != null ? adresses.Count > 0 : false) { object_pointeuse.ClearDataGridView(true); pointeuses.Clear(); int count = 1; foreach (string adresse in adresses) { Pointeuse p = PointeuseBLL.OneByIp(adresse); if (p != null ? p.Id > 0 : false) { p.Zkemkeeper = new Appareil(p); } else { p = new Pointeuse(-(count)); p.Ip = adresse; } object_pointeuse.WriteDataGridView(new object[] { p.Id, count, p.Ip, p.Connecter }); pointeuses.Add(p); count++; } } }
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); }
private void ChangeFonction() { _ResetText(); if (vue_all_employe) { this.box_connect.Image = global::ZK_Lymytz.Properties.Resources.unconnecte; btn_change_fct.Text = "Passer en mode testing"; appareil.OnEmpreintTesting(false); LoadEmploye(); } else { this.box_connect.Image = global::ZK_Lymytz.Properties.Resources.connecte; btn_change_fct.Text = "Passer en mode gestion"; appareil.OnEmpreintTesting(true); object_employe.ClearDataGridView(true); object_empreinte.ClearDataGridView(true); } vue_all_employe = !vue_all_employe; }
private void LoadAll(bool avance, bool init) { dao.ExecuteDynamicQuery(Dictionnaire.ToTable(), "y.langue asc , y.nom", avance, init); objet_dico.ClearDataGridView(true); foreach (Dictionnaire g in dao.Result) { Action(g, 1, true); } btn_prev.Enabled = !dao.disPrev; btn_next.Enabled = !dao.disNext; lb_position.Text = dao.currentPage + "/" + dao.totalPage; }
private void LoadAll(bool avance, bool init) { dao.AddParam(new ParametreRequete("y.langue.id", "langue", Constantes.LANGUE.Id, "=", "AND")); dao.ExecuteDynamicQuery(GroupeMatiere.ToTable(), "y.position desc, y.code", avance, init); objet_groupe.ClearDataGridView(true); foreach (GroupeMatiere g in dao.Result) { Action(g, 1, true); } btn_prev.Enabled = !dao.disPrev; btn_next.Enabled = !dao.disNext; lb_position.Text = dao.currentPage + "/" + dao.totalPage; }
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 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(); }
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); } }