Example #1
0
        private bool Validar()
        {
            bool paso = true;

            if (DescripciontextBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(DescripciontextBox, "Este campo no puede quedar vacio");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (RolesBLL.ExisteDescripcion(DescripciontextBox.Text))
            {
                ErroreserrorProvider.SetError(DescripciontextBox, "Esta descripcion ya existe en la base de datos");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (PermisoscomboBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(PermisoscomboBox, "Debe seleccion un Id");
                PermisoscomboBox.Focus();
                paso = false;
            }

            if (this.Detalle.Count == 0)
            {
                ErroreserrorProvider.SetError(DetalledataGridView, "Es necesario agregar un permis");
                DetalledataGridView.Focus();
                paso = false;
            }

            return(paso);
        }
Example #2
0
        private void Iniciarsesionbutton_Click(object sender, EventArgs e)
        {
            if (EmailtextBox.Text == "user" && PasswordtextBox.Text == "1234")
            {
                MainForm mnf = new MainForm();
                mnf.Show();
            }
            else
            {
                if (UsuariosBLL.ExisteUsuario(EmailtextBox.Text, PasswordtextBox.Text))
                {
                    MainForm mnf = new MainForm();
                    mnf.Show();
                }
                else
                {
                    ErroreserrorProvider.SetError(EmailtextBox, "El email o clave es incorrecto");
                    ErroreserrorProvider.SetError(PasswordtextBox, "El email o clave es incorrecto");
                    PasswordtextBox.Clear();
                }
            }

            EmailtextBox.Clear();
            PasswordtextBox.Clear();
        }
Example #3
0
        private bool Validar()
        {
            bool paso = true;

            if (NombretextBox.Text == string.Empty)
            {
                MessageBox.Show("Este campo no puede quedar vacio");
                ErroreserrorProvider.SetError(NombretextBox, "Este campo no puede quedar vacio");
                NombretextBox.Focus();
                paso = false;
            }

            if (CiudadBLL.ExisteCiudad(NombretextBox.Text))
            {
                MessageBox.Show("Este nombre de ciudad ya existe en la base de datos");
                ErroreserrorProvider.SetError(NombretextBox, "Este nombre de ciudad ya existe en la base de datos");
                NombretextBox.Focus();
                paso = false;
            }

            if (CiudadBLL.Existe((int)IDnumericUpDown.Value))
            {
                MessageBox.Show("Este id de ciudad ya existe en la base de datos");
                ErroreserrorProvider.SetError(IDnumericUpDown, "Este id de ciudad ya existe en la base de datos");
                IDnumericUpDown.Focus();
                paso = false;
            }

            return(paso);
        }
Example #4
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            ErroreserrorProvider.Clear();
            Ciudad ciudad;
            bool   paso = false;

            if (!Validar())
            {
                return;
            }

            ciudad = LlenarClase();
            paso   = CiudadBLL.Guardar(ciudad);

            if (!ExisteEnLaBaseDeDatos())
            {
                Limpiar();
                MessageBox.Show("Ciudad guardada correctamente", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                Limpiar();
                MessageBox.Show("Ciudad modificada correctamente", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #5
0
 private void Limpiar()
 {
     ErroreserrorProvider.Clear();
     IDnumericUpDown.Value = 0;
     DescripciontextBox.Clear();
     EsActivocheckBox.Checked = false;
     AsignadocheckBox.Checked = false;
     this.Detalle             = new List <RolesDetalle>();
     CargarGrid();
 }
 private void Limpiar()
 {
     ErroreserrorProvider.Clear();
     IdnumericUpDown.Value     = 0;
     FechadateTimePicker.Value = DateTime.Now.Date;
     DescripciontextBox.Clear();
     TiempototaltextBox.Text = 0.ToString();
     this.Detalle            = new List <ProyectoDetalle>();
     CargarGrid();
 }
Example #7
0
 private void EliminarPermisobutton_Click(object sender, EventArgs e)
 {
     if ((DetalledataGridView.Rows.Count > 0) && (DetalledataGridView.CurrentRow != null))
     {
         Detalle.RemoveAt(DetalledataGridView.CurrentRow.Index);
         CargarGrid();
     }
     else
     {
         ErroreserrorProvider.SetError(DetalledataGridView, "No existen filas las cuales eliminar");
         DetalledataGridView.Focus();
     }
 }
        public bool Validar()
        {
            bool paso = true;

            if (DescripciontextBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(DescripciontextBox, "Este campo no puede quedar vacio");
                DescripciontextBox.Focus();
                paso = false;
            }

            return(paso);
        }
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            if (DetalledataGridView.DataSource != null)
            {
                this.Detalle = (List <ProyectoDetalle>)DetalledataGridView.DataSource;
            }

            if (RequerimentotextBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(RequerimentotextBox, "Este campo no puede quedar vacio");
                RequerimentotextBox.Focus();
                return;
            }

            if (TiempotextBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(TiempotextBox, "Este campo no puede quedar vacio");
                TiempotextBox.Focus();
                return;
            }

            if (string.IsNullOrWhiteSpace(TipoTareacomboBox.Text))
            {
                ErroreserrorProvider.SetError(TipoTareacomboBox, "Debe agregar un tipo de tarea especifico");
                TipoTareacomboBox.Focus();
                return;
            }

            Tareas tareas = TareasBLL.Buscar(Convert.ToInt32(TipoTareacomboBox.SelectedValue));

            this.Detalle.Add(
                new ProyectoDetalle
                (
                    TipoId: tareas.TareaId,
                    TipoTarea: tareas.TipoTarea,
                    Requerimentos: RequerimentotextBox.Text,
                    Tiempo: Convert.ToInt32(TiempotextBox.Text)
                )
                );

            CargarGrid();

            int totalTiempo = Convert.ToInt32(TiempototaltextBox.Text);
            int tiempo      = Convert.ToInt32(TiempotextBox.Text);

            totalTiempo += tiempo;

            TiempototaltextBox.Text = totalTiempo.ToString();
        }
Example #10
0
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            int id;

            int.TryParse(IDnumericUpDown.Text, out id);
            Limpiar();
            if (RolesBLL.Eliminar(id))
            {
                MessageBox.Show("Rol eliminado correctamente", "Proceso exitoso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ErroreserrorProvider.SetError(IDnumericUpDown, "ID no existe en la base de datos");
            }
        }
Example #11
0
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            ErroreserrorProvider.Clear();
            int      id;
            Permisos permiso = new Permisos();

            int.TryParse(IDnumericUpDown.Text, out id);

            Limpiar();

            permiso = PermisosBLL.Buscar(id);

            if (permiso != null)
            {
                LlenarCampos(permiso);
            }
            else
            {
                MessageBox.Show("El permiso no ha sido encontrada o no esta registrada");
            }
        }
        private void Removerbutton_Click(object sender, EventArgs e)
        {
            string tiempo;
            int    totalTiempo = Convert.ToInt32(TiempototaltextBox.Text);

            if (DetalledataGridView.Rows.Count > 0 && DetalledataGridView.CurrentRow != null)
            {
                tiempo       = DetalledataGridView.CurrentRow.Cells[3].Value.ToString();
                totalTiempo -= Convert.ToInt32(tiempo);

                TiempototaltextBox.Text = totalTiempo.ToString();

                Detalle.RemoveAt(DetalledataGridView.CurrentRow.Index);
                CargarGrid();
            }
            else
            {
                ErroreserrorProvider.SetError(DetalledataGridView, "No existen datos en esta tabla");
                DetalledataGridView.Focus();
            }
        }
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            int id;

            int.TryParse(IdnumericUpDown.Text, out id);

            if (IdnumericUpDown.Value == 0)
            {
                MessageBox.Show("Es necesario agregar un id valido para poder eliminarlo", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (ProyectosBLL.Eliminar(id))
            {
                Limpiar();
                MessageBox.Show("Transaccion exitosa", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ErroreserrorProvider.SetError(IdnumericUpDown, "Id no existente en la base de datos");
            }
        }
Example #14
0
 private void Nuevobutton_Click(object sender, EventArgs e)
 {
     ErroreserrorProvider.Clear();
     Limpiar();
 }