Example #1
0
        public domain.TehnologijaCollection GetByOblastId(int a)
        {
            model.LearnByPracticeDataContext context = CreateContext();
            DataLoadOptions options = new DataLoadOptions();

            options.LoadWith <model.Tehnologija>(tehnologija => tehnologija.Oblast);
            context.LoadOptions = options;
            var tehnologii = from t in context.Tehnologijas
                             where t.Oblast_ID == a
                             select t;

            domain.TehnologijaCollection result = new domain.TehnologijaCollection();
            foreach (model.Tehnologija teh in tehnologii)
            {
                domain.Tehnologija domainObject = new domain.Tehnologija();
                domainObject.Id        = teh.ID;
                domainObject.Ime       = teh.Ime;
                domainObject.oblast.Id = teh.Oblast_ID;
                if (teh.Oblast != null)
                {
                    domainObject.oblast.Id  = teh.Oblast.ID;
                    domainObject.oblast.Ime = teh.Oblast.Ime;
                }
                result.Add(domainObject);
            }
            return(result);
        }
Example #2
0
 public domain.Korisnik Update(domain.Korisnik domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Korisnik> query = context.Korisniks.Where(p => p.ID == domainObject.Id);
         model.Korisnik modelObject        = query.Single();
         modelObject.Korisnichko_Ime = domainObject.Username;
         modelObject.Lozinka         = domainObject.PasswordOdNiza;
         modelObject.Ime             = domainObject.Ime;
         modelObject.Prezime         = domainObject.Prezime;
         modelObject.Pol             = ToModel(domainObject.Pol);
         modelObject.Organizacija_ID = domainObject.organizacija.Id;
         modelObject.Email           = domainObject.Email;
         modelObject.Telefonski_Broj = domainObject.Mobilen;
         modelObject.Mentor          = domainObject.Mentor;
         modelObject.Student         = domainObject.Student;
         if (modelObject.Student == true)
         {
             modelObject.Studiska_Programa_ID = domainObject.studiskaPrograma.Id;
         }
         else
         {
             modelObject.Studiska_Programa_ID = null;
         }
         modelObject.Administrator = domainObject.Administrator;
         context.SubmitChanges();
         domain.Korisnik result = ToDomain(modelObject);
         return(result);
     }
 }
        public domain.OrganizacijaCollection GetByVidOrganizacijaId(int a)
        {
            model.LearnByPracticeDataContext context = CreateContext();
            DataLoadOptions options = new DataLoadOptions();

            options.LoadWith <model.Organizacija>(organizacija => organizacija.Vid_Organizacija);
            context.LoadOptions = options;
            var organizacii = from vO in context.Organizacijas
                              where vO.Vid_Organizacija_ID == a
                              select vO;

            domain.OrganizacijaCollection result = new domain.OrganizacijaCollection();
            foreach (model.Organizacija vidOrg in organizacii)
            {
                domain.Organizacija domainObject = new domain.Organizacija();
                domainObject.Id                 = vidOrg.ID;
                domainObject.Ime                = vidOrg.Ime;
                domainObject.KontaktTelefon     = vidOrg.Kontakt_Telefon;
                domainObject.VebStrana          = vidOrg.Veb_Strana;
                domainObject.Adresa             = vidOrg.Adresa;
                domainObject.vidOrganizacija.Id = vidOrg.Vid_Organizacija_ID;

                if (vidOrg.Vid_Organizacija != null)
                {
                    domainObject.vidOrganizacija.Id  = vidOrg.Vid_Organizacija.ID;
                    domainObject.vidOrganizacija.Ime = vidOrg.Vid_Organizacija.Ime;
                }
                result.Add(domainObject);
            }

            return(result);
        }
Example #4
0
        public domain.TehnologijaCollection GetAll()
        {
            model.LearnByPracticeDataContext context = CreateContext();
            DataLoadOptions options = new DataLoadOptions();

            options.LoadWith <model.Tehnologija>(tehnologija => tehnologija.Oblast);
            context.LoadOptions = options;
            IQueryable <model.Tehnologija> query = context.Tehnologijas;

            domain.TehnologijaCollection result = new domain.TehnologijaCollection();
            foreach (model.Tehnologija modelObject in query)
            {
                domain.Tehnologija domainObject = new domain.Tehnologija();
                domainObject.Id        = modelObject.ID;
                domainObject.Ime       = modelObject.Ime;
                domainObject.oblast.Id = modelObject.Oblast_ID;
                if (modelObject.Oblast != null)
                {
                    domainObject.oblast.Id  = modelObject.Oblast.ID;
                    domainObject.oblast.Ime = modelObject.Oblast.Ime;
                }
                result.Add(domainObject);
            }

            return(result);
        }
