示例#1
0
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            if (!ValidarDetalle())
            {
                return;
            }

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

            Tareas tareas = BuscarId(TareacomboBox.Text);

            this.Detalle.Add(new ProyectosDetalle()
            {
                TipoId        = tareas.TareaId,
                TipoTarea     = tareas.TipoTarea,
                Requerimiento = RequerimientotextBox.Text,
                Tiempo        = Convert.ToInt32(TiempotextBox.Text)
            });

            int total  = Convert.ToInt32(TotaltextBox.Text);
            int tiempo = Convert.ToInt32(TiempotextBox.Text);

            total            += tiempo;
            TotaltextBox.Text = Convert.ToString(total);

            CargarGrid();
            TareacomboBox.Focus();
            RequerimientotextBox.Clear();
            TiempotextBox.Clear();
            ErrorProvider.Clear();
        }
        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();
        }
        private bool Validar()
        {
            bool   validado    = true;
            string obligatorio = "Campo obligatorio";

            if (string.IsNullOrWhiteSpace(IDnumericUpDown.Text))
            {
                errorProvider.SetError(IDnumericUpDown, obligatorio);
                IDnumericUpDown.Focus();
                validado = false;
            }
            if (string.IsNullOrWhiteSpace(MontotextBox.Text))
            {
                errorProvider.SetError(MontotextBox, obligatorio);
                MontotextBox.Focus();
                validado = false;
            }
            if (ToDecimal(MontotextBox.Text) < 1)
            {
                errorProvider.SetError(MontotextBox, "El monto debe ser mayor a 0");
                MontotextBox.Focus();
                validado = false;
            }
            if (string.IsNullOrWhiteSpace(TiempotextBox.Text))
            {
                errorProvider.SetError(TiempotextBox, obligatorio);
                TiempotextBox.Focus();
                validado = false;
            }
            if (ToInt(TiempotextBox.Text) < 1)
            {
                errorProvider.SetError(TiempotextBox, "El tiempo debe ser mayor a un mes");
                TiempotextBox.Focus();
                validado = false;
            }
            if (string.IsNullOrWhiteSpace(FechadateTimePicker.Value.ToString()))
            {
                errorProvider.SetError(FechadateTimePicker, obligatorio);
                FechadateTimePicker.Focus();
                validado = false;
            }

            return(validado);
        }
示例#4
0
        private bool ValidarDetalle()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(RequerimientotextBox.Text))
            {
                ErrorProvider.SetError(RequerimientotextBox, "Este campo no puede estar vacío");
                RequerimientotextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(TiempotextBox.Text))
            {
                ErrorProvider.SetError(TiempotextBox, "Este campo no puede estar vacío");
                TiempotextBox.Focus();
                paso = false;
            }

            return(paso);
        }