Exemplo n.º 1
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     WheelViewModel     = new WheelVM(SimulatorModel);
     DashboardViewModel = new DashboardVM(SimulatorModel);
     GameMapViewModel   = new GameMapVM(SimulatorModel);
     ExceptionViewModel = new ExceptionVM(SimulatorModel);
 }
        public ExceptionWindow(Application a, Exception e)
        {
            _application = a;
            DataContext  = new ExceptionVM(e);

            InitializeComponent();
        }
        public ActionResult Index()
        {
            ExceptionVM model               = new ExceptionVM();
            var         Student             = db.Users.Where(h => h.Role.id == 1).ToList();
            var         studentWithoutTutor = db.Users.Where(h => h.Role.id == 1 && h.GroupMember == null).ToList();

            model.StdWithoutTutor = studentWithoutTutor;
            var chatList = db.Chats.Select(h => h.SendPersonId).Distinct().ToList();
            var n        = new List <int>();
            var stdList  = new List <User>();

            foreach (var item in Student)
            {
                if (!chatList.Contains(item.id))
                {
                    n.Add(item.id);
                }
            }
            foreach (var item in n)
            {
                var std = db.Users.Where(h => h.id == item).FirstOrDefault();
                stdList.Add(std);
            }
            model.StdWithoutInteract = stdList.ToList();
            return(View(model));
        }
        private void BtnValider_OnClick(object sender, RoutedEventArgs e)

        {
            if (NbMachinesSelected == 0)
            {
                MessageBox.Show("Merci de saisir au moins une machine !", "Erreur Machines", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
                return;
            }
            LesExceptionsToSave = new List <ExceptionVM>();
            if (VerifContenuSaisie())
            {
                ExceptionVM exeptToSave1 = new ExceptionVM(LesMachinesSelected, DateDuJour,
                                                           CbPoste1.SelectedItem.ToString(), new TimeSpan(int.Parse(Tb1D1.Text), int.Parse(Tb1D2.Text), 0),
                                                           new TimeSpan(int.Parse(Tb1F1.Text), int.Parse(Tb1F2.Text), 0));
                ExceptionVM exeptToSave2 = new ExceptionVM(LesMachinesSelected, DateDuJour,
                                                           CbPoste2.SelectedItem.ToString(), new TimeSpan(int.Parse(Tb2D1.Text), int.Parse(Tb2D2.Text), 0),
                                                           new TimeSpan(int.Parse(Tb2F1.Text), int.Parse(Tb2F2.Text), 0));

                LesExceptionsToSave.Add(exeptToSave1);
                LesExceptionsToSave.Add(exeptToSave2);

                if (CbPoste3.SelectedItem != null)
                {
                    ExceptionVM exeptToSave3 = new ExceptionVM(LesMachinesSelected, DateDuJour,
                                                               CbPoste3.SelectedItem.ToString(), new TimeSpan(int.Parse(Tb3D1.Text), int.Parse(Tb3D2.Text), 0),
                                                               new TimeSpan(int.Parse(Tb3F1.Text), int.Parse(Tb3F2.Text), 0));
                    LesExceptionsToSave.Add(exeptToSave3);
                }
                PageRepetitionExep pre = new PageRepetitionExep(this);
                pre.ShowDialog();
                //DataBase.SaveExceptionInBDD(LesExceptionsToSave);
            }

            /*foreach (ExceptionVM exceptionVm in lesExceptionsToSave)
             * {
             *  foreach (MachineVM machineVm in exceptionVm.LesMachines)
             *  {
             *      _mainView.LesElementsAAfficher.Add(new ExceptionUVM(machineVm.NoMachine, exceptionVm.Date, exceptionVm.Poste, exceptionVm.HeureD, exceptionVm.HeureF));
             *  }
             * }*/
            _mainView.AddItems();
            this.Close();
        }
Exemplo n.º 5
0
        public static int DetermineNoLigne(ExceptionVM exception)
        {
            int        res = 0;
            SqlCommand cmd = new SqlCommand
            {
                Connection  = _conn,
                CommandText =
                    "SELECT COUNT(*) FROM MACHINES_CALENDRIER WHERE DATE = @date AND NOMACHINE != @nomachine"
            };

            cmd.Parameters.AddWithValue("@date", exception.Date.Date);
            cmd.Parameters.AddWithValue("@nomachine", "");

            SqlDataReader dataReader = cmd.ExecuteReader();

            while (dataReader.Read())
            {
                res = (int)dataReader[0];
            }
            dataReader.Close();
            return(res);
        }
 public override void Refresh()
 {
     ExceptionVM.Refresh();
 }