Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Zakaznik c = (Zakaznik)Session["login"];

            if (!Page.IsPostBack)
            {
                Collection <Zbran>   zbrane   = Zbran.SelectAll();
                Collection <Prostor> prostory = Prostor.SelectAll();

                DropDownList1.DataSource     = zbrane;
                DropDownList1.DataTextField  = "Nazev";
                DropDownList1.DataValueField = "Id";

                DropDownList2.DataSource     = prostory;
                DropDownList2.DataTextField  = "Vzdalenost";
                DropDownList2.DataValueField = "Id";

                DropDownList1.DataBind();
                DropDownList2.DataBind();
            }



            if (IsPostBack)
            {
                Bul0056.Aggregates.Rezervace rez = new Bul0056.Aggregates.Rezervace();
                rez.Start     = DateTime.Parse(TextBox1.Text);
                rez.Vytvoreni = DateTime.Now;
                rez.Zakaznik  = c;
                rez.Zbran     = Zbran.getById(Int32.Parse(DropDownList1.SelectedValue));
                rez.Prostor   = Prostor.getById(Int32.Parse(DropDownList2.SelectedValue));
                Bul0056.Aggregates.Rezervace.insert(rez);
            }
        }
Esempio n. 2
0
        protected void GetData()
        {
            Collection <Zbran>  zbrane      = Zbran.SelectAll();
            BindingList <Zbran> bindingList = new BindingList <Zbran>(zbrane);

            dataGridView1.DataSource = bindingList;
        }