public static List <IOEMDevice> getListByEmployeDates(Pointeuse pointeuse, Employe employe, DateTime debut, DateTime fin, string adresse) { List <IOEMDevice> result = new List <IOEMDevice>(); NpgsqlConnection connect = new Connexion().Connection(adresse); try { bool addTime = !debut.ToString("HH:mm:ss").Equals("00:00:00"); string query = "SELECT * FROM yvs_grh_ioem_device WHERE " + (addTime ? "date_time_action" : "date_action") + " BETWEEN '" + debut + "' AND '" + fin + "'"; if (employe != null ? employe.Id > 0 : false) { query += "AND employe =" + employe.Id; } query += "AND pointeuse =" + pointeuse.Id; NpgsqlCommand Lcmd = new NpgsqlCommand(query, connect); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { result.Add(Return(lect)); } } return(result); } catch (Exception ex) { Messages.Exception("IOEMDeviceDAO (getListByEmployeDates) ", ex); return(result); } finally { Connexion.Close(connect); } }
public static List <IOEMDevice> getListByEmploye(Pointeuse pointeuse, Employe employe, string adresse) { List <IOEMDevice> result = new List <IOEMDevice>(); NpgsqlConnection connect = new Connexion().Connection(adresse); try { string query = "SELECT * FROM yvs_grh_ioem_device WHERE pointeuse = " + pointeuse.Id; if (employe != null ? employe.Id > 0 : false) { query += "AND employe =" + employe.Id; } NpgsqlCommand Lcmd = new NpgsqlCommand(query, connect); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { result.Add(Return(lect)); } } return(result); } catch (Exception ex) { Messages.Exception("IOEMDeviceDAO (getListByEmployeDates) ", ex); return(result); } finally { Connexion.Close(connect); } }
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); }
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++; } } }
public static bool getDelete(Pointeuse pointeuse, Employe employe, DateTime debut, DateTime fin, string adresse) { NpgsqlConnection connect = new Connexion().Connection(adresse); try { string query = "DELETE FROM yvs_grh_ioem_device WHERE date_time_action BETWEEN '" + debut + "' AND '" + fin + "'"; if (employe != null ? employe.Id > 0 : false) { query += "AND employe =" + employe.Id; } query += "AND pointeuse =" + pointeuse.Id; NpgsqlCommand cmd = new NpgsqlCommand(query, connect); cmd.ExecuteNonQuery(); return(true); } catch (Exception ex) { Messages.Exception("IOEMDeviceDAO (getDelete)", ex); return(false); } finally { Connexion.Close(connect); } }
private void dgv_pointeuse_MouseDown(object sender, MouseEventArgs e) { DataGridView.HitTestInfo info = dgv_pointeuse.HitTest(e.X, e.Y); //get info int pos = dgv_pointeuse.HitTest(e.X, e.Y).RowIndex; if (pos > -1) { if (dgv_pointeuse.Rows[pos].Cells["id"].Value != null) { Int32 id = (Int32)dgv_pointeuse.Rows[pos].Cells["id"].Value; pointeuse = pointeuses.Find(x => x.Id == id); switch (e.Button) { case MouseButtons.Right: { ResetDataPointeuse(); dgv_pointeuse.Rows[pos].Selected = true; //Select the row } break; default: break; } } } }
public void LoadDataBtn() { Appareil z = Utils.ReturnAppareil(currentPointeuse); Utils.VerifyZkemkeeper(ref z, ref currentPointeuse); if (z == null) { Utils.WriteLog("La liaison avec l'appareil " + currentPointeuse.Ip + " est corrompue"); return; } currentPointeuse.Zkemkeeper = z; Pointeuse p = Constantes.POINTEUSES.Find(x => x.Id == currentPointeuse.Id); if (p != null ? p.Id > 0 : false) { currentPointeuse.Logs = p.Logs; } if (currentPointeuse.Logs != null ? currentPointeuse.Logs.Count > 0 : false) { lIO = currentPointeuse.Logs; } else { lIO = z.GetAllAttentdData(currentPointeuse.IMachine, currentPointeuse.Connecter); } ObjectThread o = new ObjectThread(Constantes.PBAR_WAIT); o.UpdateMaxBar(lIO.Count); LoadLogs(lIO, false); }
private void dgv_pointeuse_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (dgv_pointeuse.CurrentRow.Cells["ID"].Value != null) { int id = Convert.ToInt32(dgv_pointeuse.CurrentRow.Cells["ID"].Value); if (id > 0) { currentPointeuse = Constantes.POINTEUSES.Find(x => x.Id == id); if (currentPointeuse != null ? currentPointeuse.Id > 0 : false) { currentPointeuse = PointeuseBLL.OneById(id); } btn_load_by_appareil.Text = "Charger Log (Pointeuse : " + currentPointeuse.Ip + ")"; LoadFileBackup(); dgv_log.Rows.Clear(); } else { ResetDataPointeuse(); } btn_del_doublon.Enabled = false; } } catch (Exception ex) { Messages.Exception("Form_Archive_Pointeuse (dgv_pointeuse_CellContentClick) ", ex); } }
public static bool getInsert(Pointeuse bean) { NpgsqlConnection connect = new Connexion().Connection(); try { Pointeuse p = getOneByIp(bean.Ip); if (p != null ? p.Id < 1 : true) { string query = "insert into yvs_pointeuse(adresse_ip, port, description, emplacement, connecter, actif, i_machine, multi_societe, societe, agence, type, author) values " + "('" + bean.Ip + "'," + bean.Port + ",'" + bean.Description + "','" + bean.Emplacement + "','" + bean.Connecter + "','" + bean.Actif + "'," + bean.IMachine + ",'" + bean.MultiSociete + "'," + Constantes.SOCIETE.Id + "," + bean.Agence + ", '" + bean.Type + "', " + (Constantes.USERS.Author > 0 ? Constantes.USERS.Author.ToString() : "null") + ")"; NpgsqlCommand cmd = new NpgsqlCommand(query, connect); cmd.ExecuteNonQuery(); return(true); } else { Utils.WriteLog("Impossible d'ajouter car l'appareil " + bean.Ip + " existe déja"); return(false); } } catch (Exception ex) { Messages.Exception("PointeuseDao (getInsert) ", ex); return(false); } finally { Connexion.Close(connect); } }
public static Pointeuse getOneByIp(string ip, int societe) { Pointeuse bean = new Pointeuse(); NpgsqlConnection connect = new Connexion().Connection(); try { string query = "select * from yvs_pointeuse where adresse_ip ='" + ip + "' and societe = " + societe; NpgsqlCommand Lcmd = new NpgsqlCommand(query, connect); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { bean = Return(lect); } } return(bean); } catch (Exception ex) { Messages.Exception("PointeuseDao (getOneById) ", ex); return(bean); } finally { Connexion.Close(connect); } }
private void synchroniserToolStripMenuItem_Click(object sender, EventArgs e) { if ((presences != null ? presences.Count > 0 : false) && (Constantes.POINTEUSES != null ? Constantes.POINTEUSES.Count > 0 : false)) { Presence p = presences[position]; Employe emp = p.Employe; Utils.WriteLog("Demande de synchronisation des logs de l'employe " + emp.NomPrenom + ""); if (Messages.Confirmation_Infos("synchroniser") == System.Windows.Forms.DialogResult.Yes) { if (p.Id > 0) { if (p.Pointeuses == null) { p.Pointeuses = new List <string>(); } if (p.Pointeuses.Count < 1) { foreach (Pointeuse y in Constantes.POINTEUSES) { if (y.Logs.Count > 0) { p.Pointeuses.Add(y.Id.ToString()); } } } if (p.Pointeuses.Count > 0) { object_statut.SetValueBar(0); Constantes.PBAR_WAIT = pbar_statut; List <IOEMDevice> logs = new List <IOEMDevice>(); foreach (string id in p.Pointeuses) { Pointeuse y = Constantes.POINTEUSES.Find(x => x.Id == Convert.ToInt32(id)); if (y != null ? y.Id > 0 : false) { logs.InsertRange(logs.Count, Utils.FindLogsInFileTamponLogs(y.Logs, true, emp, true, p.DateDebut, p.DateFin)); } } if (logs.Count > 0) { Pointeuse y = Constantes.POINTEUSES.Find(x => x.Id == Convert.ToInt32(p.Pointeuses[0])); object_statut.UpdateMaxBar(0); Thread thread = new Thread(delegate() { SynchroniseFichePresence(logs, y, p); }); thread.Start(); } else { Utils.WriteLog("-- Synchronisation impossible car le log est vide"); } } } } else { Utils.WriteLog("-- Synchronisation des logs de l'employe " + emp.NomPrenom + " annulée"); } } }
private void dgv_pointeuse_MouseDown(object sender, MouseEventArgs e) { DataGridView.HitTestInfo info = dgv_pointeuse.HitTest(e.X, e.Y); //get info int pos = dgv_pointeuse.HitTest(e.X, e.Y).RowIndex; if (pos > -1) { if (dgv_pointeuse.Rows[pos].Cells[0].Value != null) { int id = Convert.ToInt32(dgv_pointeuse.Rows[pos].Cells[0].Value); if (id > 0) { Pointeuse y = Constantes.POINTEUSES.Find(x => x.Id == id); if (y != null ? y.Id > 0 : false) { switch (e.Button) { case MouseButtons.Right: { ResetData(); dgv_pointeuse.Rows[pos].Selected = true; //Select the row } break; default: select = y; form.currentPointeuse = y; this.Dispose(); break; } } } } } }
private void dgv_pointeuse_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (dgv_pointeuse.CurrentRow.Cells["id"].Value != null) { int id = Convert.ToInt32(dgv_pointeuse.CurrentRow.Cells["id"].Value); if (id > 0) { currentPointeuse = Constantes.POINTEUSES.Find(x => x.Id == id); if (currentPointeuse != null ? currentPointeuse.Id > 0 : false) { currentPointeuse = PointeuseBLL.OneById(id); } LoadDestination(); } else { ResetDataPointeuse(); } } } catch (Exception ex) { Messages.Exception("Form_Empreinte (dgv_pointeuse_CellContentClick) ", ex); } }
public static IOEMDevice getOne(Pointeuse pointeuse, Employe employe, DateTime date, string adresse) { IOEMDevice result = new IOEMDevice(); NpgsqlConnection connect = new Connexion().Connection(adresse); try { string query = "SELECT * FROM yvs_grh_ioem_device WHERE date_time_action = '" + date + "' AND employe =" + employe.Id + " AND pointeuse =" + pointeuse.Id; NpgsqlCommand Lcmd = new NpgsqlCommand(query, connect); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { result = Return(lect); break; } } } catch (Exception ex) { Messages.Exception("IOEMDeviceDAO (getOne)", ex); return(result); } finally { Connexion.Close(connect); } return(result); }
public async Task <IActionResult> PutPointeuse([FromRoute] int id, [FromBody] Pointeuse pointeuse) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pointeuse.Id) { return(BadRequest()); } _context.Entry(pointeuse).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PointeuseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void ResetDataPointeuse() { for (int i = 0; i < dgv_pointeuse.Rows.Count; i++) { dgv_pointeuse.Rows[i].Selected = false; } currentPointeuse = null; }
public void ResetDataPointeuse() { btn_load_by_appareil.Text = "Charger Log (Pointeuse : 192.168.1.201)"; for (int i = 0; i < dgv_pointeuse.Rows.Count; i++) { dgv_pointeuse.Rows[i].Selected = false; } currentPointeuse = null; btn_del_doublon.Enabled = false; }
public Form_Employe(Pointeuse pointeuse, bool vue_all_employe) { InitializeComponent(); Configuration.Load(this); object_employe = new ObjectThread(dgv_employe); object_empreinte = new ObjectThread(dgv_empreinte); this.pointeuse = pointeuse; this.vue_all_employe = vue_all_employe; }
public static bool Delete(Pointeuse pointeuse, string adresse) { try { return(IOEMDeviceDAO.getDelete(pointeuse, adresse)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static IOEMDevice One(Pointeuse pointeuse, Employe employe, DateTime date, string adresse) { try { return(IOEMDeviceDAO.getOne(pointeuse, employe, date, adresse)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <IOEMDevice> List(Pointeuse pointeuse, Employe employe, DateTime debut, DateTime fin, string adresse) { try { return(IOEMDeviceDAO.getListByEmployeDates(pointeuse, employe, debut, fin, adresse)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <IOEMDevice> ListEx(Pointeuse pointeuse, List <Employe> employes, DateTime[] dates, string adresse) { try { return(IOEMDeviceDAO.getListNoByEmployesDates(pointeuse, employes, dates, adresse)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Insert(Pointeuse bean) { try { return(PointeuseDAO.getInsert(bean)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Update(Pointeuse bean, int id) { try { return(PointeuseDAO.getUpdate(bean, id)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult> activerPointeuse([FromRoute] int id) { Pointeuse pointeuse = await _context.Pointeuse.FirstOrDefaultAsync(x => x.Id == id); if (pointeuse != null) { pointeuse.Etat = true; _context.SaveChanges(); } return(Ok()); }
public static bool Delete(Pointeuse pointeuse, Employe employe, DateTime debut, DateTime fin, string adresse) { try { return(IOEMDeviceDAO.getDelete(pointeuse, employe, debut, fin, adresse)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <IActionResult> PostPointeuse([FromBody] Pointeuse pointeuse) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Pointeuse.Add(pointeuse); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPointeuse", new { id = pointeuse.Id }, pointeuse)); }
public void SynchroniseFichePresence(List <IOEMDevice> logs, Pointeuse y, Presence p) { Employe emp = p.Employe; Thread thread = new Thread(delegate() { Fonctions.SynchroniseServer(logs, y.Ip, false, emp, true, p.DateDebut, p.DateFin, false); }); thread.Start(); if (thread.IsAlive) { thread.Join(); } LoadPresence(dtp_date.Value, emp); Utils.WriteLog("-- Synchronisation des logs de l'employe " + emp.NomPrenom + " terminée"); }
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 Form_Infos_Pointeuse_FormClosing(object sender, FormClosingEventArgs e) { bool update = pointeuse != null ? pointeuse.Id > 0 : false; if (update) { Constantes.FORM_UPD_POINTEUSE = null; pointeuse = null; Utils.removeFrom("Form_Pointeuse_U"); } else { Constantes.FORM_ADD_POINTEUSE = null; Utils.removeFrom("Form_Pointeuse_I"); } Utils.WriteLog("Fermeture page (" + (update ? "Modification Appareil" : "Ajout Appareil") + ")"); }