Esempio n. 1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ValidateValues();
                UpdateFormular();
                formularService.UpdateFormular(formular);    //nu se actualizeaza in baza de date....

                using (RoomsContext roomsContext = new RoomsContext())
                {
                    var newStare = roomsContext.Formular.Max(x => x.StareFormular);

                    var returnedFormular = roomsContext.Formular.Where(x => x.StareFormular == newStare).ToString();


                    roomsContext.SaveChanges();
                }

                this.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Esempio n. 2
0
        public student GetStudent(int student_id)
        {
            using (RoomsContext context = new RoomsContext())
            {
                var student_form = (from student in context.Student.Where(x => x.id == student_id)
                                    select student).FirstOrDefault();

                return(student_form);
            }
        }
Esempio n. 3
0
        public List <formular> GetFormulars()
        {
            using (RoomsContext context = new RoomsContext())

            { var formulare_utilizator = (from formular in context.Formular
                                          join student in context.Student on formular.studentID equals student.id
                                          where formular.StareFormular == 0
                                          orderby student.medie descending select formular).ToList();

              return(formulare_utilizator); }
        }
Esempio n. 4
0
 public MainWindow()
 {
     InitializeComponent();
     using (var context = new RoomsContext())
     {
         var Rol_Utilizator = new Rol_Utilizator
         {
             rol = "administrator"
         };
         context.Tip.Add(Rol_Utilizator);
         context.SaveChanges();
     }
 }
Esempio n. 5
0
        public int GetStareFormular2()
        {
            using (RoomsContext context = new RoomsContext())
            {
                var returneaza_form_conditionat = (from formular in context.Formular
                                                   where formular.StareFormular == Formular_Status.Respins &&
                                                   formular.studentID == Utilizator.id
                                                   select formular).FirstOrDefault();

                if (returneaza_form_conditionat != null)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }