예제 #1
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void DeleteLogIn(int id)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                List<LogInn> users = GetUsers();

                var x = (from b in ctx.LogInns where b.id == id select b).FirstOrDefault();
                if (x != null && x.id <= users.Count)
                {

                    ctx.LogInns.Remove(x);
                    ctx.SaveChanges();
                }
            }
        }
예제 #2
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void InsertAdmin(string nume , string prenume)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                Administrator admin = new Administrator()
                {
                    //id_grupa = id,
                    Nume = nume,
                    Prenume = prenume
                };

                ctx.Administrators.Add(admin);
                ctx.SaveChanges();

            }
        }
예제 #3
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void InsertLogIn(string nume, string parola, int permis)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                LogInn login = new LogInn()
                {
                    username = nume,
                    parola = parola,
                    permis = permis
                };

                ctx.LogInns.Add(login);
                ctx.SaveChanges();

            }
        }
예제 #4
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void DeleteAdmin(int id)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                

                var x = (from b in ctx.Administrators where b.id_admin == id select b).FirstOrDefault();
                if (x != null)
                {

                    ctx.Administrators.Remove(x);
                    ctx.SaveChanges();
                }
            }
        }
예제 #5
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void DeleteStudenti(int id)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                List<Student> student = GetStudent();

                var x = (from b in ctx.Students where b.id_stud == id select b).FirstOrDefault();
                if (x != null )
                {

                    ctx.Students.Remove(x);
                    ctx.SaveChanges();
                }
            }
        }
예제 #6
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void InserStudent(string nume, string prenume,string initiala,string cnp,string adresa,string telefon,string tip,float taxa,string numegrupa,int credite,string email)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                Student student = new Student()
                {
                    //id_stud =id,
                    Nume = nume,
                    Prenume = prenume,
                    Initiala_Parinte = initiala,
                    CNP = cnp,
                    Adresa = adresa,
                    Telefon = telefon,
                    Tip = tip,
                    Taxa = taxa,
                    nume_grupa = numegrupa,
                    Credite = credite,
                    email = email
                };

                ctx.Students.Add(student);
                ctx.SaveChanges();

            }
        }
예제 #7
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
 public static void DeleteProfesor(int id)
 {
     using (ProiectBazeContext ctx = new ProiectBazeContext())
     {
         var delProf = (from x in ctx.Profesors where x.id_prof == id select x).FirstOrDefault();
         ctx.Profesors.Remove(x);
         ctx.SaveChanges();
     }
 }
예제 #8
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void InsertProfesor(string nume,string prenume,string telefon,string departamen,string statut,string email, string tip,string user,string pass)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                Profesor profesor = new Profesor()
                {
                    Nume = nume,
                    Prenume = prenume,
                    Telefon = telefon,
                    Departament = departamen,
                    Statut = statut,
                    email = email,
                    Tip = tip

                };
                ctx.Profesors.Add(profesor);
                ctx.SaveChanges();
                InsertLogIn(user, pass, 1);
               
            }
        }
예제 #9
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void DeleteGrupa(int id)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                List<Grupe> grupa = GetGrupe();

                var x = (from b in ctx.Grupes where b.id_grupa == id select b).FirstOrDefault();
                if (x != null)
                {

                    ctx.Grupes.Remove(x);
                    ctx.SaveChanges();
                }
            }
        }
예제 #10
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void InsertGrupe(string numegrupa, int an, int nr, string indrumator)
        {
            using (ProiectBazeContext ctx = new ProiectBazeContext())
            {
                Grupe grupa = new Grupe()
                {
                    //id_grupa = id,
                    nume_grupa = numegrupa,
                    an = an,
                    indrumator = indrumator,
                    nr_std = nr
                };

                ctx.Grupes.Add(grupa);
                ctx.SaveChanges();

            }
        }
예제 #11
0
파일: Data.cs 프로젝트: slg2011/5-dimineata
        public static void DeleteDisciplina(int id)
        { 
             using (ProiectBazeContext ctx = new ProiectBazeContext())
             {
             var x = (from b in ctx.Disciplinas where b.id_disc == id select b).FirstOrDefault();
                if (x != null )
                {

                    ctx.Disciplinas.Remove(x);
                    ctx.SaveChanges();
                }
             }
        }