Пример #1
0
 /// <summary>
 /// Evento utilizado para validar y restringir la cantidad de calles que pueden ser ingresadas
 /// </summary>
 private void txtCalles_Leave(object sender, EventArgs e)
 {
     if (!Validador.calleValida(txtCalles.Text))
     {
         txtCalles.Clear();
     }
     else
     {
         if (txtCalles.Text != "" && txtAvenidas.Text != "")
         {
             btnAbrirArchivo.Visible = true;
         }
         else
         {
             btnAbrirArchivo.Visible = false;
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Evento utilizado para validar que el número de calles y avenidas se encuentre dentro del rango establecido
        /// </summary>
        private void button1_MouseClick(object sender, MouseEventArgs e)
        {
            int intCalles   = -1;
            int intAvenidas = -1;

            if (Validador.esEntero(txtAvenidas.Text))
            {
                intCalles = int.Parse(txtAvenidas.Text);
            }
            if (Validador.esEntero(txtCalles.Text))
            {
                intAvenidas = int.Parse(txtCalles.Text);
            }
            if (intCalles != -1 && intCalles != -1)
            {
                if (intCalles < 10 || intCalles > 50)
                {
                    MessageBox.Show("La cantidad de calles debe estar entre 10 y 50.", "***ERROR***", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtAvenidas.Text = "";
                }
                else if (intAvenidas < 10 || intCalles > 100)
                {
                    MessageBox.Show("La cantidad de avenidas debe estar entre 10 y 50.", "***ERROR***", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtAvenidas.Text = "";
                }
                else
                {
                    Console.WriteLine(dtpFechaHora.ToString());
                    Viewer v1 = new Viewer(intCalles, intAvenidas, dtpFechaHora.Value, this, alObjetos);
                    v1.ShowDialog();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Debe ingresar datos válidos", "***ERROR***", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }