Exemplo n.º 1
0
        //Modificar Empresa
        private void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                empBuscada.Rut       = Convert.ToInt64(txtRut.Text.Trim()).ToString();
                empBuscada.DirFiscal = txtDireccion.Text.Trim();
                empBuscada.Telefono  = txtTelefono.Text.Trim();

                IServicio serv = new ServicioClient();
                serv.ModificarEmpresa(empBuscada, usuLogueado);
                lblMensajes.Text = "Empresa Modificada con exito";
                LimpiarCampos();
            }

            catch (FormatException)
            {
                lblMensajes.Text = "El Código y Rut de la Empresa deben ser numéricos";
            }

            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensajes.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensajes.Text = ex.Message;
                }
            }
        }
        public HttpResponseMessage Delete(int id)
        {
            var msg = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
            RegistroInspeccionVisualRequest  registro  = new RegistroInspeccionVisualRequest();
            RegistroInspeccionVisualResponse resultado = null;
            var proxy = new ServicioClient();

            try
            {
                try
                {
                    registro.Item.Id   = id;
                    registro.Operacion = Model.Operacion.Eliminar;
                    resultado          = proxy.RegistroInspeccionVisualEjecutarOperacion(registro);
                }
                catch (Exception ex)
                {
                    resultado.MensajeError = ex.Message;
                }
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
        }
Exemplo n.º 3
0
        private void ManejarProxy()
        {
            switch (Proxy.State)
            {
            case CommunicationState.Created:
                Proxy.Open();
                break;

            case CommunicationState.Opening:
                break;

            case CommunicationState.Opened:
                break;

            case CommunicationState.Closing:
            case CommunicationState.Closed:
            case CommunicationState.Faulted:
                Proxy = null;
                Proxy.Open();
                break;

            default:
                break;
            }
        }
        public HttpResponseMessage Put([FromBody] RegistroInspeccionVisual editarTuberia)
        {
            var msg = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
            RegistroInspeccionVisualRequest  registro  = new RegistroInspeccionVisualRequest();
            RegistroInspeccionVisualResponse resultado = null;
            var proxy = new ServicioClient();

            if (ModelState.IsValid)
            {
                if (editarTuberia != null && editarTuberia.CodigoDelTubo != string.Empty)
                {
                    try
                    {
                        registro.Item      = editarTuberia;
                        registro.Operacion = Model.Operacion.Actualizar;
                        resultado          = proxy.RegistroInspeccionVisualEjecutarOperacion(registro);
                    }
                    catch (Exception ex)
                    {
                        resultado.MensajeError = ex.Message;
                    }
                    return(Request.CreateResponse <Model.RegistroInspeccionVisual>(HttpStatusCode.OK, editarTuberia));
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
            }
            else
            {
                return(msg);
            }
        }
Exemplo n.º 5
0
        //Cambiar contraseña de usuario
        private void btnCambiar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNuevaPass.Text == txtRepitePass.Text)
                {
                    Usuario usuCambiado = new Usuario();
                    usuCambiado.Cedula      = usuLogueado.Cedula;
                    usuCambiado.NomUsu      = usuLogueado.NomUsu;
                    usuCambiado.NomCompleto = usuLogueado.NomCompleto;
                    usuCambiado.Pass        = txtNuevaPass.Text;

                    IServicio serv = new ServicioClient();
                    serv.CambioPass(usuCambiado, usuLogueado);
                    LimpiarCampos();
                    usuLogueado.Pass = usuCambiado.Pass;
                    lblMensajes.Text = "Contraseña actualizada con exito";
                }
                else
                {
                    throw new Exception("La nueva contraseña ingresada no coincide");
                }
            }
            catch (Exception ex)
            { lblMensajes.Text = ex.Message; }
        }
Exemplo n.º 6
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;
                }
            }
        }
