Exemplo n.º 1
0
        private void BtnBaja_Click(object sender, EventArgs e)
        {
            try
            {
                //verifico que se hay seleccion en la grilla
                if (DGVCuentas.SelectedRows.Count == 0)
                {
                    LblError.Text = "Debe seleccionar la cuenta a eliminar";
                }

                //determino la cuenta a eliminar
                ServicioWeb.Cuenta _unaCuenta = new PresentacionWin.ServicioWeb.MiServicio().BuscarCuenta(Convert.ToInt32(DGVCuentas.SelectedRows[0].Cells[0].Value));

                //trato de eliminar la cuenta
                if (_unaCuenta == null)
                {
                    throw new Exception("No se encontro la Cuenta para Eliminarla");
                }
                else
                {
                    new PresentacionWin.ServicioWeb.MiServicio().BajaCuenta(_unaCuenta);
                }

                //si llego aca, todo ok
                this.LimpioControles();
                this.ActualizoGrilla();
                this.DesactivoBotones();
                LblError.Text = "Se elimino Exitosamente";
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Detail.InnerText.Length > 40)
                {
                    LblError.Text = ex.Detail.InnerText.Substring(0, 40);
                }
                else
                {
                    LblError.Text = ex.Detail.InnerText;
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Length > 40)
                {
                    LblError.Text = ex.Message.Substring(0, 40);
                }
                else
                {
                    LblError.Text = ex.Message;
                }
            }
        }
Exemplo n.º 2
0
        public void VerificoIngreso(object sender, EventArgs e)
        {
            try
            {
                Empleado _unEmpleado = new PresentacionWin.ServicioWeb.MiServicio().LogueoEmpleado(MiControlLogin.Usuario, MiControlLogin.Contraseña);

                if (_unEmpleado == null)
                {
                    LblError.Text = "CI o Pass Invalidos";
                }
                else
                {
                    this.Hide();
                    Form _unForm = new FrmPrincipal(_unEmpleado);
                    _unForm.ShowDialog();
                    this.Close();
                }
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Detail.InnerText.Length > 40)
                {
                    LblError.Text = ex.Detail.InnerText.Substring(0, 40);
                }
                else
                {
                    LblError.Text = ex.Detail.InnerText;
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Length > 40)
                {
                    LblError.Text = ex.Message.Substring(0, 40);
                }
                else
                {
                    LblError.Text = ex.Message;
                }
            }
        }
Exemplo n.º 3
0
        private void TxtNumero_Validating(object sender, CancelEventArgs e)
        {
            //verifico ingreso de solo numeros
            try
            {
                Convert.ToInt32(TxtNumero.Text);
                EPNumeros.Clear();
            }
            catch (Exception ex)
            {
                EPNumeros.SetError(TxtNumero, "Solo se pueden ingresar numeros");
                e.Cancel = true;
            }

            //busqueda del cliente
            try
            {
                Cliente _unCliente = null;
                _unCliente = new PresentacionWin.ServicioWeb.MiServicio().BuscarCliente(Convert.ToInt32(TxtNumero.Text));
                this.LimpioControles();
                ManejoTelefonosCliente.LimpiarTodo();


                if (_unCliente == null)
                {
                    BtnAlta.Enabled = true;
                }
                else
                {
                    BtnModificar.Enabled = true;
                    BtnBaja.Enabled      = true;
                    _objCliente          = _unCliente;
                    TxtNumero.Text       = _unCliente.NumCli.ToString();
                    TxtNombre.Text       = _unCliente.NomCli;
                    TxtDireccion.Text    = _unCliente.DirCli;
                    TxtUsuario.Text      = _unCliente.UsuCli;
                    TxtPassword.Text     = _unCliente.PassCli;
                    ManejoTelefonosCliente.ListaTelefonos = _unCliente.ListaTelefonos.ToList();;
                }
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Detail.InnerText.Length > 40)
                {
                    LblError.Text = ex.Detail.InnerText.Substring(0, 40);
                }
                else
                {
                    LblError.Text = ex.Detail.InnerText;
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Length > 40)
                {
                    LblError.Text = ex.Message.Substring(0, 40);
                }
                else
                {
                    LblError.Text = ex.Message;
                }
            }
        }