Example #1
0
        protected void GetData()
        {
            Collection <Prostor>  spraznici   = ProstorTable.select();
            BindingList <Prostor> bindingList = new BindingList <Prostor>(spraznici);

            SprGrid.DataSource = bindingList;
        }
Example #2
0
        private bool GetData()
        {
            Collection <Zakaznik>    zakaznici   = ZakaznikTable.select();
            Collection <Zamestnanec> zamestnanci = ZamestnanecTable.select();
            Collection <Zbran>       zbrane      = ZbranTable.select();
            Collection <Prostor>     prostory    = ProstorTable.select();

            strelba.Zacatek           = dateTimePicker1.Value;
            strelba.Konec             = dateTimePicker2.Value;
            strelba.Zakaznik_idZak    = zakaznici[comboBox1.SelectedIndex].idZak;
            strelba.Zamestnanec_idZam = zamestnanci[comboBox2.SelectedIndex].idZam;
            strelba.Zbran_idZbr       = zbrane[comboBox3.SelectedIndex].idZbr;
            strelba.Prostor_idSpr     = prostory[comboBox4.SelectedIndex].idSpr;
            return(true);
        }
Example #3
0
 public bool OpenRecord(object primaryKey)
 {
     if (primaryKey != null)
     {
         int idSpr = (int)primaryKey;
         prostor   = ProstorTable.select(idSpr);
         newRecord = false;
     }
     else
     {
         prostor   = new Prostor();
         newRecord = true;
     }
     BindData();
     return(true);
 }
Example #4
0
        private void BindData()
        {
            Collection <Zakaznik>    zakaznici   = ZakaznikTable.select();
            Collection <Zamestnanec> zamestnanci = ZamestnanecTable.select();
            Collection <Zbran>       zbrane      = ZbranTable.select();
            Collection <Prostor>     prostory    = ProstorTable.select();

            foreach (Zakaznik zakaznik in zakaznici)
            {
                comboBox1.Items.Add(zakaznik.Jmeno + " " + zakaznik.Prijmeni);
                if (zakaznik.idZak == strelba.Zakaznik_idZak)
                {
                    comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
                }
            }

            foreach (Zamestnanec zamestnanec in zamestnanci)
            {
                comboBox2.Items.Add(zamestnanec.Jmeno + " " + zamestnanec.Prijmeni);
                if (zamestnanec.idZam == strelba.Zamestnanec_idZam)
                {
                    comboBox2.SelectedIndex = comboBox2.Items.Count - 1;
                }
            }

            foreach (Zbran zbran in zbrane)
            {
                comboBox3.Items.Add(zbran.Nazev);
                if (zbran.idZbr == strelba.Zbran_idZbr)
                {
                    comboBox3.SelectedIndex = comboBox3.Items.Count - 1;
                }
            }

            foreach (Prostor prostor in prostory)
            {
                comboBox4.Items.Add(prostor.idSpr.ToString() + " " + prostor.vzdalenost.ToString());
                if (prostor.idSpr == strelba.Prostor_idSpr)
                {
                    comboBox4.SelectedIndex = comboBox4.Items.Count - 1;
                }
            }

            dateTimePicker1.Value = strelba.Zacatek;
            dateTimePicker2.Value = strelba.Konec;
        }
Example #5
0
 protected bool SaveRecord()
 {
     if (GetData())
     {
         if (newRecord)
         {
             ProstorTable.insert(prostor);
         }
         else
         {
             ProstorTable.update(prostor);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #6
0
        private bool GetData()
        {
            Collection <Zakaznik> zakaznici = ZakaznikTable.select();
            Collection <Zbran>    zbrane    = ZbranTable.select();
            Collection <Prostor>  prostory  = ProstorTable.select();

            if (comboBox1.SelectedIndex >= 0 && comboBox2.SelectedIndex >= 0 && comboBox3.SelectedIndex >= 0)
            {
                rezervace.datumVytvoreni = DateTime.Now;
                rezervace.datumStrelby   = dateTimePicker2.Value;
                rezervace.Zakaznik_idZak = zakaznici[comboBox1.SelectedIndex].idZak;
                rezervace.Zbran_idZbr    = zbrane[comboBox2.SelectedIndex].idZbr;
                rezervace.Prostor_idSpr  = prostory[comboBox3.SelectedIndex].idSpr;
                label2.Visible           = false;
                return(true);
            }

            else
            {
                label2.Visible = true;
                return(false);
            }
        }
Example #7
0
        private void BindData()
        {
            Collection <Zakaznik> zakaznici = ZakaznikTable.select();
            Collection <Zbran>    zbrane    = ZbranTable.select();
            Collection <Prostor>  prostory  = ProstorTable.select();

            foreach (Zakaznik zakaznik in zakaznici)
            {
                comboBox1.Items.Add(zakaznik.Jmeno + " " + zakaznik.Prijmeni);
            }

            foreach (Zbran zbran in zbrane)
            {
                comboBox2.Items.Add(zbran.Nazev);
            }

            foreach (Prostor prostor in prostory)
            {
                comboBox3.Items.Add(prostor.idSpr.ToString() + " " + prostor.vzdalenost.ToString());
            }

            dateTimePicker2.Value = rezervace.datumStrelby;
        }
Example #8
0
 protected void DeleteRecord()
 {
     ProstorTable.delete(prostor.idSpr);
 }