示例#1
0
        public void Remove(TimeCodes timeType, float hours)
        {
            if (hours < 0)
            {
                return;
            }
            switch (timeType)
            {
            case TimeCodes.REGULAR:
                if (((regularHours + hours) > 24) && (((regularHours - hours) < 0)))
                {
                    return;
                }
                regularHours -= hours;
                break;

            case TimeCodes.SICK:
                if (((regularHours + hours) > 24) && (((regularHours - hours) < 0)))
                {
                    return;
                }
                sickHours -= hours;
                break;

            case TimeCodes.VACATION:
                if (((regularHours + hours) > 24) && (((regularHours - hours) < 0)))
                {
                    return;
                }
                vacationHours -= hours;
                break;
            }
            totalHours -= hours;
        }
示例#2
0
 public void Subtract(TimeCodes timeType, float hours)
 {
     if (hours < 0)
     {
         _Hours[(int)timeType] -= hours;
     }
     else
     {
         throw new ArgumentOutOfRangeException("hours", "Hours must be < 0");
     }
 }
示例#3
0
 public void Add(TimeCodes timeType, float hours)
 {
     if (hours > 0)
     {
         _Hours[(int)timeType] += hours;
     }
     else
     {
         throw new ArgumentOutOfRangeException("hours", "Hours must be > 0.");
     }
 }
示例#4
0
        private void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
        {
            if (string.IsNullOrWhiteSpace(outLine.Data))
            {
                return;
            }

            Log.AppendLine(outLine.Data);
            var match = TimeRegex.Match(outLine.Data);

            if (match.Success)
            {
                var timeCode = match.Value.Replace("pts_time:", string.Empty).Replace(",", ".").Replace("٫", ".").Replace("⠨", ".");
                if (double.TryParse(timeCode, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var seconds) && seconds > 0.2)
                {
                    TimeCodes.AppendLine(TimeCode.FromSeconds(seconds).ToShortString());
                    LastSeconds = seconds;
                }
            }
        }
 public void SetHours(TimeCodes timeType, float hours)
 {
     if (hours > 0)
     {
         if(hours % .25f == 0)
         {
             hoursArray[(int)timeType] = hours;
             for (int i = 0; i < numOfHourTypes; ++i)
             {
                 totalHours += hoursArray[i];
             }
         }
         else
         {
             throw new ArgumentOutOfRangeException("hours", "Hours must be in .25 increments");
         }
     }
     else
     {
         throw new ArgumentOutOfRangeException("hours", "Hours must be > 0");
     }
 }
 public void SetHours(TimeCodes timeType, float hours)
 {
     if (hours > 0)
     {
         if (hours % .25f == 0)
         {
             hoursArray[(int)timeType] = hours;
             for (int i = 0; i < numOfHourTypes; ++i)
             {
                 totalHours += hoursArray[i];
             }
         }
         else
         {
             throw new ArgumentOutOfRangeException("hours", "Hours must be in .25 increments");
         }
     }
     else
     {
         throw new ArgumentOutOfRangeException("hours", "Hours must be > 0");
     }
 }
示例#7
0
        public void Add(TimeCodes timeType, float hours)
        {
            if (hours < 0)
            {
                Console.WriteLine("Hours cannot be under 0 while adding!!!");
                return;
            }
            hours = ((int)(hours / 0.25f)) * 0.25f;

            switch (timeType)
            {
            case TimeCodes.REGULAR:
                if ((regularHours + hours) > 24)
                {
                    return;
                }
                regularHours += hours;
                break;

            case TimeCodes.SICK:
                if ((sickHours + hours) > 24)
                {
                    return;
                }
                sickHours += hours;
                break;

            case TimeCodes.VACATION:
                if ((vacationHours + hours) > 24)
                {
                    return;
                }
                vacationHours += hours;
                break;
            }
            totalHours += hours;
        }