Exemplo n.º 7
0
        public UsuarioViewModel GetUsuarioByID(int id, ref string error)
        {
            UsuarioViewModel resultado = null;

            try
            {
                UsuarioResponse response;
                var             reqobj = new Usuario()
                {
                    Id = id
                };
                var req = new UsuarioRequest()
                {
                    Item = reqobj
                };
                using (var proxy = new ServicioClient())
                {
                    response = proxy.UsuarioBuscarEntidad(req);
                }
                if (response.Item == null)
                {
                    error = "Usuario no valido";
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(resultado);
        }
        public HttpResponseMessage Post([FromBody] RegistroInspeccionVisual nuevoTuberia)
        {
            var msg = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
            RegistroInspeccionVisualRequest  registro  = new RegistroInspeccionVisualRequest();
            RegistroInspeccionVisualResponse resultado = null;
            var proxy = new ServicioClient();

            if (ModelState.IsValid)
            {
                try
                {
                    registro.Item      = nuevoTuberia;
                    registro.Operacion = Model.Operacion.Agregar;
                    resultado          = proxy.RegistroInspeccionVisualEjecutarOperacion(registro);
                }
                catch (Exception ex)
                {
                    resultado.MensajeError = ex.Message;
                }

                if (nuevoTuberia == null || nuevoTuberia.CodigoDelTubo == string.Empty)
                {
                    return(msg);
                }

                msg = new HttpResponseMessage(HttpStatusCode.Created);
                msg.Headers.Location = new Uri(Request.RequestUri + nuevoTuberia.Id.ToString());
            }
            return(msg);
        }
Exemplo n.º 9
0
        public bool Delete(ref string error, int id)
        {
            UsuarioResponse response = null;

            try
            {
                var obj = new Usuario()
                {
                    Id = id
                };
                var objReq = new UsuarioRequest
                {
                    Item      = obj,
                    Operacion = Operacion.Eliminar
                };
                using (var proxy = new ServicioClient())
                {
                    response = proxy.UsuarioEjecutarOperacion(objReq);
                }
                error = !response.Resultado ? response.MensajeError : "";
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(response != null && response.Resultado);
        }
Exemplo n.º 10
0
        //Ingresar Empresa
        private void btnIngresar_Click_1(object sender, EventArgs e)
        {
            try
            {
                Empresa emp = new Empresa();
                emp.Codigo    = Convert.ToInt32(txtCodigo.Text.Trim());
                emp.Rut       = Convert.ToInt64(txtRut.Text.Trim()).ToString();
                emp.DirFiscal = txtDireccion.Text.Trim();
                emp.Telefono  = txtTelefono.Text.Trim();

                IServicio serv = new ServicioClient();
                serv.AltaEmpresa(emp, usuLogueado);

                lblMensajes.Text = "Empresa ingresada exitosamente";

                LimpiarCampos();
            }

            catch (FormatException)
            {
                lblMensajes.Text = "El Código y Rut de la Empresa deben ser numéricos";
            }

            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensajes.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensajes.Text = ex.Message;
                }
            }
        }
Exemplo n.º 11
0
        public HttpResponseMessage Post([FromBody] CambiosTuberia registro)
        {
            var msg = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
            CambiosTuberiaRequest  RegistroRequest = new CambiosTuberiaRequest();
            CambiosTuberiaResponse resultado       = null;
            var proxy = new ServicioClient();

            if (ModelState.IsValid)
            {
                try
                {
                    RegistroRequest.Item      = registro;
                    RegistroRequest.Operacion = Model.Operacion.Agregar;
                    resultado = proxy.CambiosTuberiaEjecutarOperacion(RegistroRequest);
                    if (resultado.Item == null)
                    {
                        resultado.Resultado    = false;
                        resultado.MensajeError = "Error en el registro de datos";
                        throw (new Exception(resultado.MensajeError));
                    }
                }
                catch (Exception ex)
                {
                    resultado.MensajeError = ex.Message;
                }
            }
            else
            {
                resultado.MensajeError = "Error en el ingreso de Datos";
            }
            msg = new HttpResponseMessage(HttpStatusCode.Created);
            msg.Headers.Location = new Uri(Request.RequestUri + resultado.Item.Id.ToString());
            return(msg);
        }
Exemplo n.º 12
0
        public UsuarioViewModel Create(UsuarioViewModel toCreate, ref string error)
        {
            UsuarioViewModel resultado = null;

            try
            {
                var             request = toCreate.ConvertToModel();
                UsuarioResponse response;

                var objReq = new UsuarioRequest
                {
                    Item      = request,
                    Operacion = Operacion.Agregar
                };
                using (var proxy = new ServicioClient())
                {
                    response = proxy.UsuarioEjecutarOperacion(objReq);
                }
                if (!response.Resultado)
                {
                    error = response.MensajeError;
                    return(null);
                }
                resultado = response.Item.ConvertToViewModel();
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            return(resultado);
        }
Exemplo n.º 13
0
        public HttpResponseMessage Put([FromBody] Model.Oleoducto editarDucto)
        {
            var msg = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
            OleoductoRequest  registro  = new OleoductoRequest();
            OleoductoResponse resultado = null;
            var proxy = new ServicioClient();

            if (ModelState.IsValid)
            {
                try
                {
                    registro.Item      = editarDucto;
                    registro.Operacion = Model.Operacion.Actualizar;
                    resultado          = proxy.OleoductoEjecutarOperacion(registro);
                }
                catch (Exception ex)
                {
                    resultado.MensajeError = ex.Message;
                }
            }
            else
            {
                resultado.MensajeError = "Error en el ingreso de Datos";
            }
            msg = new HttpResponseMessage(HttpStatusCode.Created);
            msg.Headers.Location = new Uri(Request.RequestUri + editarDucto.Id.ToString());
            return(msg);
        }
Exemplo n.º 14
0
    protected void btnEnviar_Click(object sender, EventArgs e)
    {
        string nomUsu = txtNombreUsr.Text;
        string contra = txtContra.Text;

        try
        {
            Usuario usu = new ServicioClient().LogueoUsuario(nomUsu, contra);

            if (usu != null)
            {
                if (usu is UsuarioEmpresa)
                {
                    Session["Usuario"] = (UsuarioEmpresa)usu;
                    Response.Redirect("HomeEmpresa.aspx");
                }
                else
                {
                    Session["Usuario"] = (UsuarioEmpleado)usu;
                    Response.Redirect("HomeEmpleado.aspx");
                }
            }
            else
            {
                throw new Exception("No se ha encontrado el usuario");
            }
        }
        catch (Exception ex)
        {
            lblMensaje.Text = ex.Message;
        }
    }
Exemplo n.º 15
0
        //Validar los 2 campos (Código de Empresa y Tipo de Contrato)
        private void txtCodTipoContrato_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                if (txtCodEmpresa.Text.Trim() != "" && txtCodEmpresa.Text.Trim().Length <= 4 && txtCodTipoContrato.Text.Trim() != "" && txtCodTipoContrato.Text.Trim().Length <= 2)
                {
                    EPTipoContrato.Clear();
                }
                else
                {
                    throw new Exception("El codigo de Empresa debe tener entre 1 y 4 dígitos y el CodContrato entre 1 y 2");
                }
            }
            catch (Exception ex)
            {
                EPTipoContrato.SetError(txtCodEmpresa, ex.Message);
                e.Cancel = true;
                return;
            }

            try
            {
                lblMensaje.Text = "";
                IServicio serv = new ServicioClient();

                //Busco el tipo de contrato
                TipoContratoBuscado = serv.BuscarContrato(Convert.ToInt32(txtCodEmpresa.Text), Convert.ToInt32(txtCodTipoContrato.Text), usuLogueado);

                if (TipoContratoBuscado != null)
                {
                    HabilitarBotones();
                    txtNombre.Text             = TipoContratoBuscado.Nombre;
                    txtCodEmpresa.Enabled      = false;
                    txtCodTipoContrato.Enabled = false;
                    btnIngresar.Enabled        = false;
                }
                else
                {
                    btnIngresar.Enabled = true;
                }
            }

            catch (FormatException)
            {
                lblMensaje.Text = ("El codigo de Emprasa y de Contratos deben ser numéricos");
            }

            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensaje.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensaje.Text = ex.Message;
                }
            }
        }
        public HttpResponseMessage Get(int id = 1)
        {
            ServicioClient proxy = new ServicioClient();
            string         error = String.Empty;
            RegistroInspeccionVisualResponse listado = proxy.RegistroInspeccionVisualListarEntidad(id, "", 1, 8);
            var result = Request.CreateResponse <RegistroInspeccionVisualResponse>(HttpStatusCode.OK, listado);

            return(result);
        }
