Exemplo n.º 1
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";
                }
            }
        }