Exemple #1
0
        private void frmPerfiles_Load(object sender, EventArgs e)
        {
            /// _tipoOperacion CONSULTA = 1, EDICION = 2
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                ph             = new Perfil.Core.PerfilesHelper();
                ph.Command     = cmd;

                Perfil.Core.Perfiles p = new Perfil.Core.Perfiles();
                p.idperfil = _idperfil;
                List <Perfil.Core.Perfiles> lstPerfil;

                Autorizaciones.Core.Autorizacion auth = new Autorizaciones.Core.Autorizacion();
                auth.idperfil = _idperfil;
                List <Autorizaciones.Core.Autorizacion> lstAutorizacion;

                try
                {
                    cnx.Open();
                    lstPerfil = ph.obtenerPerfile(p);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstPerfil.Count; i++)
                    {
                        txtNombre.Text = lstPerfil[i].nombre;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta Perfil";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                }
                else
                {
                    toolTitulo.Text = "Edición Perfil";
                }
            }
        }
Exemple #2
0
        private void CargaPerfil()
        {
            List <Autorizaciones.Core.Ediciones> lstEdiciones = GLOBALES.PERFILEDICIONES("Complementos");

            for (int i = 0; i < lstEdiciones.Count; i++)
            {
                switch (lstEdiciones[i].nombre.ToString())
                {
                case "Complementos":
                    toolNuevo.Enabled     = Convert.ToBoolean(lstEdiciones[i].crear);
                    toolConsultar.Enabled = Convert.ToBoolean(lstEdiciones[i].consulta);
                    toolEditar.Enabled    = Convert.ToBoolean(lstEdiciones[i].modificar);
                    break;
                }
            }
        }
Exemple #3
0
        private void frmSalario_Load(object sender, EventArgs e)
        {
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                sh             = new Salario.Core.SalariosHelper();
                sh.Command     = cmd;

                Salario.Core.Salarios salario = new Salario.Core.Salarios();
                salario.idsalario = _idsalario;

                List <Salario.Core.Salarios> lstSalario;

                try
                {
                    cnx.Open();
                    lstSalario = sh.obtenerSalario(salario);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstSalario.Count; i++)
                    {
                        dtpPeriodo.Value = lstSalario[i].periodo;
                        txtValor.Text    = lstSalario[i].valor.ToString();
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta salario mínimo";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                }
                else
                {
                    toolTitulo.Text = "Edición salario mínimo";
                }
            }
        }
Exemple #4
0
        private void frmDepartamentos_Load(object sender, EventArgs e)
        {
            /// _tipoOperacion CONSULTA = 1, EDICION = 2
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                dh             = new Departamento.Core.DeptoHelper();
                dh.Command     = cmd;

                Departamento.Core.Depto d = new Departamento.Core.Depto();
                d.id = _iddepartamento;

                List <Departamento.Core.Depto> lstDepto;

                try
                {
                    cnx.Open();
                    lstDepto = dh.obtenerDepartamento(d);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstDepto.Count; i++)
                    {
                        txtDescripcion.Text = lstDepto[i].descripcion;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta Departamento";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                }
                else
                {
                    toolTitulo.Text = "Edición Departamento";
                }
            }
        }
Exemple #5
0
        private void frmFactores_Load(object sender, EventArgs e)
        {
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                fh             = new Factores.Core.FactoresHelper();
                fh.Command     = cmd;

                Factores.Core.Factores factor = new Factores.Core.Factores();
                factor.idfactor = _idfactor;

                List <Factores.Core.Factores> lstFactor;

                try
                {
                    cnx.Open();
                    lstFactor = fh.obtenerFactor(factor);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstFactor.Count; i++)
                    {
                        txtAnio.Text  = lstFactor[i].anio.ToString();
                        txtValor.Text = lstFactor[i].valor.ToString();
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta factor de integración";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                }
                else
                {
                    toolTitulo.Text = "Edición factor de integración";
                }
            }
        }
