Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ItemGrid.DataSource = _reservationDAO.GetItems();
         ItemGrid.DataBind();
         foreach (GridViewRow r in ItemGrid.Rows)
         {
             string name = r.Cells[1].Text;
             if (_reservationDAO.GetItemByName(name).Available == false)
             {
                 CheckBox chBox = r.FindControl("Available") as CheckBox;
                 chBox.Checked = false;
             }
         }
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _reservationDao = new ReservationDAO();
            for (int i = 0; i < 3; i++)
            {
                foreach (String itemName in _reservationDao.GetAvailableItems((Course)i))
                {
                    Item item = _reservationDao.GetItemByName(itemName);
                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div.Attributes.Add("class", "itemDiv");
                    HtmlGenericControl name = new HtmlGenericControl("p");
                    name.Attributes.Add("class", "item");
                    name.InnerText = item.Name;
                    HtmlGenericControl category = new HtmlGenericControl("p");
                    category.Attributes.Add("class", "category");
                    category.InnerText = item.Category.ToString();
                    HtmlGenericControl desc = new HtmlGenericControl("p");
                    desc.Attributes.Add("class", "desc");
                    desc.InnerText = item.Description;
                    div.Controls.Add(name);
                    div.Controls.Add(category);
                    div.Controls.Add(desc);
                    switch (i)
                    {
                    case 0:
                        appCont.Controls.Add(div);
                        break;

                    case 1:
                        mainCont.Controls.Add(div);
                        break;

                    case 2:
                        dessCont.Controls.Add(div);
                        break;

                    default:
                        break;
                    }
                }
            }
        }