Example #1
0
        //Ingresar Gerente
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                Gerente gerente = new Gerente();
                gerente.Cedula      = Convert.ToInt32(txtCedula.Text);
                gerente.NomUsu      = txtUsuario.Text;
                gerente.Pass        = txtPass.Text;
                gerente.NomCompleto = txtNomApe.Text;
                gerente.Correo      = txtCorreo.Text;

                IServicio serv = new ServicioClient();
                serv.AltaUsuario(gerente, usuLogueado);

                lblMensajes.Text = "Usuario ingresado exitosamente";
                EstadoInicial();
            }
            catch (FormatException)
            {
                lblMensajes.Text = "La cedula debe tener formato numerico";
            }
            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensajes.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensajes.Text = ex.Message;
                }
            }
        }
Example #2
0
        //Ingresar un Cajero
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                Cajero cajero = new Cajero();
                cajero.Cedula      = Convert.ToInt32(txtCedula.Text);
                cajero.NomUsu      = txtUsuario.Text;
                cajero.Pass        = txtPass.Text;
                cajero.NomCompleto = txtNomApe.Text;

                try
                {
                    cajero.HoranIni = Convert.ToDateTime(txtHoraIni.Text);
                    cajero.HoranFin = Convert.ToDateTime(txtHoraFin.Text);
                    if (cajero.HoranFin <= cajero.HoranIni)
                    {
                        throw new Exception("La hora de Fin debe ser mayor a la de inicio");
                    }
                }
                catch (FormatException)
                {
                    lblMensajes.Text = "La hora de inicio y de fin deben ser reales";
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                IServicio serv = new ServicioClient();
                serv.AltaUsuario(cajero, usuLogueado);

                EstadoInicial();
                lblMensajes.Text = "El usuario ingresado exitosamente";
            }
            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensajes.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensajes.Text = ex.Message;
                }
            }
        }