private bool Validar()
        {
            MyErrorProvider.Clear();
            int cantidadAgregar = 0;

            foreach (DataGridViewRow row in ProductosDataGridView.Rows)
            {
                if ((Convert.ToBoolean(row.Cells[0].Value) == true))
                {
                    cantidadAgregar += 1;
                }
            }

            if (cantidadAgregar == 1)
            {
                return(true);
            }
            else
            if (cantidadAgregar == 0)
            {
                MyErrorProvider.SetError(Agregarbutton, "Debe de seleccionar un producto a agregar");
                Agregarbutton.Focus();
                return(false);
            }
            else
            {
                MyErrorProvider.SetError(Agregarbutton, "No puede seleccionar mas de un producto para agregarlo");
                Agregarbutton.Focus();
                return(false);
            }
        }
        private bool Validar()
        {
            bool paso = true;

            MyerrorProvider.Clear();

            if (AsignaturacomboBox.SelectedIndex == -1)
            {
                MyerrorProvider.SetError(AsignaturacomboBox, "Debe elegir una asignatura.");
                paso = false;
            }

            if (AsignaturacomboBox.Text == "")
            {
                MyerrorProvider.SetError(AsignaturacomboBox, "Debe elegir una asignatura.");
                paso = false;
            }

            if (this.Detalle.Count == 0)
            {
                MyerrorProvider.SetError(Agregarbutton, "Debe agregar al menos un estudiante.");
                Agregarbutton.Focus();
                paso = false;
            }

            return(paso);
        }
示例#3
0
 private void NumerotextBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         Agregarbutton.Focus();
     }
 }
        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (CantidadnumericUpDown.Value > 0)
            {
                decimal importe = detalle.Producto.Precio * CantidadnumericUpDown.Value;
                ImportetextBox.Text = importe.ToString();
            }
            else
            {
                ImportetextBox.Text = "0";
            }

            Agregarbutton.Focus();
        }
      private bool Validar()
      {
          bool paso = true;

          MyerrorProvider.Clear();

          if (AsignaturacomboBox.Text == "")
          {
              MyerrorProvider.SetError(AsignaturacomboBox, " Elige una asignatura.");
              paso = false;
          }

          if (EstudiantecomboBox.SelectedIndex == -1)
          {
              MyerrorProvider.SetError(EstudiantecomboBox, "Elige un Estudiante .");
              paso = false;
          }

          if (this.Detalle.Count == 0)
          {
              MyerrorProvider.SetError(Agregarbutton, "Agrega  un estudiante.");
              Agregarbutton.Focus();
              paso = false;
          }

          if (string.IsNullOrWhiteSpace(CantidadtextBox.Text))
          {
              MyerrorProvider.SetError(CantidadtextBox, "El campo Cantidad no puede estar vacío.");
              paso = false;
          }
          else
          {
              try
              {
                  int cantidad = Convert.ToInt32(CantidadtextBox.Text);
              }
              catch (Exception)
              {
                  MyerrorProvider.SetError(CantidadtextBox, "La cantidad debe ser entera y numerica.");
                  paso = false;
              }
          }

          return(paso);
      }
示例#6
0
        private bool Validar()
        {
            bool paso = true;

            MyError.Clear();

            if (AsignaturacomboBox.SelectedIndex == -1)
            {
                MyError.SetError(AsignaturacomboBox, "Debe elegir una asignatura");
                AsignaturacomboBox.Focus();
                paso = false;
            }

            if (AsignaturacomboBox.Text == string.Empty)
            {
                MyError.SetError(AsignaturacomboBox, "Debe elegir una asignatura");
                AsignaturacomboBox.Focus();
                paso = false;
            }

            if (EstudiantecomboBox.SelectedIndex == -1)
            {
                MyError.SetError(EstudiantecomboBox, "Debe elegir un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            if (EstudiantecomboBox.Text == string.Empty)
            {
                MyError.SetError(EstudiantecomboBox, "Debe elegir un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            if (this.Detalles.Count == 0)
            {
                MyError.SetError(Agregarbutton, "Debe agregar por lo menos un estudiante");
                Agregarbutton.Focus();
                paso = false;
            }

            return(paso);
        }