コード例 #1
0
        private void btnEnviarInclusaoSupervisores_Click(object sender, EventArgs e)
        {
            List <FaceHanvonMaster> supervisores = new List <FaceHanvonMaster>();

            try
            {
                InstanciaWatchComm();

                foreach (DataRow dr in this._dtSupervisores)
                {
                    FaceHanvonMaster supervisor = new FaceHanvonMaster();

                    supervisor.Id         = Int32.Parse(dr["ID"].ToString());
                    supervisor.Name       = dr["Nome"].ToString();
                    supervisor.Password   = dr["Senha"].ToString();
                    supervisor.CardNumber = dr["Cartao"].ToString();
                    supervisor.Face       = dr["Face"].ToString();

                    if (dr["TipoAutenticacao"].ToString().ToUpper() == "Cartão e Face".ToUpper())
                    {
                        supervisor.EnterType = FaceHanvonMasterEnterType.CardAndFace;
                    }
                    else if (dr["TipoAutenticacao"].ToString().ToUpper() == "ID e Face".ToUpper())
                    {
                        supervisor.EnterType = FaceHanvonMasterEnterType.IdAndFace;
                    }
                    else if (dr["TipoAutenticacao"].ToString().ToUpper() == "ID e Senha".ToUpper())
                    {
                        supervisor.EnterType = FaceHanvonMasterEnterType.IdAndPassword;
                    }
                    else
                    {
                        MessageBox.Show("Tipo de Autenticação Inválida." + Environment.NewLine +
                                        "Informe uma dentre os possíveis valores:" + Environment.NewLine +
                                        "Cartão e Face" + Environment.NewLine +
                                        "ID e Face" + Environment.NewLine +
                                        "ID e Senha", "Envio de Supervisores", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        return;
                    }

                    supervisores.Add(supervisor);
                }

                this._watchComm.SetFaceHanvonMaster(supervisores.ToArray());
            }
            catch (Exception ex)
            {
                ErroDuranteRecepcaoDoComando(ex);

                return;
            }

            ComandoRecepcionadoComSucesso();
        }
コード例 #2
0
        private void btnObterSupervisores_Click(object sender, EventArgs e)
        {
            FaceHanvonMaster[] supervisores;

            try
            {
                this._dtSupervisores.Rows.Clear();

                InstanciaWatchComm();

                if (rdbObbterSupervisorEspecifico.Checked)
                {
                    supervisores    = new FaceHanvonMaster[1];
                    supervisores[0] = this._watchComm.GetFaceHanvonMaster(Int32.Parse(txtIDSupervisorEspecifico.Text));
                }
                else
                {
                    supervisores = this._watchComm.GetAllFaceHanvonMaster();
                }

                foreach (FaceHanvonMaster supervisor in supervisores)
                {
                    DataRow dr = this._dtSupervisores.NewRow();

                    dr["ID"]     = supervisor.Id;
                    dr["Nome"]   = supervisor.Name;
                    dr["Senha"]  = supervisor.Password;
                    dr["Cartao"] = supervisor.CardNumber;
                    dr["Face"]   = supervisor.Face;

                    if (supervisor.EnterType == FaceHanvonMasterEnterType.CardAndFace)
                    {
                        dr["TipoAutenticacao"] = "Cartão e Face";
                    }
                    else if (supervisor.EnterType == FaceHanvonMasterEnterType.IdAndFace)
                    {
                        dr["TipoAutenticacao"] = "ID e Face";
                    }
                    else
                    {
                        dr["TipoAutenticacao"] = "ID e Senha";
                    }

                    this._dtSupervisores.Rows.Add(dr);
                }

                ComandoRecepcionadoComSucesso();
            }
            catch (Exception ex)
            {
                ErroDuranteRecepcaoDoComando(ex);
            }
        }