Esempio n. 1
0
        protected void llenarGrid(string nombre, string cedula)
        {
            this.grw_empleados.DataBindings.Clear();
            grw_empleados.Columns.Clear();
            string     mensaje = "";
            EmpleadoTR tran    = new EmpleadoTR();
            DataTable  datos   = tran.consultarEmpleados(ref mensaje, nombre, cedula);

            if (datos != null)
            {
                this.grw_empleados.DataSource         = datos;
                this.grw_empleados.Columns[0].Visible = false;

                int ancho = this.grw_empleados.Width - 20;
                this.grw_empleados.Columns[1].Width = Convert.ToInt16(ancho * 0.15);
                this.grw_empleados.Columns[2].Width = Convert.ToInt16(ancho * 0.35);
                this.grw_empleados.Columns[3].Width = Convert.ToInt16(ancho * 0.25);
                this.grw_empleados.Columns[4].Width = Convert.ToInt16(ancho * 0.25);

                DataGridViewButtonColumn bcol = new DataGridViewButtonColumn();
                bcol.Width      = 20;
                bcol.HeaderText = "";
                bcol.Name       = "botonEditar";
                bcol.UseColumnTextForButtonValue = true;
                //grw_empleado.Columns.Insert(5, bcol);
                this.grw_empleados.Columns.Add(bcol);
            }
            else
            {
                Mensaje.error(mensaje);
            }
        }
Esempio n. 2
0
        private void btn_transportista_Click(object sender, EventArgs e)
        {
            frm_buscar_empleado frmTransportista = new frm_buscar_empleado();
            DialogResult        dr = frmTransportista.ShowDialog(this);

            if (dr == DialogResult.OK)
            {
                this.txt_cedulaTransportista.TextChanged -= txt_cedulaTransportista_TextChanged;
                this.transportista = EmpleadoTR.buscarXId(frmTransportista.idEmpleado);
                this.txt_cedulaTransportista.Text         = this.transportista.cedula;
                this.txt_correoTransportista.Text         = String.IsNullOrEmpty(this.transportista.email) ? "" : this.transportista.email;
                this.txt_nombreTransportista.Text         = this.transportista.razon_social;
                this.txt_cedulaTransportista.TextChanged += txt_cedulaTransportista_TextChanged;
            }
        }
Esempio n. 3
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (!validar())
            {
                return;
            }
            Persona persona = new Persona();

            persona.id            = this.idEmpleado;
            persona.cedula        = txt_cedula.Text;
            persona.razon_social  = txt_nombre.Text;
            persona.telefonos     = txt_telefono.Text;
            persona.email         = txt_email.Text;
            persona.direccion     = txt_direccion.Text;
            persona.tipo_contrato = cmb_contrato.SelectedValue.ToString();
            persona.sueldo        = Convert.ToDecimal(this.txt_sueldo.Text);
            persona.es_empleado   = true;
            persona.es_vendedor   = true;
            persona.tipo          = "N";
            EmpleadoTR tran = new EmpleadoTR(persona);
            string     msn  = "";

            if (estadoGuardar && tran.insertarEmpleado(ref msn)) //guardar
            {
                Mensaje.informacion("Empleado ingresado con éxito.");
                if (this.Owner.GetType() == typeof(frm_usuario))
                {
                    ((frm_usuario)this.Owner).setCedula(persona.cedula);
                    this.Close();
                }
                this.limpiar();
                txt_cedula.Focus();
            }
            else if (!estadoGuardar && tran.actualizarEmpleado(ref msn))
            {
                Mensaje.informacion("Empleado actualizado con éxito.");
                if (this.fila != null)
                {
                    pasarDatos();
                }
                this.limpiar();
                txt_cedula.Focus();
            }
            else
            {
                Mensaje.advertencia(msn);
            }
        }
Esempio n. 4
0
 protected void buscarEmpleado(string cedula)
 {
     try
     {
         Persona persona = EmpleadoTR.buscarXCedula(cedula);
         if (persona != null)
         {
             this.txt_nombre.Text = persona.razon_social;
             this.idEmpleado      = persona.id;
         }
         else
         {
             Mensaje.advertencia("No se encontró el empleado.");
         }
     }
     catch (Exception e)
     {
         Mensaje.error(e.Message);
     }
 }
Esempio n. 5
0
 public void buscarEmpleado(string cedula)
 {
     try
     {
         Persona persona = EmpleadoTR.buscarXCedula(cedula);
         if (persona != null)
         {
             llenarCampos(persona);
             this.idEmpleado = persona.id;
             activarEstadoActualizar();
         }
         else
         {
             Mensaje.advertencia("No se encontró el empleado.");
         }
     }
     catch (Exception e)
     {
         Mensaje.error(e.Message);
     }
 }
Esempio n. 6
0
        protected void llenarGrid(string nombre, int mostrarTodos)
        {
            this.grw_empleados.DataBindings.Clear();
            grw_empleados.Columns.Clear();
            string     mensaje = "";
            EmpleadoTR tran    = new EmpleadoTR();
            DataTable  datos   = tran.consultarEmpleadosIngresados(ref mensaje, nombre, mostrarTodos);

            if (datos != null)
            {
                this.grw_empleados.DataSource = datos;
                int ancho = grw_empleados.Width;
                this.grw_empleados.Columns[0].Visible = false;
                this.grw_empleados.Columns[1].Width   = Convert.ToInt16(ancho * 0.15);
                this.grw_empleados.Columns[2].Width   = Convert.ToInt16(ancho * 0.40);
                this.grw_empleados.Columns[3].Width   = Convert.ToInt16(ancho * 0.30);
                this.grw_empleados.Columns[4].Width   = Convert.ToInt16(ancho * 0.14);
            }
            else
            {
                Mensaje.error(mensaje);
            }
        }