Exemplo n.º 17
0
        public HttpResponseMessage GetOleoductos(string name, int page, int records)
        {
            var proxy = new ServicioClient();
            var error = String.Empty;
            OleoductoResponse listado = proxy.OleoductoListarEntidad(name, page, records);
            var result = Request.CreateResponse <OleoductoResponse>(HttpStatusCode.OK, listado);

            return(result);
        }
Exemplo n.º 18
0
        public HttpResponseMessage Listado(int n = 1, int f = 8, string search = null)
        {
            ServicioClient    proxy   = new ServicioClient();
            string            error   = String.Empty;
            OleoductoResponse listado = proxy.OleoductoListarEntidad(search, n, f);
            var result = Request.CreateResponse <OleoductoResponse>(HttpStatusCode.OK, listado);

            return(result);
        }
Exemplo n.º 19
0
        public HttpResponseMessage Get()
        {
            var proxy = new ServicioClient();
            var error = String.Empty;
            OleoductoResponse listado = proxy.OleoductoListarEntidad("", 1, 8);
            var result = Request.CreateResponse <OleoductoResponse>(HttpStatusCode.OK, listado);

            return(result);
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            var proxy = new ServicioClient();

            InvocarFuncion(proxy.GetDataUsingDataContract, new CompositeType());
            InvocarFuncion(proxy.GetDataErrorValidacion, 1);
            InvocarFuncion(proxy.GetDataErrorRegla, 2);

            Console.ReadLine();
        }
