예제 #1
0
        private void btn_ver_Click(object sender, EventArgs e)

        {
            LocalControler.Activarlistalocales();

            if (LocalControler.locales.Count == 0)
            {
                MessageBox.Show("NO HAY LOCALES AGREGADOS AUN", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            for (int i = 0; i < LocalControler.locales.Count; i++)
            {
                if (LocalControler.locales[i].Tipo == 1)
                {
                    Cine cine = (Cine)LocalControler.locales[i];
                    listBox_locales_activos.Items.Add(cine.InformacionCine());
                }
                if (LocalControler.locales[i].Tipo == 2)
                {
                    Tienda tienda = (Tienda)LocalControler.locales[i];
                    listBox_locales_activos.Items.Add(tienda.InformacionTienda());
                }
                if (LocalControler.locales[i].Tipo == 3)
                {
                    Restaurante res = (Restaurante)LocalControler.locales[i];
                    listBox_locales_activos.Items.Add(res.InformacionRestaurante());
                }
                if (LocalControler.locales[i].Tipo == 4)
                {
                    Recreacional recrea = (Recreacional)LocalControler.locales[i];
                    listBox_locales_activos.Items.Add(recrea.infoRecrea());
                }
            }
        }
 private void btn_agregae_recreacional_Click(object sender, EventArgs e)
 {
     try
     {
         Recreacional re = new Recreacional(textBox_nombre_recreacional.Text.ToLower(), textBox_dueño_recreacional.Text.ToLower(), int.Parse(textBox_id_recreacional.Text), textBox_horario_recreacional.Text.ToLower());
         LocalControler.Agregarrecrea(re);
     }
     catch
     {
         MessageBox.Show("EL ID TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void btn_agregar_restaurante_Click(object sender, EventArgs e)
 {
     try
     {
         Restaurante r = new Restaurante(textBox_nombre_lrestau.Text.ToLower(), textBox_dueño_restau.Text.ToLower(), int.Parse(textBox_id_restau.Text), textBox_horario_restau.Text, textBox_mesas_reservadas.Text.ToLower());
         LocalControler.Agregarrestau(r);
     }
     catch
     {
         MessageBox.Show("EL ID TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 // /////////////////////////////////////////////////////AGREGAR CINE/////////////////////////////////////////////////////////////////77
 private void btn_agregar_cine_Click(object sender, EventArgs e)
 {
     try
     {
         Cine c = new Cine(textBox_nombre_cine.Text.ToLower(), textBox_nombre_dueño_cine.Text.ToLower(), int.Parse(textBox_id_cine.Text), textBox_horario_cine.Text.ToLower(), int.Parse(textBox_numero_de_salas.Text));
         LocalControler.Agregarcine(c);
     }
     catch
     {
         MessageBox.Show("EL ID Y EL NUMERO DE SALAS TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void button2_Click(object sender, EventArgs e)
 {
     listBox1.Items.Clear();
     listBox1.Visible = true;
     listBox1.Items.Add(LocalControler.Buscarlocal(textBox1.Text.ToLower()));
 }
 private void btn_agregar_tienda_Click(object sender, EventArgs e)
 {
     listacat.Clear();
     if (textBox_cantidad_categorias.Text == "1")
     {
         try
         {
             Tienda t = new Tienda(textBox_nombre_tienda.Text.ToLower(), textBox_nombre_dueño.Text.ToLower(), int.Parse(textBox_id.Text), textBox_horario.Text.ToLower());
             t.categorias.Add(comboBox1.Text);
             LocalControler.Agregartienda(t);
             listacat.Add(comboBox1.Text);
         }
         catch
         {
             MessageBox.Show("EL ID TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     if (textBox_cantidad_categorias.Text == "2")
     {
         try
         {
             Tienda t = new Tienda(textBox_nombre_tienda.Text.ToLower(), textBox_nombre_dueño.Text.ToLower(), int.Parse(textBox_id.Text), textBox_horario.Text.ToLower());
             t.categorias.Add(comboBox1.Text);
             t.categorias.Add(comboBox2.Text);
             LocalControler.Agregartienda(t);
         }
         catch
         {
             MessageBox.Show("EL ID TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     if (textBox_cantidad_categorias.Text == "3")
     {
         try
         {
             Tienda t = new Tienda(textBox_nombre_tienda.Text.ToLower(), textBox_nombre_dueño.Text.ToLower(), int.Parse(textBox_id.Text), textBox_horario.Text.ToLower());
             t.categorias.Add(comboBox1.Text);
             t.categorias.Add(comboBox2.Text);
             t.categorias.Add(comboBox3.Text);
             LocalControler.Agregartienda(t);
         }
         catch
         {
             MessageBox.Show("EL ID TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     if (textBox_cantidad_categorias.Text == "4")
     {
         try
         {
             Tienda t = new Tienda(textBox_nombre_tienda.Text.ToLower(), textBox_nombre_dueño.Text.ToLower(), int.Parse(textBox_id.Text), textBox_horario.Text.ToLower());
             t.categorias.Add(comboBox1.Text);
             t.categorias.Add(comboBox2.Text);
             t.categorias.Add(comboBox3.Text);
             t.categorias.Add(comboBox4.Text);
             LocalControler.Agregartienda(t);
         }
         catch
         {
             MessageBox.Show("EL ID TIENE QUE SER UN NUMERO", "OK", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }