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); } }
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 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 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 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 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); } }
public void Update() { string sIP_a = pointeuse.Ip; string sIP = txt_ip.Text.Trim(); Appareil z = Utils.ReturnAppareil(pointeuse); Utils.VerifyZkemkeeper(ref z, ref pointeuse); if (z != null) { int Imachine = 1; z.RegEvent(Imachine, 65535); z.SetDeviceIP(Imachine, sIP); z.RefreshData(Imachine);//the data in the device should be refreshed pointeuse.IMachine = Imachine; if (PointeuseBLL.Update(bean, pointeuse.Id)) { Utils.WriteLog("---- Modifier de l'adresse de l'appareil" + sIP_a + " en " + sIP + " effectuée"); ObjectThread o = new ObjectThread(this); o.WriteTextForm("Modifier Appareil : " + sIP); Utils.SetZkemkeeper(ref bean); if (!bean.MultiSociete && !bean.Societe.Equals(Constantes.SOCIETE.Id)) { Constantes.FORM_PARENT.DeletePointeuse(bean); } else { Constantes.FORM_PARENT.UpdatePointeuse(bean); } pointeuse = bean; } else { Utils.WriteLog("---- Modifier de l'adresse de l'appareil" + sIP_a + " en " + sIP + " impossible"); } } else { Utils.WriteLog("-- Modifier de l'adresse de l'appareil" + sIP_a + " en " + sIP + " impossible car connexion à l'appareil impossible"); } }
private void btn_appliquer_Click(object sender, EventArgs e) { if (txt_ip.Text.Trim() == "") { Utils.WriteLog("Entrer l'adresse IP svp!"); return; } if (!rbtn_multi.Checked ? pointeuse.Agence < 1 : false) { Utils.WriteLog("Précisez une agence svp!"); return; } if (pointeuse != null ? pointeuse.Id < 1 : true) { Utils.WriteLog("Demande d'enregistrement de l'appareil " + txt_ip.Text + ""); if (Messages.Confirmation_Infos("ajouter") == System.Windows.Forms.DialogResult.Yes) { if (PointeuseBLL.Insert(Pointeuse_())) { Utils.WriteLog("-- Enregistrement de l'appareil " + txt_ip.Text + " effectué"); Pointeuse bean = PointeuseBLL.OneByIp(Pointeuse_().Ip); Constantes.FORM_PARENT.AddPointeuse(bean); Constantes.POINTEUSES.Add(bean); } } else { Utils.WriteLog("-- Enregistrement de l'appareil " + txt_ip.Text + " annulé"); } } else { string sIP = txt_ip.Text.Trim(); Pointeuse new_ = PointeuseBLL.OneByIp(sIP); if (new_ != null ? (new_.Id > 0 ? (new_.Id.Equals(pointeuse.Id)) : true) : true) { Utils.WriteLog("Demande de modification de l'appareil " + pointeuse.Ip + ""); if (Messages.Confirmation_Infos("modifier") == System.Windows.Forms.DialogResult.Yes) { bean = Pointeuse_(pointeuse.Id); if (pointeuse.Ip.Equals(sIP)) { Utils.WriteLog("-- Modification des informations l'appareil " + pointeuse.Ip + ""); if (PointeuseBLL.Update(bean, pointeuse.Id)) { Utils.WriteLog("---- Modification des informations l'appareil " + pointeuse.Ip + " effectuée"); if (!bean.MultiSociete && !bean.Societe.Equals(Constantes.SOCIETE.Id)) { Constantes.FORM_PARENT.DeletePointeuse(bean); } else { Constantes.FORM_PARENT.UpdatePointeuse(bean); } pointeuse = bean; } else { Utils.WriteLog("---- Modification des informations l'appareil " + pointeuse.Ip + " impossible"); } } else { Utils.WriteLog("-- Modification de l'appareil " + pointeuse.Ip + " en " + sIP + "...Patientez svp!"); Cursor = Cursors.WaitCursor; Thread t = new Thread(new ThreadStart(Update)); t.Start(); Cursor = Cursors.Default; } } else { Utils.WriteLog("-- Modification de l'appareil " + pointeuse.Ip + " annulée"); } } else { Utils.WriteLog("L'appareil " + sIP + " existe deja"); } } }