Esempio n. 1
0
        public bool SetPracownik(Pracownik input, int[] classes)
        {
            if (this.konto == null)
            {
                return(false);
            }
            DBPracownik newPra = new DBPracownik()
            {
                Imie                = input.Imie,
                Class_Imie          = classes[0],
                Nazwisko            = input.Nazwisko,
                Class_Nazwisko      = classes[1],
                Data_zaczecia       = input.Data_zaczecia,
                Class_Data_zaczecia = classes[2],
                Stanowisko          = input.Stanowisko,
                Class_Stanowisko    = classes[3],
                ID_Konto            = input.ID_Konto,
                Class               = classes[4]
            };

            if (Locker <DBPracownik> .Lock(newPra, LockWritePracownik))
            {
                ctx.Pracownik.Add(newPra);
                ctx.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public bool SetKlient(Klient input, int[] classes)
        {
            if (this.konto == null)
            {
                return(false);
            }
            DBKlient newKli = new DBKlient()
            {
                Imie           = input.Imie,
                Class_Imie     = classes[0],
                Nazwisko       = input.Nazwisko,
                Class_Nazwisko = classes[1],
                Adres          = input.Adres,
                Class_Adres    = classes[2],
                ID_Konto       = input.ID_Konto,
                Class          = classes[3]
            };

            if (Locker <DBKlient> .Lock(newKli, LockWriteKlient))
            {
                ctx.Klient.Add(newKli);
                ctx.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public bool SetProdukt(Produkt input, int[] classes)
        {
            if (this.konto == null)
            {
                return(false);
            }
            DBProdukt newProd = new DBProdukt()
            {
                Nazwa            = input.Nazwa,
                Class_Nazwa      = classes[0],
                Cena             = input.Cena,
                Class_Cena       = classes[1],
                Dostepnosc       = input.Dostepnosc,
                Class_Dostepnosc = classes[2],
                Class            = classes[3]
            };

            if (Locker <DBProdukt> .Lock(newProd, LockWriteProdukt))
            {
                ctx.Produkt.Add(newProd);
                ctx.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        public bool SetKonto(Konto input, int[] classes, string pass)
        {
            if (this.konto == null)
            {
                return(false);
            }
            string  hash   = pass + "a6s8d";
            DBKonto newKon = new DBKonto()
            {
                Login = input.Login, Haslo = md5Hash.GetMD5Hash(hash), Salt = "a6s8d", Clear = input.Clear, Class_Haslo = classes[1], Class = classes[3], Class_Login = classes[0], Class_salt = classes[2]
            };

            if (Locker <DBKonto> .Lock(newKon, LockWriteKonta))
            {
                ctx.Konto.Add(newKon);
                ctx.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public bool SetZam_prody(zam_prod input, int[] classes)
        {
            if (this.konto == null)
            {
                return(false);
            }
            DBzam_prod newProdOrd = new DBzam_prod()
            {
                ID_Produkt    = input.ID_Produkt,
                ID_Zamowienia = input.ID_Zamowienia,
                Ilosc         = input.Ilosc,
                Class_Ilosc   = classes[0],
                Class         = classes[1]
            };

            if (Locker <DBzam_prod> .Lock(newProdOrd, LockWriteZam_prod))
            {
                ctx.zam_prod.Add(newProdOrd);
                ctx.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
        public bool SetZam(Zamowienia input, int[] classes)
        {
            if (this.konto == null)
            {
                return(false);
            }
            DBZamowienia newOrder = new DBZamowienia()
            {
                ID_Klienta          = input.ID_Klienta,
                Data_zlozenia       = input.Data_zlozenia,
                Class_Data_zlozenia = classes[1],
                Status       = input.Status,
                Class_Status = classes[0],
                Class        = classes[2]
            };

            if (Locker <DBZamowienia> .Lock(newOrder, LockWriteZamowienia))
            {
                ctx.Zamowienia.Add(newOrder);
                ctx.SaveChanges();
                return(true);
            }
            return(false);
        }