Example #5
0
        public domain.KorisnikCollection GetAll()
        {
            model.LearnByPracticeDataContext context = CreateContext();
            IQueryable <model.Korisnik>      query   = context.Korisniks;

            domain.KorisnikCollection result = ToDomainObjects(query);

            return(result);
        }
        public domain.PrijavaStudentCollection GetByKorisnikId(int KorisnikId)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Prijava_Korisnik> query         = context.Prijava_Korisniks.Where(c => c.Korisnik_ID == KorisnikId);
                domain.PrijavaStudentCollection     domainObjects = ToDomainObjects(query.ToList());

                return(domainObjects);
            }
        }
Example #7
0
        public domain.KorisnikCollection GetByStudiskaProgramaId(int StudiskaProgramaId)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Korisnik> query         = context.Korisniks.Where(c => c.Studiska_Programa_ID == StudiskaProgramaId);
                domain.KorisnikCollection   domainObjects = ToDomainObjects(query.ToList());

                return(domainObjects);
            }
        }
        public domain.OcenaCollection GetByPredmetId(int PredmetId)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Ocenka> query         = context.Ocenkas.Where(c => c.Predmet_ID == PredmetId);
                domain.OcenaCollection    domainObjects = ToDomainObjects(query.ToList());

                return(domainObjects);
            }
        }
        public domain.VidOrganizacija Get(int id)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Vid_Organizacija> query = context.Vid_Organizacijas.Where(c => c.ID == id);

                domain.VidOrganizacija domainObject = ToDomain(query.Single());

                return(domainObject);
            }
        }
Example #10
0
        public domain.Korisnik Get(int id)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Korisnik> query = context.Korisniks.Where(c => c.ID == id);

                domain.Korisnik domainObject = ToDomain(query.Single());

                return(domainObject);
            }
        }
Example #11
0
        public domain.StudiskaPrograma Get(int id)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Studiska_Programa> query = context.Studiska_Programas.Where(c => c.ID == id);

                domain.StudiskaPrograma domainObject = ToDomain(query.Single());

                return(domainObject);
            }
        }
        public domain.PrijavaTehnologijaCollection GetByTehnologijaId(int TehId)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Prijava_Tehnologija> query = context.Prijava_Tehnologijas.Where(c => c.Tehnologija_ID == TehId);

                domain.PrijavaTehnologijaCollection domainObjects = ToDomainObjects(query.ToList());

                return(domainObjects);
            }
        }
 public domain.VidOrganizacija Update(domain.VidOrganizacija domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Vid_Organizacija> query = context.Vid_Organizacijas.Where(p => p.ID == domainObject.Id);
         model.Vid_Organizacija modelObject        = query.Single();
         modelObject.Ime = domainObject.Ime;
         context.SubmitChanges();
         domain.VidOrganizacija result = ToDomain(modelObject);
         return(result);
     }
 }
 public domain.VidOrganizacija Insert(domain.VidOrganizacija domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         model.Vid_Organizacija modelObject = new model.Vid_Organizacija();
         modelObject.Ime = domainObject.Ime;
         context.Vid_Organizacijas.InsertOnSubmit(modelObject);
         context.SubmitChanges();
         domain.VidOrganizacija result = ToDomain(modelObject);
         return(result);
     }
 }
 public domain.Ocena Update(domain.Ocena domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Ocenka> query = context.Ocenkas.Where(p => p.Korisnik_ID == domainObject.student.Id && p.Predmet_ID == domainObject.predmet.Id);
         model.Ocenka modelObject        = query.Single();
         modelObject.Ocenka1 = domainObject.Ocenka;
         context.SubmitChanges();
         domain.Ocena result = ToDomain(modelObject);
         return(result);
     }
 }
Example #16
0
 public domain.StudiskaPrograma Update(domain.StudiskaPrograma domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Studiska_Programa> query = context.Studiska_Programas.Where(p => p.ID == domainObject.Id);
         model.Studiska_Programa modelObject        = query.Single();
         modelObject.Ime = domainObject.Ime;
         context.SubmitChanges();
         domain.StudiskaPrograma result = ToDomain(modelObject);
         return(result);
     }
 }
 public domain.Prijava Update(domain.Prijava domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Prijava> query = context.Prijavas.Where(p => p.ID == domainObject.Id);
         model.Prijava modelObject        = query.Single();
         modelObject.Organizacija_ID = domainObject.organizacija.Id;
         context.SubmitChanges();
         domain.Prijava result = ToDomain(modelObject);
         return(result);
     }
 }
Example #18
0
 public domain.Oblast Update(domain.Oblast domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Oblast> query = context.Oblasts.Where(p => p.ID == domainObject.Id);
         model.Oblast modelObject        = query.Single();
         modelObject.Ime = domainObject.Ime;
         context.SubmitChanges();
         domain.Oblast result = ToDomain(modelObject);
         return(result);
     }
 }
