예제 #1
0
        /// ------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Aktualisiert die Reihe für den jeweiligen Tag
        /// </summary>
        public void FillDailyRow()
        {
            try
            {
                int       i   = TimeTables.Tables.IndexOf(CurrentWeek.ToString());
                DataTable tbl = TimeTables.Tables[i];
                int       businessDayNumber = (int)DateTime.Now.DayOfWeek - 1;

                tbl.Rows[businessDayNumber][1] = DateTime.Now.Date.ToShortDateString();
                tbl.Rows[businessDayNumber][2] = StartTime.ToLongTimeString();
                tbl.Rows[businessDayNumber][3] = string.Format("{0:00}:{1:00}:{2:00}", SecondsDone / 3600, (SecondsDone / 60) % 60, SecondsDone % 60);
                tbl.Rows[businessDayNumber][4] = EndTime.ToLongTimeString();
                tbl.Rows[businessDayNumber][5] = Helper.ToTimeString(SecondsPlus - SecondsLeft);

                tbl.Rows[5][1] = Helper.ComputeWeek(tbl.Rows[0][1].ToString());
                tbl.Rows[5][2] = ComputeAverage(2);
                tbl.Rows[5][3] = ComputeSum(3);
                tbl.Rows[5][4] = ComputeAverage(4);
                tbl.Rows[5][5] = ComputeSum(5) + GetLastDiffernce(CurrentWeek);
                PlusOfWeek     = TimeSpan.Parse(tbl.Rows[5][5].ToString());
                TimeTables.Tables[i].AcceptChanges();
                if (PlusOfWeek.Ticks < 0)
                {
                    PlusOfWeek = TimeSpan.Zero;
                }
            }
            catch (Exception)
            {
                CreateNextTable(Helper.GetWeekOfYear(DateTime.Now));
            }
        }
예제 #2
0
        public static CurrentWeekResponce ToCurrentWeek(this CurrentWeek currentweek)
        {
            var result = new CurrentWeekResponce();

            result.CurrentWeek = currentweek.currentweek;

            return(result);
        }
예제 #3
0
 private void OnWeekDisplayChanged()
 {
     BuildCalendar(DateTime.Today);
     SelectedMonth = Months[DateTime.Now.Month - 1];
     SelectedYear  = DateTime.Now.Year.ToString();
     FilterCurrentAppointments(CurrentWeek.ToList());
     MonthWeekLabel = "This week";
 }
예제 #4
0
        public static CurrentWeek GetCurrentYear()
        {
            var      model = new CurrentWeek();
            DateTime now   = DateTime.Now;

            model.Start = new DateTime(now.Year, 1, 1);
            model.End   = new DateTime(now.Year, 12, 31);
            return(model);
        }
예제 #5
0
        public static CurrentWeek GetCurrentMonth()
        {
            var      model = new CurrentWeek();
            DateTime now   = DateTime.Now;

            model.Start = new DateTime(now.Year, now.Month, 1);
            model.End   = model.Start.AddMonths(1).AddDays(-1);
            return(model);
        }
예제 #6
0
        public static CurrentWeek GetCurrentWeek()
        {
            var model = new CurrentWeek();
            var date  = DateTime.Now;
            var day   = date.DayOfWeek == DayOfWeek.Sunday ? 7 : (int)date.DayOfWeek;

            model.Start = date.AddDays(-(day - (int)DayOfWeek.Monday)).Date;
            model.End   = date.AddDays(7 - day).Date;
            return(model);
        }
예제 #7
0
        /// ------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Prüft, ob die Tabelle für die jeweilige Woche bereits angelegt ist
        /// </summary>
        public void CheckTable()
        {
            CurrentWeek = Helper.GetWeekOfYear(DateTime.Now);
            if (!TimeTables.Tables.Contains(CurrentWeek.ToString()))
            {
                CreateNextTable(CurrentWeek);
            }
            DailyIndex = TimeTables.Tables.IndexOf(CurrentWeek.ToString());

            FillDailyRow();
        }
예제 #8
0
        private void BuildCurrentWeek()
        {
            var CurrentWeekDay = DateTime.Today.Date.AddDays(-1 * (int)DateTime.Today.DayOfWeek);

            for (int i = 0; i < 7; i++)
            {
                Day day = new Day {
                    Date = CurrentWeekDay,
                };
                CurrentWeek.Add(day);
                CurrentWeekDay = CurrentWeekDay.AddDays(1);
            }
        }
예제 #9
0
        //Methods


        //Method to check if this user is equal to another user
        public override bool Equals(object obj)
        {
            bool isEqual = true;
            User user    = (User)obj;

            if (!CurrentDay.Equals(user.CurrentDay))
            {
                isEqual = false;
            }
            else if (!CurrentWeek.Equals(user.CurrentWeek))
            {
                isEqual = false;
            }
            return(isEqual);
        }