Exemple #6
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            control = GLOBALES.VALIDAR(this, typeof(MaskedTextBox));
            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            int idempresa;

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            eh             = new Empresas.Core.EmpresasHelper();
            eh.Command     = cmd;

            Empresas.Core.Empresas em = new Empresas.Core.Empresas();
            em.nombre            = txtNombre.Text;
            em.rfc               = txtRfc.Text;
            em.registro          = txtRegistroPatronal.Text;
            em.digitoverificador = int.Parse(txtDigitoVerificador.Text);
            em.sindicato         = Convert.ToInt32(chkEsSindicato.Checked);
            em.representante     = txtRepresentante.Text;
            em.activo            = 1;

            dh         = new Direccion.Core.DireccionesHelper();
            dh.Command = cmd;

            Direccion.Core.Direcciones d = new Direccion.Core.Direcciones();
            d.calle         = txtCalle.Text;
            d.exterior      = txtExterior.Text;
            d.interior      = txtInterior.Text;
            d.colonia       = txtColonia.Text;
            d.ciudad        = txtMunicipio.Text;
            d.estado        = txtEstado.Text;
            d.pais          = txtPais.Text;
            d.cp            = txtCP.Text;
            d.tipodireccion = GLOBALES.dFISCAL;
            d.tipopersona   = GLOBALES.pEMPRESA;

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    MySqlCommand lastId = eh.insertaEmpresa(em);
                    long         Id     = lastId.LastInsertedId;
                    idempresa   = (int)eh.obtenerIdEmpresa(em);
                    d.idpersona = idempresa;
                    dh.insertaDireccion(d);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar la empresa. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    em.idempresa  = _idempresa;
                    d.iddireccion = _iddireccion;
                    d.idpersona   = _idempresa;
                    cnx.Open();
                    eh.actualizaEmpresa(em);
                    dh.actualizaDireccion(d);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar la empresa. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                GLOBALES.LIMPIAR(this, typeof(MaskedTextBox));
                //limpiar(this, typeof(TextBox));
                break;

            case 1:
                if (OnNuevaEmpresa != null)
                {
                    OnNuevaEmpresa(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #7
0
        private void frmEmpresas_Load(object sender, EventArgs e)
        {
            /// _tipoOperacion CONSULTA = 1, EDICION = 2
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                eh             = new Empresas.Core.EmpresasHelper();
                eh.Command     = cmd;

                dh         = new Direccion.Core.DireccionesHelper();
                dh.Command = cmd;

                Direccion.Core.Direcciones d = new Direccion.Core.Direcciones();
                d.idpersona   = _idempresa;
                d.tipopersona = 0; ///TIPO PERSONA 0 - Empresas
                List <Empresas.Core.Empresas>     lstEmpresa;
                List <Direccion.Core.Direcciones> lstDireccion;

                try
                {
                    cnx.Open();
                    lstEmpresa   = eh.obtenerEmpresa(_idempresa);
                    lstDireccion = dh.obtenerDireccion(d);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstEmpresa.Count; i++)
                    {
                        txtNombre.Text            = lstEmpresa[i].nombre;
                        txtRepresentante.Text     = lstEmpresa[i].representante;
                        txtRfc.Text               = lstEmpresa[i].rfc;
                        txtRegistroPatronal.Text  = lstEmpresa[i].registro;
                        txtDigitoVerificador.Text = lstEmpresa[i].digitoverificador.ToString();
                        chkEsSindicato.Checked    = Convert.ToBoolean(lstEmpresa[i].sindicato);
                    }

                    for (int i = 0; i < lstDireccion.Count; i++)
                    {
                        _iddireccion      = lstDireccion[i].iddireccion;
                        txtCalle.Text     = lstDireccion[i].calle;
                        txtExterior.Text  = lstDireccion[i].exterior;
                        txtInterior.Text  = lstDireccion[i].interior;
                        txtColonia.Text   = lstDireccion[i].colonia;
                        txtCP.Text        = lstDireccion[i].cp;
                        txtMunicipio.Text = lstDireccion[i].ciudad;
                        txtEstado.Text    = lstDireccion[i].estado;
                        txtPais.Text      = lstDireccion[i].pais;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta Empresa";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                    GLOBALES.INHABILITAR(this, typeof(MaskedTextBox));
                    GLOBALES.INHABILITAR(this, typeof(CheckBox));
                }
                else
                {
                    toolTitulo.Text = "Edición Empresa";
                }
            }
        }
Exemple #8
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            sh             = new Salario.Core.SalariosHelper();
            sh.Command     = cmd;

            Salario.Core.Salarios salario = new Salario.Core.Salarios();
            salario.periodo = dtpPeriodo.Value;
            salario.valor   = decimal.Parse(txtValor.Text.Trim());

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    sh.insertaSalario(salario);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar el salario. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    salario.idsalario = _idsalario;
                    cnx.Open();
                    sh.actualizaSalario(salario);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar el salario. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                GLOBALES.REFRESCAR(this, typeof(DateTimePicker));
                //limpiar(this, typeof(TextBox));
                break;

            case 1:
                if (OnNuevoSalario != null)
                {
                    OnNuevoSalario(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #9
0
        private void toolGuardar_Click(object sender, EventArgs e)
        {
            //SE VALIDA SI TODOS LOS CAMPOS HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            control = GLOBALES.VALIDAR(this, typeof(MaskedTextBox));
            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            ch             = new Complementos.Core.ComplementoHelper();
            dh             = new Direccion.Core.DireccionesHelper();
            ch.Command     = cmd;
            dh.Command     = cmd;

            Direccion.Core.Direcciones d = new Direccion.Core.Direcciones();
            d.idpersona     = _idEmpleado;
            d.calle         = txtCalle.Text;
            d.exterior      = txtExterior.Text;
            d.interior      = txtInterior.Text;
            d.cp            = txtCP.Text;
            d.colonia       = txtColonia.Text;
            d.ciudad        = txtMunicipio.Text;
            d.estado        = txtEstado.Text;
            d.pais          = txtPais.Text;
            d.tipodireccion = 2;
            d.tipopersona   = 2;

            Complementos.Core.Complemento c = new Complementos.Core.Complemento();
            c.idtrabajador   = _idEmpleado;
            c.contrato       = cmbContrato.SelectedValue.ToString();
            c.jornada        = cmbJornada.SelectedValue.ToString();
            c.iddepartamento = int.Parse(cmbDepartamento.SelectedValue.ToString());
            c.idpuesto       = int.Parse(cmbPuesto.SelectedValue.ToString());
            c.estadocivil    = cmbEstadoCivil.SelectedValue.ToString();
            c.sexo           = cmbSexo.SelectedValue.ToString();
            c.escolaridad    = cmbEscolaridad.SelectedValue.ToString();
            c.horario        = txtHorario.Text;
            c.nocontrol      = txtNoControl.Text;
            c.clinica        = txtClinica.Text;
            c.nacionalidad   = txtNacionalidad.Text;
            c.funciones      = txtFunciones.Text;

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    dh.insertaDireccion(d);
                    ch.insertaComplemento(c);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar los datos. \r\n \r\n Error: " + error.Message);
                    this.Dispose();
                }
                break;

            case 2:
                try
                {
                    d.iddireccion = idDireccion;
                    c.id          = idComplemento;

                    cnx.Open();
                    ch.actualizaComplemento(c);
                    dh.actualizaDireccion(d);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar los datos. \r\n \r\n Error: " + error.Message);
                    this.Dispose();
                }
                break;
            }
        }
Exemple #10
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            fh             = new Factores.Core.FactoresHelper();
            fh.Command     = cmd;

            Factores.Core.Factores factor = new Factores.Core.Factores();
            factor.anio  = int.Parse(txtAnio.Text.Trim());
            factor.valor = decimal.Parse(txtValor.Text.Trim());

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    fh.insertaFactor(factor);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar el factor. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    factor.idfactor = _idfactor;
                    cnx.Open();
                    fh.actualizaFactor(factor);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar el factor. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                break;

            case 1:
                if (OnNuevoFactor != null)
                {
                    OnNuevoFactor(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #11
0
        private void frmEmpleados_Load(object sender, EventArgs e)
        {
            CargaComboBox();
            /// _tipoOperacion CONSULTA = 1, EDICION = 2
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                eh             = new Empleados.Core.EmpleadosHelper();
                eh.Command     = cmd;

                List <Empleados.Core.Empleados> lstEmpleado;

                Empleados.Core.Empleados em = new Empleados.Core.Empleados();
                em.idtrabajador = _idempleado;

                try
                {
                    cnx.Open();
                    lstEmpleado = eh.obtenerEmpleado(em);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstEmpleado.Count; i++)
                    {
                        txtNombre.Text                = lstEmpleado[i].nombres;
                        txtApPaterno.Text             = lstEmpleado[i].paterno;
                        txtApMaterno.Text             = lstEmpleado[i].materno;
                        dtpFechaNacimiento.Value      = DateTime.Parse(lstEmpleado[i].fechanacimiento.ToString());
                        txtEdad.Text                  = lstEmpleado[i].edad.ToString();
                        dtpFechaIngreso.Value         = lstEmpleado[i].fechaingreso;
                        cmbLocalForaneo.SelectedValue = lstEmpleado[i].localforaneo;
                        cmbSua.SelectedValue          = lstEmpleado[i].sua;
                        txtRFC.Text    = lstEmpleado[i].rfc;
                        txtCURP.Text   = lstEmpleado[i].curp;
                        txtNSS.Text    = lstEmpleado[i].nss;
                        txtDigito.Text = lstEmpleado[i].digitoverificador.ToString();

                        lblCliente.Visible = false;
                        lblPeriodo.Visible = false;
                        cmbCliente.Visible = false;
                        cmbPeriodo.Visible = false;

                        lblSalario.Visible     = false;
                        lblTipoSalario.Visible = false;
                        lblSueldo.Visible      = false;
                        lblSD.Visible          = false;
                        lblSDI.Visible         = false;
                        cmbTipoSalario.Visible = false;
                        txtSueldo.Visible      = false;
                        txtSD.Visible          = false;
                        txtSDI.Visible         = false;
                        btnCalcular.Visible    = false;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta Empleado";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                    GLOBALES.INHABILITAR(this, typeof(MaskedTextBox));
                    GLOBALES.INHABILITAR(this, typeof(Button));
                    GLOBALES.INHABILITAR(this, typeof(DateTimePicker));
                    GLOBALES.INHABILITAR(this, typeof(ComboBox));
                }
                else
                {
                    toolTitulo.Text = "Edición Empleado";
                }
            }
        }
Exemple #12
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            control = GLOBALES.VALIDAR(this, typeof(MaskedTextBox));
            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            int idcliente;

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            ch             = new Clientes.Core.ClientesHelper();
            ch.Command     = cmd;

            Clientes.Core.Clientes cli = new Clientes.Core.Clientes();
            cli.nombre  = txtNombre.Text;
            cli.rfc     = txtRfc.Text;
            cli.estatus = 1;
            cli.plaza   = GLOBALES.IDPLAZA;

            dh         = new Direccion.Core.DireccionesHelper();
            dh.Command = cmd;

            Direccion.Core.Direcciones d = new Direccion.Core.Direcciones();
            d.calle    = txtCalle.Text;
            d.exterior = txtExterior.Text;
            d.interior = txtInterior.Text;
            d.colonia  = txtColonia.Text;
            d.ciudad   = txtMunicipio.Text;
            d.estado   = txtEstado.Text;
            d.pais     = txtPais.Text;
            d.cp       = txtCP.Text;
            ///TIPO DIRECCION
            ///0 - Dirección fiscal
            ///1 - Dirección sucursal
            ///2 - Dirección personal
            d.tipodireccion = 0;
            ///TIPO PERSONA
            ///0 - Empresa
            ///1 - Cliente
            ///2 - Empleado
            d.tipopersona = 1;

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    ch.insertaCliente(cli);
                    idcliente   = (int)ch.obtenerIdCliente(cli);
                    d.idpersona = idcliente;
                    dh.insertaDireccion(d);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar el cliente. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    cli.idcliente = _idcliente;
                    d.iddireccion = _iddireccion;
                    d.idpersona   = _idcliente;
                    cnx.Open();
                    ch.actualizaCliente(cli);
                    dh.actualizaDireccion(d);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar el cliente. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                GLOBALES.LIMPIAR(this, typeof(MaskedTextBox));
                //limpiar(this, typeof(TextBox));
                break;

            case 1:
                if (OnNuevoCliente != null)
                {
                    OnNuevoCliente(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #13
0
        private void frmClientes_Load(object sender, EventArgs e)
        {
            /// _tipoOperacion CONSULTA = 1, EDICION = 2
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                ch             = new Clientes.Core.ClientesHelper();
                ch.Command     = cmd;

                dh         = new Direccion.Core.DireccionesHelper();
                dh.Command = cmd;

                Clientes.Core.Clientes cli = new Clientes.Core.Clientes();
                cli.idcliente = _idcliente;

                Direccion.Core.Direcciones d = new Direccion.Core.Direcciones();
                d.idpersona   = _idcliente;
                d.tipopersona = 1; ///TIPO PERSONA 1 - Clientes
                List <Clientes.Core.Clientes>     lstCliente;
                List <Direccion.Core.Direcciones> lstDireccion;

                try
                {
                    cnx.Open();
                    lstCliente   = ch.obtenerCliente(cli);
                    lstDireccion = dh.obtenerDireccion(d);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstCliente.Count; i++)
                    {
                        txtNombre.Text = lstCliente[i].nombre;
                        txtRfc.Text    = lstCliente[i].rfc;
                    }

                    for (int i = 0; i < lstDireccion.Count; i++)
                    {
                        _iddireccion      = lstDireccion[i].iddireccion;
                        txtCalle.Text     = lstDireccion[i].calle;
                        txtExterior.Text  = lstDireccion[i].exterior;
                        txtInterior.Text  = lstDireccion[i].interior;
                        txtColonia.Text   = lstDireccion[i].colonia;
                        txtCP.Text        = lstDireccion[i].cp;
                        txtMunicipio.Text = lstDireccion[i].ciudad;
                        txtEstado.Text    = lstDireccion[i].estado;
                        txtPais.Text      = lstDireccion[i].pais;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta Cliente";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                    GLOBALES.INHABILITAR(this, typeof(MaskedTextBox));
                }
                else
                {
                    toolTitulo.Text = "Edición Cliente";
                }
            }
        }
Exemple #14
0
        private void frmPeriodos_Load(object sender, EventArgs e)
        {
            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            Clientes.Core.ClientesHelper ch = new Clientes.Core.ClientesHelper();
            ch.Command = cmd;

            //DataTable dtClientes = new DataTable();
            List <Clientes.Core.Clientes> lstClientes = new List <Clientes.Core.Clientes>();

            Clientes.Core.Clientes cliente = new Clientes.Core.Clientes();
            cliente.plaza = GLOBALES.IDPLAZA;

            try
            {
                cnx.Open();
                lstClientes = ch.obtenerClientes(cliente);
                //dtClientes = ch.dtObtenerClientes(cliente);
                cnx.Close();
                cnx.Dispose();
            }
            catch (Exception error)
            {
                MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
            }

            cmbCliente.DataSource    = lstClientes.ToList();
            cmbCliente.ValueMember   = "idcliente";
            cmbCliente.DisplayMember = "nombre";

            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                ph         = new Periodos.Core.PeriodosHelper();
                ph.Command = cmd;

                Periodos.Core.Periodos p = new Periodos.Core.Periodos();
                p.idperiodo = _idperiodo;

                List <Periodos.Core.Periodos> lstPeriodo;

                try
                {
                    cnx.Open();
                    lstPeriodo = ph.obtenerPeriodo(p);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstPeriodo.Count; i++)
                    {
                        cmbCliente.SelectedValue   = lstPeriodo[i].idperiodo;
                        cmbPago.SelectedText       = lstPeriodo[i].pago;
                        txtDias.Text               = lstPeriodo[i].dias.ToString();
                        cmbDiaInicio.SelectedText  = lstPeriodo[i].inicio;
                        cmbDiaTermino.SelectedText = lstPeriodo[i].termino;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta Periodo";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                    GLOBALES.INHABILITAR(this, typeof(ComboBox));
                }
                else
                {
                    toolTitulo.Text = "Edición Periodo";
                }
            }

            cmbPago.SelectedIndex       = 0;
            cmbDiaInicio.SelectedIndex  = 0;
            cmbDiaTermino.SelectedIndex = 6;
        }
Exemple #15
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            ph             = new Periodos.Core.PeriodosHelper();
            ph.Command     = cmd;

            Periodos.Core.Periodos periodo = new Periodos.Core.Periodos();
            periodo.idcliente = int.Parse(cmbCliente.SelectedValue.ToString());
            periodo.pago      = cmbPago.SelectedText;
            periodo.dias      = cmbPago.SelectedText.Equals("SEMANAL") ? 7 : 15;
            periodo.inicio    = cmbDiaInicio.SelectedText;
            periodo.termino   = cmbDiaTermino.SelectedText;
            periodo.estatus   = 1;

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    ph.insertaPeriodo(periodo);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar el periodo. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    periodo.idperiodo = _idperiodo;
                    cnx.Open();
                    ph.actualizaPeriodo(periodo);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar el periodo. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                GLOBALES.REFRESCAR(this, typeof(ComboBox));
                break;

            case 1:
                if (OnNuevoPeriodo != null)
                {
                    OnNuevoPeriodo(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #16
0
        private void Guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;

            ph         = new Plaza.Core.PlazasHelper();
            ph.Command = cmd;

            Plaza.Core.Plazas p = new Plaza.Core.Plazas();
            p.nombre = txtNombre.Text;
            p.activo = 1;

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    ph.insertaPlaza(p);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }
                break;

            case 2:
                try
                {
                    cnx.Open();
                    p.id = _idplaza;
                    ph.actualizaPlaza(p);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                break;

            case 1:
                if (OnNuevaPlaza != null)
                {
                    OnNuevaPlaza(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #17
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS CAMPOS HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            control = GLOBALES.VALIDAR(this, typeof(MaskedTextBox));
            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            eh             = new Empleados.Core.EmpleadosHelper();
            eh.Command     = cmd;

            Empleados.Core.Empleados em = new Empleados.Core.Empleados();
            em.nombres           = txtNombre.Text;
            em.paterno           = txtApMaterno.Text;
            em.materno           = txtApMaterno.Text;
            em.nombrecompleto    = txtApPaterno.Text + (string.IsNullOrEmpty(txtApMaterno.Text) ? "" : " " + txtApMaterno.Text) + " " + txtNombre.Text;
            em.fechanacimiento   = dtpFechaNacimiento.Value;
            em.edad              = int.Parse(txtEdad.Text);
            em.idempresa         = GLOBALES.IDEMPRESA;
            em.fechaingreso      = dtpFechaIngreso.Value;
            em.localforaneo      = cmbLocalForaneo.SelectedValue.ToString();
            em.sua               = cmbSua.SelectedValue.ToString();
            em.rfc               = txtRFC.Text;
            em.curp              = txtCURP.Text;
            em.nss               = txtNSS.Text;
            em.digitoverificador = int.Parse(txtDigito.Text);

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    em.antiguedad  = 0;
                    em.idcliente   = int.Parse(cmbCliente.SelectedValue.ToString());
                    em.idperiodo   = int.Parse(cmbPeriodo.SelectedValue.ToString());
                    em.tiposalario = cmbTipoSalario.SelectedValue.ToString();
                    em.sdi         = decimal.Parse(txtSDI.Text);
                    em.sd          = decimal.Parse(txtSD.Text);
                    em.sueldo      = decimal.Parse(txtSueldo.Text);
                    em.idinfonavit = 0;
                    em.estatus     = 0;
                    em.idse        = 0;
                    em.modsalario  = 0;
                    em.idplaza     = GLOBALES.IDPLAZA;

                    cnx.Open();
                    eh.insertaEmpleado(em);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar el empleado. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    em.idempresa = _idempleado;
                    cnx.Open();
                    eh.actualizaEmpleado(em);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar el empleado. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                GLOBALES.LIMPIAR(this, typeof(MaskedTextBox));
                GLOBALES.REFRESCAR(this, typeof(ComboBox));
                break;

            case 1:
                if (OnNuevoEmpleado != null)
                {
                    OnNuevoEmpleado(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #18
0
        private void guardar(int tipoGuardar)
        {
            //SE VALIDA SI TODOS LOS TEXTBOX HAN SIDO LLENADOS.
            string control = GLOBALES.VALIDAR(this, typeof(TextBox));

            if (!control.Equals(""))
            {
                MessageBox.Show("Falta el campo: " + control, "Información");
                return;
            }

            cnx = new MySqlConnection();
            cnx.ConnectionString = cdn;
            cmd            = new MySqlCommand();
            cmd.Connection = cnx;
            dh             = new Departamento.Core.DeptoHelper();
            dh.Command     = cmd;

            Departamento.Core.Depto depto = new Departamento.Core.Depto();
            depto.descripcion = txtDescripcion.Text;
            depto.estatus     = 1;

            switch (_tipoOperacion)
            {
            case 0:
                try
                {
                    cnx.Open();
                    dh.insertaDepartamento(depto);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al ingresar el departamento. \r\n \r\n Error: " + error.Message);
                }
                break;

            case 2:
                try
                {
                    depto.id          = _iddepartamento;
                    depto.descripcion = txtDescripcion.Text;
                    cnx.Open();
                    dh.actualizaDepartamento(depto);
                    cnx.Close();
                    cnx.Dispose();
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error al actualizar el departamento. \r\n \r\n Error: " + error.Message);
                }
                break;
            }

            switch (tipoGuardar)
            {
            case 0:
                GLOBALES.LIMPIAR(this, typeof(TextBox));
                //limpiar(this, typeof(TextBox));
                break;

            case 1:
                if (OnNuevoDepto != null)
                {
                    OnNuevoDepto(_tipoOperacion);
                }
                this.Dispose();
                break;
            }
        }
Exemple #19
0
        private void frmComplementos_Load(object sender, EventArgs e)
        {
            CargaComboBox();
            if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR)
            {
                cnx = new MySqlConnection();
                cnx.ConnectionString = cdn;
                cmd            = new MySqlCommand();
                cmd.Connection = cnx;
                ch             = new Complementos.Core.ComplementoHelper();
                dh             = new Direccion.Core.DireccionesHelper();
                ch.Command     = cmd;
                dh.Command     = cmd;

                List <Complementos.Core.Complemento> lstComplemento;
                List <Direccion.Core.Direcciones>    lstDireccion;

                Complementos.Core.Complemento c = new Complementos.Core.Complemento();
                c.idtrabajador = _idEmpleado;

                Direccion.Core.Direcciones d = new Direccion.Core.Direcciones();
                d.idpersona   = _idEmpleado;
                d.tipopersona = 2;

                try
                {
                    cnx.Open();
                    lstComplemento = ch.obtenerComplemento(c);
                    lstDireccion   = dh.obtenerDireccion(d);
                    cnx.Close();
                    cnx.Dispose();

                    for (int i = 0; i < lstComplemento.Count; i++)
                    {
                        idComplemento                 = lstComplemento[i].id;
                        cmbContrato.SelectedValue     = lstComplemento[i].contrato;
                        cmbJornada.SelectedValue      = lstComplemento[i].jornada;
                        cmbDepartamento.SelectedValue = lstComplemento[i].iddepartamento;
                        cmbPuesto.SelectedValue       = lstComplemento[i].idpuesto;
                        cmbEstadoCivil.SelectedValue  = lstComplemento[i].estadocivil;
                        cmbSexo.SelectedValue         = lstComplemento[i].sexo;
                        cmbEscolaridad.SelectedValue  = lstComplemento[i].escolaridad;
                        txtHorario.Text               = lstComplemento[i].horario;
                        txtNoControl.Text             = lstComplemento[i].nocontrol;
                        txtClinica.Text               = lstComplemento[i].clinica;
                        txtNacionalidad.Text          = lstComplemento[i].nacionalidad;
                        txtFunciones.Text             = lstComplemento[i].funciones;
                    }

                    for (int j = 0; j < lstDireccion.Count; j++)
                    {
                        idDireccion       = lstDireccion[j].iddireccion;
                        txtCalle.Text     = lstDireccion[j].calle;
                        txtExterior.Text  = lstDireccion[j].exterior;
                        txtInterior.Text  = lstDireccion[j].interior;
                        txtColonia.Text   = lstDireccion[j].colonia;
                        txtCP.Text        = lstDireccion[j].cp;
                        txtMunicipio.Text = lstDireccion[j].ciudad;
                        txtEstado.Text    = lstDireccion[j].estado;
                        txtPais.Text      = lstDireccion[j].pais;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error");
                }

                if (_tipoOperacion == GLOBALES.CONSULTAR)
                {
                    toolTitulo.Text = "Consulta del Complemento";
                    GLOBALES.INHABILITAR(this, typeof(TextBox));
                    GLOBALES.INHABILITAR(this, typeof(MaskedTextBox));
                    GLOBALES.INHABILITAR(this, typeof(ComboBox));
                }
                else
                {
                    toolTitulo.Text = "Edición del Complemento";
                }
            }
        }