Exemplo n.º 1
0
        public IEntry[] NewWorkEntries(string date, double hours)
        {
            int appNumber = RandomGenerateAppNumber(ApplicationMap.Keys.Count);

            IEntry[] entries = new IEntry[appNumber];

            List <string> usedNames    = new List <string>();
            double        remaingHours = hours;

            for (int i = 0; i < appNumber; i++)
            {
                string[] remainingNames = ApplicationMap.Keys.Except(usedNames).ToArray();
                string   appName        = RandomGenerateApplicationName(remainingNames, ApplicationMap);
                usedNames.Add(appName);

                IEntryTemplate entryTemplate = RandomGenerateEntry(appName);
                entries[i] = new Entry(username, date, entryTemplate)
                {
                    IsComplete = RandomGenerateComplete(entryTemplate.Type)
                };
                if (i == appNumber - 1)
                {
                    entries[i].Hours = remaingHours;
                }
                else
                {
                    entries[i].Hours = random.Next((int)(remaingHours / 2), (int)Math.Ceiling(remaingHours));
                    remaingHours    -= entries[i].Hours;
                }
            }
            return(entries);
        }
Exemplo n.º 2
0
        public IEntry NewHolidayEntry(string date, IEntryTemplate holidayEntry)
        {
            Entry entry = new Entry(username, date, holidayEntry)
            {
                IsComplete = RandomGenerateComplete(holidayEntry.Type)
            };

            return(entry);
        }
Exemplo n.º 3
0
 public Entry(string username, string dateTime, IEntryTemplate template)
 {
     Date          = dateTime;
     User          = username;
     Application   = template.Application();
     Description   = template.Description();
     IsDevelopment = template.IsDevelopment();
     if (template.Type == EntryTemplateType.Holiday)
     {
         Hours      = template.Hours;
         IsComplete = true;
     }
 }