Example #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));
            }
        }
Example #2
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();
        }