示例#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);
            }
        }
示例#2
0
 public bool OpenRecord(object primaryKey)
 {
     if (primaryKey != null)
     {
         int idZbr = (int)primaryKey;
         zbran     = Zbran.getById(idZbr);
         newRecord = false;
     }
     else
     {
         zbran     = new Zbran();
         newRecord = true;
     }
     BindData();
     return(true);
 }