예제 #10
0
        public IActionResult Index()
        {
            CurrentWeek currentWeek = _currentWeekService.GetCurrentWeek();

            if (currentWeek == null)
            {
                throw new Exception("currentWeek doesn't exist");
            }

            if (!DoesDateLiesInCurrentWeek(currentWeek.Date))
            {
                _ammountOfDoneDutiesArchiveRepository.ResetArchive();

                var duties = _dutyRepository.Duties;

                foreach (var duty in duties)
                {
                    var overdueDuty = new OverdueDuty()
                    {
                        Content    = duty.Content,
                        Category   = duty.Category,
                        CategoryId = duty.CategoryId
                    };

                    _overdueDutyRepository.AddOverdueDuty(overdueDuty);


                    _dutyRepository.RemoveDuty(duty);
                }

                currentWeek.Date = DateTime.Now;

                _dbContextService.Commit();
            }

            var model = new IndexViewModel()
            {
                CurrentWeek   = currentWeek,
                OverdueDuties = _overdueDutyRepository.OverdueDuties
            };

            return(View(model));
        }
        private async void FillCurrentWeekViewModel(DateTime date)
        {
            Debug.WriteLine("FillCurrentWeekViewModel: " + date.ToString());

            var thisWeek = await App.Database.GetWeek(date);

            if (thisWeek.Count < 7)
            {
                // Add new Week
                AddNewWeek(date.AddDays(thisWeek.Count), 7 - thisWeek.Count);
            }

            CurrentWeek.Clear();

            foreach (var me in thisWeek)
            {
                CurrentWeek.Add(new MenuEntryViewModel(me));
            }
        }
예제 #12
0
        // NFL GETTY AND ACTION SHOTS\
        public List <TopPassers> LoadPassers()
        {
            List <TopPassers> passers = new List <TopPassers>();

            tri = "";
            try
            {
                using (DtvRedZoneEntities db = new DtvRedZoneEntities())
                {
                    CurrentWeek cw = db.CurrentWeeks.FirstOrDefault();
                    //List<GamePasser> gamePassers = db.GamePassers.Where(g => g.GameKey != null).ToList();
                    List <GetWeekFantasyPassingLeaders_Result> gamePassers = db.GetWeekFantasyPassingLeaders(cw.Season, cw.SeasonType, cw.Week).ToList();

                    for (int i = 0; i < gamePassers.Count && i < 5; i++)
                    {
                        tri  = gamePassers[i].Tricode.ToUpper();
                        _pic = String.Format("{0}_{1}_{2}_Action.png", gamePassers[i].Tricode.ToUpper(), gamePassers[i].LastName.ToUpper(),
                                             gamePassers[i].FirstName.ToUpper());

                        foreach (var key in diffTri)
                        {
                            if (tri.Equals(key.Value))
                            {
                                tri = realTri[key.Key];

                                _pic = String.Format("{0}_{1}_{2}_Action.png", tri.ToUpper(), gamePassers[i].LastName.ToUpper(),
                                                     gamePassers[i].FirstName.ToUpper());
                            }
                        }

                        _path = String.Format(@"U:\NFL GETTY AND ACTION SHOTS\{0}", _pic);

                        if (!File.Exists(_path))
                        {
                            _pic = String.Format(@"U:\RedZone\Headshots\{0}\{1}_{2}_{3}_B.png", tri, tri, gamePassers[i].LastName.ToUpper(),
                                                 gamePassers[i].FirstName.ToUpper());
                        }
                        else
                        {
                            _pic = String.Format(@"U:\NFL GETTY AND ACTION SHOTS\{0}_{1}_{2}_Action.png", tri, gamePassers[i].LastName.ToUpper(),
                                                 gamePassers[i].FirstName.ToUpper());
                        }

                        _name = String.Format("{0}, {1}", gamePassers[i].LastName, gamePassers[i].FirstName);

                        passers.Add(new TopPassers
                        {
                            Picture       = _pic,
                            Name          = _name,
                            Tricode       = tri,
                            Position      = gamePassers[i].Position,
                            Completions   = gamePassers[i].Completions.ToString(),
                            Attempts      = gamePassers[i].Attempts.ToString(),
                            Yards         = gamePassers[i].Yards.ToString(),
                            Touchdowns    = gamePassers[i].Touchdowns.ToString(),
                            Interceptions = gamePassers[i].Interceptions.ToString(),
                            CompletionPCT = gamePassers[i].CompletionPct,
                            Average       = gamePassers[i].YardsPerAttempt,
                            Long          = gamePassers[i].Long.ToString()
                        });
                    }
                    //passers.AddRange(game.Select(dtvGame => new TopPassers()
                    //    {
                    //        Picture = dtvGame.Channel,
                    //        Name = dtvGame.DtvTricodeAway,
                    //        Position = dtvGame.DtvTricodeHome,
                    //        Stats = dtvGame.GameDate
                    //    }));
                }
            }
            catch (Exception e)
            {
                //NotificationManager.Push("Error", "There was an error reading the database");
                Console.WriteLine(e.ToString());
            }
            return(passers);
        }
예제 #13
0
 public void AddCurrentWeek(CurrentWeek currentWeek)
 {
     _context.Add(currentWeek);
 }