Beispiel #1
0
        public void UnesiUslugu(Usluga usluga)
        {
            try
            {
                LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString);

                _baza.ResetujBrojac("Usluga", "UslugaID");

                if (usluga.Sifra == null)
                {
                    usluga.Sifra = "S-" + _baza.DajSledeciIdentity("Usluga").ToString();
                }
               

                _baza.Uslugas.InsertOnSubmit(usluga);

                _baza.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public void IzmeniUslugu(Usluga usluga, Usluga uslugaOrginal)
        {
            try
            {
                LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString);

                _baza.Uslugas.Attach(usluga, uslugaOrginal);

                _baza.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        public void ObrisiUslugu(Usluga usluga)
        {
            try
            {
                LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString);

                //ovo mora zato sto se radnik ne moze dodati u ovaj DataContext zato sto pripada nekom drugom
                DB.Usluga _usluga = new DB.Usluga
                {
                    UslugaID = usluga.UslugaID,
                    Sifra = usluga.Sifra,
                    VrstaUslugeID = usluga.VrstaUslugeID,
                    NosilacGrupeID = usluga.NosilacGrupeID,
                    NivoID = usluga.NivoID,
                    NormaMinuta = usluga.NormaMinuta,
                    BrojBodova = usluga.BrojBodova,
                    BodID = usluga.BodID,
                    PoreskaStopaID = usluga.PoreskaStopaID,
                    ZaExport = usluga.ZaExport
                };

                _baza.Uslugas.Attach(_usluga);
                _baza.Uslugas.DeleteOnSubmit(_usluga);
                _baza.SubmitChanges();

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }