Esempio n. 1
0
        private void FormularioColonos_FormClosed(object sender, FormClosedEventArgs e)
        {
            ModuloColonos frm22 = Application.OpenForms.OfType <ModuloColonos>().FirstOrDefault();

            if (frm22 != null)  //Si encuentra una instancia abierta
            {
                frm22.Refresh();
                frm22.MostrarDatos();
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //cargar();
            try
            {
                if (contCol == 1)
                {
                    if (textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" ||
                        textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "" ||
                        textBox9.Text == "")
                    {
                        MessageBox.Show("Campos vacios");
                        textBox1.Text = "";
                        id            = rd.Next(10, 10000);
                        textBox1.Text = id.ToString();
                    }
                    else
                    {
                        this.colono.Idcolono          = Convert.ToInt32(textBox1.Text);
                        this.colono.Estatus           = estatus;
                        this.colono.Nombre            = textBox2.Text;
                        this.colono.ApPaterno         = textBox3.Text;
                        this.colono.ApMaterno         = textBox4.Text;
                        this.colono.Telefono          = textBox5.Text;
                        this.colono.Direccion         = Convert.ToInt32(comboBox1.SelectedValue);
                        this.colono.Numero            = textBox6.Text;
                        this.colono.Email             = textBox7.Text;
                        this.colono.Propietario       = Convert.ToInt32(comboBox2.SelectedValue);
                        this.colono.NumeroPropiedades = Convert.ToInt32(textBox9.Text);
                        colc.registrarColono(colono);


                        textBox1.Text = "";
                        textBox2.Text = "";
                        textBox3.Text = "";
                        textBox4.Text = "";
                        textBox5.Text = "";

                        textBox6.Text = "";
                        textBox7.Text = "";
                        textBox9.Text = "";
                        this.Close();
                    }
                }
                else if (contCol == 2)
                {
                    this.colono.Idcolono          = Convert.ToInt32(textBox1.Text);
                    this.colono.Nombre            = textBox2.Text;
                    this.colono.ApPaterno         = textBox3.Text;
                    this.colono.ApMaterno         = textBox4.Text;
                    this.colono.Telefono          = textBox5.Text;
                    this.colono.Direccion         = Convert.ToInt32(comboBox1.SelectedValue.ToString());
                    this.colono.Numero            = textBox6.Text;
                    this.colono.Email             = textBox7.Text;
                    this.colono.Propietario       = Convert.ToInt32(comboBox2.SelectedValue.ToString());
                    this.colono.NumeroPropiedades = Convert.ToInt32(textBox9.Text);
                    colc.modificarColono(colono);
                    this.Close();
                    ModuloColonos md = new ModuloColonos();
                    //idDato = 1;
                    //md.refrescar = 1;
                    md.MostrarDatos();
                    md.Refresh();
                }
            }
            catch
            {
            }
        }