Exemple #1
0
        public bool Validar()
        {
            bool paso = true;

            if (DescripcionTextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(DescripcionTextBox, "Debe Agregar datos a este campo");
                DescripcionTextBox.Focus();
            }
            if (TipoTareaComboBox.Text == string.Empty)
            {
                ErrorProvider.SetError(TipoTareaComboBox, "Debe Agregar datos a este campo");
                TipoTareaComboBox.Focus();
            }
            if (RequerimientosTextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(RequerimientosTextBox, "Debe Agregar datos a este campo");
                RequerimientosTextBox.Focus();
            }
            if (TiempoTextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(TiempoTextBox, "Debe Agregar datos a este campo");
                TiempoTextBox.Focus();
            }
            if (TiempoTotalTextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(TiempoTotalTextBox, "Debe Agregar datos a este campo");
                TiempoTotalTextBox.Focus();
            }
            return(paso);
        }
Exemple #2
0
        private void AgregarButton_Click(object sender, EventArgs e)
        {
            MyErrorProvider.Clear();
            if (!ValidarAgregar())
            {
                return;
            }

            if (DetalleDataGrid.DataSource != null)
            {
                this.Detalle = (List <ProyectosDetalle>)DetalleDataGrid.DataSource;
            }

            if (TipoTareaComboBox.Text == null)
            {
                MessageBox.Show("Selecciona un Tipo de tarea en el combobox.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int    total, tiempo;
            Tareas tarea = BuscarId(TipoTareaComboBox.Text);

            try
            {
                this.Detalle.Add(new ProyectosDetalle(
                                     DetalleId: 0,
                                     ProyectoId: (int)ProyectoIdNumericUpDown.Value,
                                     TipoId: tarea.TareaId,
                                     TipoTarea: tarea.TipoTarea,
                                     Requerimiento: RequerimientosTextBox.Text,
                                     Tiempo: Convert.ToInt32(TiempoTextBox.Text)
                                     )
                                 );
                CargarGrid();
                TipoTareaComboBox.Focus();
            }
            catch (Exception)
            {
                throw;
            }


            total  = Convert.ToInt32(TiempoTotalTextBox.Text);
            tiempo = Convert.ToInt32(TiempoTextBox.Text);

            total += tiempo;

            TiempoTotalTextBox.Text = total.ToString();
        }