Exemplo n.º 21
0
        //Agregar facturas al GridView
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                //Capturo el codEmp y codTipoContrato de la facutra ingresada por el usuario
                int codEmp          = Convert.ToInt32(txtCodBarra.Text.Substring(0, 4).TrimStart('0'));
                int codTipoContrato = Convert.ToInt32(txtCodBarra.Text.Substring(4, 2).TrimStart('0'));

                IServicio serv = new ServicioClient();

                //Si no existe tipo de contrato salgo
                TipoContrato unContrato = serv.BuscarContrato(codEmp, codTipoContrato, usuLogueado);
                if (unContrato == null)
                {
                    throw new Exception("El tipo de contrato no existe");
                }

                Factura unaFactura = new Factura();

                //Agrego datos a la factura
                unaFactura.UnTipoContrato = unContrato;
                unaFactura.Monto          = Convert.ToInt32(txtMonto.Text);
                unaFactura.CodCli         = Convert.ToInt32(txtCodCli.Text);
                var fechaFactura = DateTime.ParseExact(txtCodBarra.Text.Substring(6, 8).TrimStart('0').ToString(),
                                                       "yyyyMMdd",
                                                       CultureInfo.InvariantCulture);
                unaFactura.FechaVto = fechaFactura;

                //Si la factura esta vencida salgo
                if (fechaFactura < DateTime.Today)
                {
                    throw new Exception("La factura esta vencida");
                }

                //Agrego a la lista de facturas
                lasFacturas.Add(unaFactura);

                //Agrego al Grid
                DataRow dr = this.dt.NewRow();
                dr["Rut Emp"]      = txtCodEmp.Text;
                dr["Cod Contrato"] = txtTipoContrato.Text;
                dr["Fecha Vto"]    = txtFVencimiento.Text;
                dr["Cod Cli"]      = txtCodCli.Text;
                dr["Monto"]        = txtMonto.Text;

                dt.Rows.Add(dr);

                //Limpio los dato de la factura
                LimpiarDatosFactura();
            }
            catch (Exception ex)
            {
                lblMensaje.Text = "Error: " + ex.Message;
            }
        }
