Exemple #1
0
        public void insertNewWypo(object sender, EventArgs e)
        {
            using (StrzelnicaEntities strzelnicaEntities = new StrzelnicaEntities())
            {
                WYPOZYCZENIA wypo = new WYPOZYCZENIA()
                {
                    ID_KLIENTA              = NWKlieGrid.SelectedCells[0].RowIndex,
                    ID_TRENERA              = NWTreGrid.SelectedCells[0].RowIndex,
                    ID_STANOWISKA           = NWStaGrid.SelectedCells[0].RowIndex,
                    ID_BRONI                = NWBroGrid.SelectedCells[0].RowIndex,
                    ILOSC_PAKIETOW_AMUNICJI = (int)NWAmoNum.Value,
                    DATA_POCZATEK           = NWDatPoczPick.Value,
                    DATA_KONIEC             = NWDatKonPick.Value
                };

                strzelnicaEntities.WYPOZYCZENIA.Add(wypo);
                strzelnicaEntities.SaveChanges();
            }
        }
Exemple #2
0
        private void editKlient(object sender, EventArgs e)
        {
            using (StrzelnicaEntities strz = new StrzelnicaEntities())
            {
                int          id           = (int)EWWybNum.Value;
                WYPOZYCZENIA wypozyczenia = strz.WYPOZYCZENIA.Find(id);

                if (!EWKlieGrid.SelectedCells[0].RowIndex.Equals(null))
                {
                    wypozyczenia.ID_KLIENTA = EWKlieGrid.SelectedCells[0].RowIndex;
                }

                if (!EWTrenGrid.SelectedCells[0].RowIndex.Equals(null))
                {
                    wypozyczenia.ID_TRENERA = EWTrenGrid.SelectedCells[0].RowIndex;
                }

                if (!EWStanGrid.SelectedCells[0].RowIndex.Equals(null))
                {
                    wypozyczenia.ID_STANOWISKA = EWStanGrid.SelectedCells[0].RowIndex;
                }

                if (EWBronGrid.SelectedCells[0].RowIndex.Equals(null))
                {
                    wypozyczenia.ID_BRONI = EWBronGrid.SelectedCells[0].RowIndex;
                }

                if (!EWIloscNum.Value.Equals(null))
                {
                    wypozyczenia.ILOSC_PAKIETOW_AMUNICJI = (int)EWIloscNum.Value;
                }

                strz.SaveChanges();
                this.Close();
            }
        }