コード例 #1
0
        public void renderButacas()
        {
            Contenedor.Controls.Clear();

            for (int i = 0; i < FILAS; i++)
            {
                string rowName = getLetra(i);

                labels[i]          = new Label();
                labels[i].AutoSize = true;
                labels[i].Font     = new Font("Microsoft Sans Serif", 15.75F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
                labels[i].Name     = "lbl" + rowName;
                labels[i].Size     = new Size(27, 25);
                labels[i].Text     = rowName;

                Contenedor.Controls.Add(labels[i]);

                botones[i] = new ButacaButton[COLUMNAS];
                for (int k = 0; k < COLUMNAS; k++)
                {
                    botones[i][k]         = new ButacaButton();
                    botones[i][k].RowName = rowName;
                    botones[i][k].Row     = i;
                    botones[i][k].Column  = k;

                    if (selectedButacas.Exists(x => x.Fila == i && x.Columna == k))
                    {
                        botones[i][k].Checked = true;
                    }

                    if (Butacas.Count > 0)
                    {
                        var butaca = Butacas.Select(b => b).Where(x => x.Fila == i && x.Columna == k).SingleOrDefault();

                        if (butaca != null)
                        {
                            botones[i][k].Id    = butaca.Id;
                            botones[i][k].State = butaca.Tipo == 0 ? StateButaca.Libre : StateButaca.Ocupado;
                        }
                        else
                        {
                            botones[i][k].State = StateButaca.Invisible;
                        }
                    }

                    botones[i][k].Click += new EventHandler(btnButacas_Click);

                    this.Contenedor.Controls.Add(botones[i][k]);
                }
            }
        }
コード例 #2
0
        // GET: Funciones
        public ActionResult Index(string id)
        {
            Funciones f      = new Funciones();
            DataTable sillas = f.ListadoSillas(Convert.ToInt32(id));
            Butacas   b      = new Butacas();

            for (int x = 0; x < sillas.Rows.Count; x++)
            {
                Butaca bt = new Butaca(sillas.Rows[x][2].ToString(), Convert.ToBoolean(sillas.Rows[x][3].ToString()), sillas.Rows[x][0].ToString());
                b.ListaButacas.Add(bt);
            }

            DataTable sala = f.SalaByID(Convert.ToInt32(Session["sala"].ToString()));

            Session["filas"]    = sala.Rows[0][4].ToString();
            Session["columnas"] = sala.Rows[0][5].ToString();
            DataTable funcion = f.FuncionByID(Convert.ToInt32(id));

            Session["precio"] = funcion.Rows[0][12].ToString();
            Session["fecha"]  = funcion.Rows[0][11].ToString();
            Session["hora"]   = funcion.Rows[0][13].ToString();

            return(View(b));
        }