Exemplo n.º 22
0
        //Valida código de Empresa
        private void txtCodigo_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                if (txtCodigo.Text.Trim() != "" && txtCodigo.Text.Trim().Length <= 4)
                {
                    EPCodigoEmp.Clear();
                }
                else
                {
                    throw new Exception("El código de empresa debe tener entre 1 y 4 dígitos");
                }
            }

            catch (Exception ex)
            {
                EPCodigoEmp.SetError(txtCodigo, ex.Message);
                e.Cancel = true;
                return;
            }

            try
            {
                IServicio serv = new ServicioClient();

                //Busco empresa
                empBuscada = serv.BuscarEmpresa(Convert.ToInt32(txtCodigo.Text), usuLogueado);

                if (empBuscada != null)
                {
                    txtCodigo.Text    = empBuscada.Codigo.ToString();
                    txtRut.Text       = empBuscada.Rut.ToString();
                    txtDireccion.Text = empBuscada.DirFiscal;
                    txtTelefono.Text  = empBuscada.Telefono;
                    HabilitarBotones();
                    txtCodigo.Enabled = false;
                }
                else
                {
                    btnIngresar.Enabled = true;
                }
            }

            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensajes.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensajes.Text = ex.Message;
                }
            }
        }
Exemplo n.º 23
0
        private async Task prepareProxy()
        {
            proxy = null;
            // Checks and set current status of proxy method
            await HandleProxy();
            // if the proxy is opened, the proxy is ready to use
            if (!(proxy.State == CommunicationState.Opened)) {
                throw new Exception("el servicio no está disponible.");
            }

        }
        public PianoWSDuplexClient()
        {
            HostName = Dns.GetHostName();
            _context = new InstanceContext(this);
            _proxy = new ServicioClient(_context);

            _proxy.IniciarSesionCompleted += new EventHandler<IniciarSesionCompletedEventArgs>(_proxy_IniciarSesionCompleted);
            _proxy.FinalizarSesionCompleted += new EventHandler<FinalizarSesionCompletedEventArgs>(_proxy_FinalizarSesionCompleted);
            _proxy.PublicarNotaCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(_proxy_PublicarNotaCompleted);
            _proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);
        }
        public HttpResponseMessage GetTuberia(int oleoductoid, string name, int page, int records)
        {
            ServicioClient proxy = new ServicioClient();
            string         error = String.Empty;
            RegistroInspeccionVisualResponse listado = proxy.RegistroInspeccionVisualListarEntidad(oleoductoid, name, page, records);

            listado.ListTipoSoporte = proxy.TipoSoporteListarAllEntidad();
            var result = Request.CreateResponse <RegistroInspeccionVisualResponse>(HttpStatusCode.OK, listado);

            return(result);
        }
Exemplo n.º 26
0
        public bool ValidaRolconAccion(int rolid, string controller)
        {
            //IEnumerable<UsuarioViewModel> resultado = null;
            bool response;

            using (var proxy = new ServicioClient())
            {
                response = proxy.ValidaRolconAccion(rolid, controller);
            }

            return(response);
        }