Example #19
0
        public domain.StudiskaPrograma Insert(domain.StudiskaPrograma domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Studiska_Programa modelObject = new model.Studiska_Programa();
                modelObject.Ime = domainObject.Ime;
                context.Studiska_Programas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.StudiskaPrograma result = ToDomain(modelObject);

                return(result);
            }
        }
 public domain.PrijavaTehnologija Update(domain.PrijavaTehnologija domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Prijava_Tehnologija> query = context.Prijava_Tehnologijas.Where(p => p.Prijava_ID == domainObject.prijava.Id);
         model.Prijava_Tehnologija modelObject        = query.Single();
         modelObject.Tehnologija_ID = domainObject.tehnologija.Id;
         modelObject.Prijava_ID     = domainObject.prijava.Id;
         context.SubmitChanges();
         domain.PrijavaTehnologija result = ToDomain(modelObject);
         return(result);
     }
 }
Example #21
0
 public domain.Predmet Update(domain.Predmet domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Predmet> query = context.Predmets.Where(p => p.ID == domainObject.Id);
         model.Predmet modelObject        = query.Single();
         modelObject.Shifra_Na_Predmet = domainObject.ShifraNaPredmet;
         modelObject.Ime = domainObject.Ime;
         context.SubmitChanges();
         domain.Predmet result = ToDomain(modelObject);
         return(result);
     }
 }
 public domain.PrijavaStudent Update(domain.PrijavaStudent domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Prijava_Korisnik> query = context.Prijava_Korisniks.Where(p => p.Korisnik_ID == domainObject.student.Id);
         model.Prijava_Korisnik modelObject        = query.Single();
         modelObject.Korisnik_ID = domainObject.student.Id;
         modelObject.Prijava_ID  = domainObject.prijava.Id;
         context.SubmitChanges();
         domain.PrijavaStudent result = ToDomain(modelObject);
         return(result);
     }
 }
Example #23
0
        public domain.Oblast Insert(domain.Oblast domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Oblast modelObject = new model.Oblast();
                modelObject.Ime = domainObject.Ime;
                context.Oblasts.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.Oblast result = ToDomain(modelObject);

                return(result);
            }
        }
        public domain.PrijavaTehnologija Insert(domain.PrijavaTehnologija domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Prijava_Tehnologija modelObject = new model.Prijava_Tehnologija();
                modelObject.Tehnologija_ID = domainObject.tehnologija.Id;
                modelObject.Prijava_ID     = domainObject.prijava.Id;
                context.Prijava_Tehnologijas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.PrijavaTehnologija result = ToDomain(modelObject);

                return(result);
            }
        }
Example #25
0
        public domain.Predmet Insert(domain.Predmet domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Predmet modelObject = new model.Predmet();
                modelObject.Shifra_Na_Predmet = domainObject.ShifraNaPredmet;
                modelObject.Ime = domainObject.Ime;
                context.Predmets.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.Predmet result = ToDomain(modelObject);

                return(result);
            }
        }
        public domain.PrijavaStudent Insert(domain.PrijavaStudent domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Prijava_Korisnik modelObject = new model.Prijava_Korisnik();
                modelObject.Prijava_ID  = domainObject.prijava.Id;
                modelObject.Korisnik_ID = domainObject.student.Id;
                context.Prijava_Korisniks.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.PrijavaStudent result = ToDomain(modelObject);

                return(result);
            }
        }
        public domain.Prijava Insert(domain.Prijava domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Prijava modelObject = new model.Prijava();
                modelObject.Organizacija_ID       = domainObject.organizacija.Id;
                modelObject.Datum_Na_Prijavuvanje = domainObject.Datum;
                context.Prijavas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.Prijava result = ToDomain(modelObject);

                return(result);
            }
        }
Example #28
0
        public domain.Tehnologija Insert(domain.Tehnologija domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Tehnologija modelObject = new model.Tehnologija();
                modelObject.Ime       = domainObject.Ime;
                modelObject.Oblast_ID = domainObject.oblast.Id;
                context.Tehnologijas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.Tehnologija result = ToDomain(modelObject);

                return(result);
            }
        }
        public domain.Organizacija Get(int id)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                DataLoadOptions options = new DataLoadOptions();
                options.LoadWith <model.Organizacija>(organizacija => organizacija.Vid_Organizacija);
                context.LoadOptions = options;

                IQueryable <model.Organizacija> query = context.Organizacijas.Where(c => c.ID == id);

                domain.Organizacija domainObject = ToDomain(query.Single());

                return(domainObject);
            }
        }
        public domain.Ocena Insert(domain.Ocena domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Ocenka modelObject = new model.Ocenka();
                modelObject.Korisnik_ID = domainObject.student.Id;
                modelObject.Predmet_ID  = domainObject.predmet.Id;
                modelObject.Ocenka1     = domainObject.Ocenka;
                context.Ocenkas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.Ocena result = ToDomain(modelObject);

                return(result);
            }
        }