Ejemplo n.º 1
0
 private void DeleteUser()
 {
     if (employe != null ? employe.Id > 0 : false)
     {
         if (appareil.EnableDevice(pointeuse.IMachine, false))
         {
             Cursor c = Cursors.WaitCursor;
             if (appareil.DeleteUserInfoEx(pointeuse.IMachine, (int)employe.Id))//upload user information to the memory
             {
                 Utils.WriteLog("Supppression de l'employe " + employe.Id + " [" + employe.Nom + "] effectuée");
                 object_employe.RemoveDataGridView(Utils.GetRowData(dgv_employe, employe.Id));
             }
             else
             {
                 Utils.WriteLog("Supppression de l'employe " + employe.Id + " [" + employe.Nom + "] impossible");
             }
             appareil.RefreshData(pointeuse.IMachine);//the data in the device should be refreshed
             appareil.EnableDevice(pointeuse.IMachine, true);
             c = Cursors.Default;
         }
         else
         {
             Utils.WriteLog("Supppression de l'employe " + employe.Id + " [" + employe.Nom + "] impossible");
         }
     }
 }
Ejemplo n.º 2
0
        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;
                }
            }
        }
Ejemplo n.º 3
0
 private void DeleteTmp()
 {
     if (fingerID > -1)
     {
         if (appareil.EnableDevice(pointeuse.IMachine, false))
         {
             Cursor c = Cursors.WaitCursor;
             if (appareil.ReadAllTemplate(pointeuse.IMachine))
             {
                 if (appareil.DelUserTmp(pointeuse.IMachine, (int)employe.Id, fingerID))//upload user information to the memory
                 {
                     Utils.WriteLog("-- Supppression de l'empreinte de l'employe " + employe.Id + " [" + employe.Nom + "] effectuée");
                     object_empreinte.RemoveDataGridView(Utils.GetRowData(dgv_empreinte, (long)fingerID));
                 }
                 else
                 {
                     Utils.WriteLog("-- Supppression de l'empreinte de l'employe " + employe.Id + " [" + employe.Nom + "] impossible");
                 }
             }
             else
             {
                 Utils.WriteLog("-- Supppression de l'empreinte de l'employe " + employe.Id + " [" + employe.Nom + "] impossible");
             }
             appareil.RefreshData(pointeuse.IMachine);//the data in the device should be refreshed
             appareil.EnableDevice(pointeuse.IMachine, true);
             c = Cursors.Default;
         }
         else
         {
             Utils.WriteLog("-- Supppression de l'empreinte de l'employe " + employe.Id + " [" + employe.Nom + "] impossible");
         }
     }
 }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
 private void checkErreurToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (pings != null ? pings.Count > 0 : false)
     {
         DateTime _last = DateTime.Now;
         for (int i = 0; i < pings.Count; i++)
         {
             string line = pings[i];
             if ((i > 0) && ((Constantes.MILLISECONDS(Convert.ToDateTime(line)) - Constantes.MILLISECONDS(_last)) > (1000 * Constantes.MAX_TIME_PING)))
             {
                 object_log.RemoveDataGridView(i);
                 object_log.WriteDataGridView(i, new object[] { i + 1, line, true });
             }
             _last = Convert.ToDateTime(line);
         }
     }
 }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private void SupprimerEmpreinte(Appareil z, Empreinte selectEmpreinte, bool serveur)
        {
            if (selectEmpreinte != null ? selectEmpreinte.Id > 0 : false)
            {
                bool correct = false;
                if (serveur)
                {
                    Empreinte y = null;
                    if (IS_DIGITAL)
                    {
                        y = EmpreinteBLL.OneByEmployeFinger(selectEmpreinte.Employe.Id, selectEmpreinte.Digital);
                    }
                    else
                    {
                        y = EmpreinteBLL.OneByEmployeFacial(selectEmpreinte.Employe.Id, selectEmpreinte.Facial);
                    }
                    if (y != null ? y.Id > 0 : false)
                    {
                        correct = EmpreinteBLL.Delete(y, y.Id);
                    }
                }
                else
                {
                    if (IS_DIGITAL)
                    {
                        switch (z._POINTEUSE.Type)
                        {
                        case Constantes.TYPE_IFACE:
                            correct = z.SSR_DelUserTmp(currentPointeuse.IMachine, selectEmpreinte.Employe.Id.ToString(), selectEmpreinte.Digital);
                            break;

                        default:
                            correct = z.DelUserTmp(currentPointeuse.IMachine, (int)selectEmpreinte.Employe.Id, selectEmpreinte.Digital);
                            break;
                        }
                    }
                    else
                    {
                        switch (z._POINTEUSE.Type)
                        {
                        case Constantes.TYPE_IFACE:
                            correct = z.DelUserFace(currentPointeuse.IMachine, selectEmpreinte.Employe.Id.ToString(), selectEmpreinte.Facial);
                            break;

                        default:
                            Utils.WriteLog("Les empreintes faciales ne sont pas integrées dans l'appareil " + currentPointeuse.Ip);
                            break;
                        }
                    }
                }
                if (correct)
                {
                    Utils.WriteLog("---- Suppression effectuée ");
                    ObjectThread o   = new ObjectThread(dgv_empreinte);
                    int          idx = Utils.GetRowData(dgv_empreinte, selectEmpreinte.Id);
                    o.RemoveDataGridView(idx);
                }
                else
                {
                    Utils.WriteLog("---- Suppression échouée ");
                }
            }
        }