Exemplo n.º 27
0
    //Buscar Factura
    protected void btnBuscar_Click(object sender, EventArgs e)
    {
        try
        {
            IServicio serv = new ServicioClient();

            if (txtCodBarra.Text.Length != 25 || txtCodBarra.Text == "")
            {
                QuitarControles();
                throw new Exception("El código de barras debe contener 25 números");
            }

            int      codEmp          = Convert.ToInt32(txtCodBarra.Text.Substring(0, 4).TrimStart('0'));
            int      codTipoContrato = Convert.ToInt32(txtCodBarra.Text.Substring(4, 2).TrimStart('0'));
            DateTime fechaFactura    = new DateTime();
            try
            {
                fechaFactura = DateTime.ParseExact(txtCodBarra.Text.Substring(6, 8).TrimStart('0').ToString(),
                                                   "yyyyMMdd",
                                                   CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                QuitarControles();
                throw new Exception("La fecha no tiene un formato corecto");
            }
            int codCli = Convert.ToInt32(txtCodBarra.Text.Substring(14, 6).TrimStart('0'));
            int monto  = Convert.ToInt32(txtCodBarra.Text.Substring(20, 5).TrimStart('0'));

            //Armo el pago para buscar
            //DateTime fechaDeUnPago = serv.PagoDeUnaFactura(codTipoContrato, codEmp, monto, codCli, fechaFactura);
            DateTime fechaDeUnPago = serv.PagoDeUnaFactura(codTipoContrato, codEmp, monto, codCli, fechaFactura);

            //Si el pago existe muestro los controles con los datos
            if (fechaDeUnPago.ToString() != "01/01/0001 0:00:00")
            {
                MostrarControles();
                txtFecha.Text   = fechaDeUnPago.ToShortDateString();
                lblMensaje.Text = "";
            }
            else
            {
                QuitarControles();
                throw new Exception("No existe un pago asociado a la factura ingresada");
            }
        }
        catch (Exception ex)
        {
            lblMensaje.Text = ex.Message;
        }
    }
Exemplo n.º 28
0
        //Validar el Cajero por la cédula
        private void txtCedula_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                Convert.ToInt32(txtCedula.Text);
                epCedula.Clear();
            }
            catch (Exception)
            {
                epCedula.SetError(txtCedula, "La cedula debe ser numerica");
                e.Cancel = true;
                return;
            }

            try
            {
                IServicio serv = new ServicioClient();
                usuBuscado = serv.BuscarUsuario(Convert.ToInt32(txtCedula.Text), usuLogueado);

                if (usuBuscado != null)
                {
                    txtCedula.Text  = usuBuscado.Cedula.ToString();
                    txtUsuario.Text = usuBuscado.NomUsu;
                    txtNomApe.Text  = usuBuscado.NomCompleto;
                    txtPass.Text    = usuBuscado.Pass.ToString();
                    txtHoraIni.Text = TimeSpan.Parse(((Cajero)usuBuscado).HoranIni.ToShortTimeString()).ToString();
                    txtHoraFin.Text = TimeSpan.Parse(((Cajero)usuBuscado).HoranFin.ToShortTimeString()).ToString();

                    btnEliminar.Enabled  = true;
                    btnModificar.Enabled = true;
                    txtCedula.Enabled    = false;
                    txtUsuario.Enabled   = false;
                    txtPass.Enabled      = false;
                }
                else
                {
                    btnIngresar.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Length > 80)
                {
                    lblMensajes.Text = ex.Message.Substring(0, 80);
                }
                else
                {
                    lblMensajes.Text = ex.Message;
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         UsuarioEmpleado usuemp   = (UsuarioEmpleado)Session["Usuario"];
         List <Paquete>  listapaq = new ServicioClient().ListarPaquetesSinSolicitud(usuemp).ToList();
         grvListPaquetes.DataSource = listapaq;
         grvListPaquetes.DataBind();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         UsuarioEmpresa          usuemp   = (UsuarioEmpresa)Session["Usuario"];
         List <SolicitudEntrega> listasol = new ServicioClient().ListarSolicitudEntregaEmpresaLogueada(usuemp).ToList();
         Session["listaSolEmpresa"] = listasol;
         grvSolEmpresa.DataSource   = listasol;
         grvSolEmpresa.DataBind();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Exemplo n.º 31
0
        //Ingresar pago
        private void ingresarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                IServicio serv = new ServicioClient();

                try
                {   //Si hay facturas ingresadas
                    if (lasFacturas.Count != 0)
                    {
                        Pago unPago = new Pago();

                        unPago.NumeroInt   = 0;
                        unPago.MontoTotal  = Convert.ToInt32(txtMontoTotal.Text);
                        unPago.Fecha       = DateTime.Today;
                        unPago.LasFacturas = lasFacturas.ToArray();
                        unPago.UsuCajero   = usuLogueado;

                        //Alto el pago
                        serv.AltaPago(unPago, usuLogueado);

                        //Limpio los controles
                        LimpiarDatosFactura();
                        gvListaFacturas.Columns.Clear();
                        lasFacturas.Clear();
                        txtMontoTotal.Text = "";

                        dt = new DataTable();
                        CargarColumnasGridView();

                        lblMensaje.Text = "Pago agregado correctamente";
                    }
                    else
                    {
                        throw new Exception("El pago debe contener al menos una factura");
                    }
                }
                catch (Exception ex)
                {
                    lblMensaje.Text = "Error: " + ex.Message;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text = "Error: " + ex.Message;
            }
        }
Exemplo n.º 32
0
        static void Main(string[] args)
        {
            try
            {
                Proxy.ServicioClient proxy = new ServicioClient();
                proxy.ClientCredentials.UserName.UserName = "******";
                proxy.ClientCredentials.UserName.Password = "******";

                var r = proxy.GetData(10);

                Console.WriteLine(r);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("fin");
            Console.ReadLine();
        }