Ejemplo n.º 1
0
        public void CarregaGridEmpresa()
        {
            try
            {
                EmpresaNegocio empresaNegocio = new EmpresaNegocio();

                DgvEmpresa.DataSource = empresaNegocio.CarregaListaEmpresas();

                DgvEmpresa.Update();
                DgvEmpresa.Refresh();

                if (DgvEmpresa.Rows.Count == 0)
                {
                    BtnEditar.Visible = false;
                }
                else
                {
                    BtnEditar.Visible = true;
                }
            }
            catch
            {
                MessageBox.Show("Não foi possível carregar a lista de Empresas.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 2
0
 private void BtnCancelar_Click_1(object sender, EventArgs e)
 {
     BtnContrato.Enabled   = false;
     BtnTrabajador.Enabled = false;
     TxtDireccion.Clear();
     txtEmail.Clear();
     TxtNit.Clear();
     TxtPaginaWeb.Clear();
     TxtRazonSocial.Clear();
     TxtRepresentante.Clear();
     TxtTelefono.Clear();
     TxtTelRepresentante.Clear();
     pbxFotografia.Image = null;
     DgvEmpresa.ClearSelection();
     TxtNit.Focus();
 }
        private async void BtnCancelar_Click(object sender, EventArgs e)
        {
            grid = true;
            TxtDescripcion.Clear();
            TxtIdentificacion.Clear();
            TxtTrabajador.Clear();
            TxtNumeroContrato.Clear();
            DgvDetalle.ClearSelection();
            DgvDetalle.Rows.Clear();
            btnAceptar.Enabled      = true;
            CboEstado.SelectedValue = 1;
            CboEstado.Enabled       = true;
            btnAceptar.Text         = "Aceptar";
            await LoadContratos(this.empresa, "");

            DgvEmpresa.ClearSelection();
        }
Ejemplo n.º 4
0
        private async void formEmpresa_Load(object sender, EventArgs e)
        {
            btnAceptar.IconChar    = FontAwesome.Sharp.IconChar.CheckSquare;
            BtnTrabajador.IconChar = FontAwesome.Sharp.IconChar.PeopleCarry;
            btnCargarFoto.IconChar = FontAwesome.Sharp.IconChar.FileImage;
            BtnContrato.IconChar   = FontAwesome.Sharp.IconChar.FileContract;


            await LoadEmpresa();

            DgvEmpresa.ClearSelection();

            DgvEmpresa.ColumnHeadersDefaultCellStyle.Font = new Font("Century Gothic", 16, GraphicsUnit.World);
            foreach (DataGridViewColumn c in DgvEmpresa.Columns)
            {
                c.DefaultCellStyle.Font = new Font("Century Gothic", 15, GraphicsUnit.World);
            }
            DgvEmpresa.EnableHeadersVisualStyles = false;
        }
Ejemplo n.º 5
0
        private void TxtPesquisar_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (TxtPesquisa.Text != "")
                {
                    EmpresaNegocio empresaNegocio = new EmpresaNegocio();

                    if (decimal.TryParse(TxtPesquisa.Text, out decimal numero))
                    {
                        DgvEmpresa.DataSource = empresaNegocio.ProcurarPorCodigoOuNome(Convert.ToInt32(TxtPesquisa.Text), "");
                    }
                    else
                    {
                        DgvEmpresa.DataSource = empresaNegocio.ProcurarPorCodigoOuNome(0, TxtPesquisa.Text);
                    }

                    DgvEmpresa.Update();
                    DgvEmpresa.Refresh();

                    if (DgvEmpresa.Rows.Count == 0)
                    {
                        DgvPedido.DataSource = null;
                        BtnEditar.Visible    = false;
                    }
                    else
                    {
                        BtnEditar.Visible = true;
                    }
                }
                else
                {
                    CarregaGridEmpresa();
                }
            }
            catch
            {
                MessageBox.Show("Não foi possível pesquisar.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private async void formContrato_Load(object sender, EventArgs e)
        {
            btnAceptar.IconChar = FontAwesome.Sharp.IconChar.CheckSquare;
            BtnNuevo.IconChar   = FontAwesome.Sharp.IconChar.PlusSquare;

            await LoadContratos(this.empresa, "");

            var estado = await db.EstadoContrato.ToListAsync();

            CboEstado.DataSource    = estado;
            CboEstado.DisplayMember = "est_descripcion";
            CboEstado.ValueMember   = "est_id";

            DgvDetalleColMotivo.DataSource = await db.Motivo.ToListAsync();

            DgvDetalleColMotivo.DisplayMember = "mot_descipcion";
            DgvDetalleColMotivo.ValueMember   = "mot_id";


            DgvEmpresa.ClearSelection();
            DgvDetalle.ClearSelection();
        }
        private async void TxtIdentificacion_TextChanged(object sender, EventArgs e)
        {
            if (grid == false)
            {
                DgvEmpresa.Rows.Clear();
                TxtDescripcion.Clear();
                TxtTrabajador.Clear();
                TxtNumeroContrato.Clear();
                DgvDetalle.Rows.Clear();
                btnAceptar.Enabled      = true;
                CboEstado.SelectedValue = 1;
                await ExisteContratoAsync();

                DgvEmpresa.ClearSelection();

                if (TxtIdentificacion.Text.Trim().Length == 10)
                {
                    await BuscarTrabajadorAsync();
                }
            }
            grid = false;
        }
Ejemplo n.º 8
0
        private void CarregaGridEmpresa()
        {
            try
            {
                EmpresaNegocio enderecoNegocio = new EmpresaNegocio();
                DgvEmpresa.DataSource = null;
                DgvEmpresa.DataSource = enderecoNegocio.CarregaListaEmpresas();

                DgvEmpresa.Update();
                DgvEmpresa.Refresh();

                if (DgvEmpresa.Rows.Count == 0)
                {
                    BtnEditar.Visible  = false;
                    BtnExcluir.Visible = false;

                    BtnCancelar.Visible  = false;
                    BtnConfirmar.Visible = false;
                }
                else
                {
                    BtnEditar.Visible  = true;
                    BtnExcluir.Visible = true;

                    BtnCancelar.Visible  = true;
                    BtnConfirmar.Visible = true;
                }

                BtnConfirmar.Visible = false;
                BtnCancelar.Visible  = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Não foi possível carregar os dados das Empresas.\nAviso: " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }