Exemplo n.º 1
0
        ///<summary>The click event for each tile. This initializes and loads the engineers schedule, jobs grid, and history of clock events. Only clickable if the engineer is the same
        ///as the current user or Allen and Nathan.</summary>
        private void button_ClickEngInfo(object sender, RoutedEventArgs e)
        {
            //reset class date variables
            startOfWeek = DateTime.Today.AddDays(-(int)(DateTime.Today.DayOfWeek));
            curWeek     = DateTime.Today.AddDays(-(int)(DateTime.Today.DayOfWeek));
            //retrieve our engineer tag based on the tile clicked
            System.Windows.Controls.Button bt = (System.Windows.Controls.Button)sender;
            if (bt.Tag.ToString().StartsWith("Total"))
            {
                return;
            }
            selectedEng = Userods.GetWhere(x => x.UserName == bt.Tag.ToString(), true).First();
            if ((Security.CurUser.UserNum != 58 && Security.CurUser.UserNum != 9) && Security.CurUser.UserNum != selectedEng.UserNum)       //if you aren't Nathan or Allen and are not the engineer you selected, you can't view their information.
            {
                System.Windows.MessageBox.Show(Lans.g("Security", "Not authorized for viewing"));
                return;
            }
            buttonGrid.Visibility        = Visibility.Collapsed;
            EngSpecificInfo.Visibility   = Visibility.Visible;
            GridToolbar.Visibility       = Visibility.Visible;
            _listAllWriteJobsForEngineer = _listJobsAll.Where(x => x.UserNumEngineer == selectedEng.UserNum).ToList();
            LabelEngName.Content         = selectedEng.UserName;
            long engUserNum = selectedEng.UserNum;

            //Fill our controls for the next view
            FillActiveJobs(engUserNum);
            ClockEventsInRange(startOfWeek, startOfWeek.AddDays(6));
            FillEngineerMetrics(engUserNum);
            FillEngineerCalendar(startOfWeek, startOfWeek.AddDays(6));
            //TODO: Call the today click here, however this will require waiting for the UI to draw first otherwise the height value we animate to is 0.
            //This will require additional research on methods/techniques to wait for the UI to draw.
        }