Esempio n. 1
0
        internal static Hour FetchHour(HourData data)
        {
            var result = new Hour();

            result.Fetch(data);
            result.MarkOld();

            return result;
        }
        public void HourShouldReturnCorrectResult()
        {
            var func = new Hour();
            var result = func.Execute(FunctionsHelper.CreateArgs(GetTime(9, 13, 14)), _parsingContext);
            Assert.AreEqual(9, result.Result);

            result = func.Execute(FunctionsHelper.CreateArgs(GetTime(23, 13, 14)), _parsingContext);
            Assert.AreEqual(23, result.Result);
        }
Esempio n. 3
0
        public void GetRecord_NoRecords()
        {
            Mock<dal.IDataHelper> mockData = this.GetMockData();
            Hour hour = new Hour("/DataFiles");
            hour.DataHelper = mockData.Object;
            int rowId = 0;
            DataTable hourTable = ((IHour)hour).GetRecord(rowId);
            Assert.That(hourTable.Rows.Count, Is.EqualTo(0), "Should be no rows");

            mockData.VerifyAll();
        }
Esempio n. 4
0
        public void List()
        {
            Mock<dal.IDataHelper> mockData = this.GetMockData();
            Hour hour = new Hour("/DataFiles");
            hour.DataHelper = mockData.Object;
            DataTable hours = ((IHour)hour).List();
            Assert.That(hours, Is.Not.Null, "Hours NULL");
            Assert.That(hours.Rows.Count, Is.GreaterThan(0), "Hours - no data");

            mockData.VerifyAll();
        }
Esempio n. 5
0
        public static bool HourDelete(Hour hour)
        {
            Hour.DeleteHour(
                new HourDataCriteria
                {
                    HourId = hour.HourId
                });

            StoryRepository.StoryUpdateDuration(hour.StoryId);

            FeedRepository.FeedAdd(FeedAction.Deleted, hour);

            return true;
        }
Esempio n. 6
0
        public void OpenTest_Valid()
        {
            // Arrange
            var hour = new Hour()
            {
                HoursType = "test",
                IsOpenNow = false,
                Open      = new Open[] { GetOpen(1), GetOpen(2) }
            };

            // Act

            // Assert
            Assert.IsNotNull(hour);
        }
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Minute.Trim());
            sb.Append(" ");
            sb.Append(Hour.Trim());
            sb.Append(" ");
            sb.Append(DayOfMonth.Trim());
            sb.Append(" ");
            sb.Append(Month.Trim());
            sb.Append(" ");
            sb.Append(DayOfWeek.Trim());
            return(sb.ToString());
        }
Esempio n. 8
0
 public Field FindAvailableReserve(DateTime date, Hour hour)
 {
     try
     {
         var query = Session.GetNamedQuery("FindAvailableFieldReserve");
         query.SetParameter("date", date);
         query.SetParameter("hourId", hour.Id);
         query.SetParameter("campId", hour.Camp.Id);
         return(query.UniqueResult <Field>());
     }
     catch
     {
         throw;
     }
 }
Esempio n. 9
0
        public void SetFormControls(Hour hour)
        {
            CityName = Response.City.Name;

            CurrentHour      = hour;
            CurrentCondition = CurrentHour.Weather[0].Main;

            HourLabel.Content             = CurrentHour.DtHuman;
            CurrentConditionLabel.Content = CurrentHour.Weather[0].Main;
            TempLabel.Content             = Convert.ToInt32(CurrentHour.Main.Temp);
            HumidityLabel.Content         = CurrentHour.Main.HumidityHuman;
            WindLabel.Content             = CurrentHour.Wind.WindHuman;

            this.HourlyChart.SetDays(Response.List.ToList());
        }
 /// <inheritdoc />
 public async Task <TGap> ReadLargestGapsForHourAsync <TGap>(Server server, Hour hour, GapActivityType activityType)
 {
     using (var conn = this.connectionFactory.GetEddsPerformanceConnection())
     {
         return(await conn.QueryFirstOrDefaultAsync <TGap>(
                    Resources.DatabaseGap_ReadLargestGapsForHour,
                    new
         {
             server.ServerId,
             hourTimeStampStart = hour.HourTimeStamp,
             hourTimeStampEnd = hour.GetHourEnd(),
             activityType
         }).ConfigureAwait(false));
     }
 }
Esempio n. 11
0
        // GET: Hour/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hour hour = db.Hours.Find(id);

            if (hour == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EmpID = new SelectList(db.Employees, "ID", "FirstName", hour.EmpID);
            return(View(hour));
        }
Esempio n. 12
0
        /// <summary>
        /// 2002-05-22_12
        /// </summary>
        /// <returns></returns>
        public string ToDateAndHourPathString()
        {
            StringBuilder sb = new StringBuilder(10);

            sb.Append(Year)
            .Append("-")
            .Append(Month.ToString("00"))
            .Append("-")
            .Append(Day.ToString("00"))
            .Append("_")
            .Append(Hour.ToString("00"));
            return(sb.ToString());

            return(ToDateString() + "_" + Hour.ToString("00"));
        }
Esempio n. 13
0
        public ActionResult Create([Bind(Include = "Id,RegDateTime,StartDateTime,StopDateTime,Amount,Comment,RegType")] Hour hour)
        {
            if (ModelState.IsValid)
            {
                var curUser = GetCurrentUser();

                hour.user = curUser;
                db.Hours.Add(hour);

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hour));
        }
Esempio n. 14
0
        public async Task GapCoverageAnalyzer_CaptureCoverageData()
        {
            // Arrange
            var server = new Server {
                ServerId = 123
            };
            var hour = new Hour {
                HourTimeStamp = new DateTime(2018, 4, 4)
            };
            var window                 = Defaults.RecoverabilityIntegrity.WindowInDays;
            var windowInSecs           = (int)TimeSpan.FromDays(window).TotalSeconds;
            var gapDurations           = new[] { 4, 3 };   // 3 and 4 days exceeding window are bad but there are only two gaps so there will be no gap for 3rd db
            var unresolvedGapDurations = new[] { -2, -3 };
            var coveredDatabases       = 3;
            var totalDatabases         = gapDurations.Length + unresolvedGapDurations.Length + coveredDatabases;

            var gaps = gapDurations.Select((duration, i) => new DbccGap
            {
                DatabaseId = i,
                Duration   = (int)TimeSpan.FromDays(window + duration).TotalSeconds
            }).ToList();

            var databases = unresolvedGapDurations
                            .Select((duration, i) => new Database
            {
                Id           = i + gapDurations.Length,               // gapDurations.Length is added so that they are different database id's from gaps above
                LastDbccDate = hour.HourTimeStamp.Add(-TimeSpan.FromDays(window + duration))
            })
                            .ToList();

            this.databaseRepository.Setup(r => r.ReadCountByServerAsync(server))
            .ReturnsAsync(totalDatabases);
            this.databaseGapsRepository.Setup(r => r.ReadGapsLargerThanForHourAsync <DbccGap>(server, hour, GapActivityType.Dbcc, windowInSecs))
            .ReturnsAsync(gaps);
            this.databaseRepository.Setup(r => r.ReadOutOfDateDatabasesAsync(server, It.IsAny <DateTime>(), GapActivityType.Dbcc))
            .ReturnsAsync(databases);
            this.gapReporter.Setup(m => m.CreateGapReport(hour, server, gaps, GapActivityType.Dbcc)).ReturnsAsyncDefault();

            // Act
            var result = await this.gapCoverageAnalyzer.CaptureCoverageData <DbccGap>(hour, server, GapActivityType.Dbcc);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.DatabasesCovered, Is.EqualTo(coveredDatabases));
            Assert.That(result.TotalDatabases, Is.EqualTo(totalDatabases));

            this.gapReporter.VerifyAll();
        }
Esempio n. 15
0
        /// <summary>
        /// Compares the value of this instance to a specified <see cref="LocalDateTime"/> value and returns an integer
        /// that indicates whether this instance is earlier than, the same as, or later than the specified
        /// DateTime value.
        /// </summary>
        /// <param name="other">The object to compare to the current instance.</param>
        /// <returns>A signed number indicating the relative values of this instance and the value parameter.</returns>
        public int CompareTo(LocalDateTime other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (other is null)
            {
                return(1);
            }
            var yearComparison = Year.CompareTo(other.Year);

            if (yearComparison != 0)
            {
                return(yearComparison);
            }
            var monthComparison = Month.CompareTo(other.Month);

            if (monthComparison != 0)
            {
                return(monthComparison);
            }
            var dayComparison = Day.CompareTo(other.Day);

            if (dayComparison != 0)
            {
                return(dayComparison);
            }
            var hourComparison = Hour.CompareTo(other.Hour);

            if (hourComparison != 0)
            {
                return(hourComparison);
            }
            var minuteComparison = Minute.CompareTo(other.Minute);

            if (minuteComparison != 0)
            {
                return(minuteComparison);
            }
            var secondComparison = Second.CompareTo(other.Second);

            if (secondComparison != 0)
            {
                return(secondComparison);
            }
            return(Nanosecond.CompareTo(other.Nanosecond));
        }
Esempio n. 16
0
        public void GetRecord()
        {
            Mock<dal.IDataHelper> mockData = this.GetMockData();
            Hour hour = new Hour("/DataFiles");
            hour.DataHelper = mockData.Object;
            int rowId = 1;
            ((IHour)hour).GetRecord(rowId);
            Assert.That(hour.RowId, Is.EqualTo(1), "Hour ID Wrong");
            Assert.That(hour.Hours, Is.EqualTo(1.5M), "Hours Wrong");
            Assert.That(hour.StartDate, Is.EqualTo(DateTime.Today), "Start Date Wrong Wrong");
            Assert.That(hour.EndDate, Is.EqualTo(DateTime.Today), "End Date Wrong Wrong");
            Assert.That(hour.ProjectId, Is.EqualTo(1), "Project ID Wrong");
            Assert.That(hour.Comments, Is.EqualTo("This is a Test."), "Comments Wrong");

            mockData.VerifyAll();
        }
Esempio n. 17
0
        public ActionResult RegisterHours(int?userID, int?projectID, Hour newHour, string atDate)
        {
            //Select Project List

            ViewBag.Projects = GetProjects();
            //Select Project List

            if (atDate != null)
            {
                DateTime datetime = DateTime.ParseExact(atDate, "dd.MM.yyyy", CultureInfo.InvariantCulture);
                newHour.RegDateTime = datetime;
                ViewBag.atDate      = datetime; //??
            }

            return(View());
        }
Esempio n. 18
0
        public ActionResult RegisterHours(Hour newHour, string selectedProject)
        {
            if (ModelState.IsValid)
            {
                var curUser = GetCurrentUser();

                newHour.user       = curUser;
                newHour.project.Id = System.Convert.ToInt32(selectedProject);

                db.Hours.Add(newHour);
                db.SaveChanges();
                return(RedirectToAction("index"));
            }

            return(View(newHour));
        }
Esempio n. 19
0
        public async Task <Hour> AddHourAsync(Problem problem, PlanItUser user, decimal hours)
        {
            var hour = new Hour
            {
                Problem     = problem,
                User        = user,
                WorkedHours = hours,
                Date        = DateTime.UtcNow,
            };

            await this.hoursRepository.AddAsync(hour);

            await this.hoursRepository.SaveChangesAsync();

            return(hour);
        }
Esempio n. 20
0
        public Hour InsertHourFromModel(HourEntryModel model)
        {
            var sectionProjectRel = db.SectionProjectsRels.Include(x => x.Project).Include(y => y.Section).FirstOrDefault(z => z.Section.Id == model.SectionId && z.Project.Id == model.ProjectId);
            var user = db.Users.FirstOrDefault(x => x.AccountId == model.AccountId);

            if (user != null && sectionProjectRel != null)
            {
                var hour = new Hour();
                hour.Amount         = model.Hour;
                hour.SectionProject = sectionProjectRel;
                hour.User           = user;
                Insert(hour);
                return(hour);
            }
            return(null);
        }
Esempio n. 21
0
        public override string ToString()
        {
            string hour   = Hour.ToString();
            string minute = Minute.ToString();

            if (Hour < 10)
            {
                hour = $"0{Hour}";
            }
            if (Minute < 10)
            {
                minute = $"0{Minute}";
            }

            return($"{hour}:{minute}");
        }
Esempio n. 22
0
        public override string ToString()
        {
            string hourAsString   = Hour.ToString();
            string minuteAsString = Minute.ToString();

            if (hourAsString.Length == 1)
            {
                hourAsString = "0" + hourAsString;
            }
            if (minuteAsString.Length == 1)
            {
                minuteAsString = "0" + minuteAsString;
            }

            return($"{hourAsString}:{minuteAsString}");
        }
        /// <summary>
        /// dgHour控件 单元格点击(选择)事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgHour_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            DataGridCellInfo cell = dgHour.CurrentCell;

            if (cell.Column == null)
            {
                return;
            }

            Hour hour = cell.Item as Hour;

            // string str = cell.Column.DisplayIndex.ToString();

            string str1 = string.Empty;;

            switch (cell.Column.DisplayIndex)// 通过所在列 获取类Hour的坐标 确定具体的hour数据
            {
            case 0:
                str1 = hour.Hour1.ToString();
                break;

            case 1:
                str1 = hour.Hour2.ToString();
                break;

            case 2:
                str1 = hour.Hour3.ToString();
                break;

            case 3:
                str1 = hour.Hour4.ToString();
                break;

            case 4:
                str1 = hour.Hour5.ToString();
                break;

            case 5:
                str1 = hour.Hour6.ToString();
                break;

            default: break;
            }

            str1 = str1.PadLeft(2, '0');
            OnHourClickContentEdit(str1);
        }
Esempio n. 24
0
 private PeriodicSchedule(
     Month month,
     Week week,
     Day day,
     WeekDay weekDay,
     Hour hour,
     Minute minute,
     Second second,
     Duration minimumGap,
     [NotNull] CalendarSystem calendarSystem,
     [NotNull] DateTimeZone dateTimeZone,
     ScheduleOptions options,
     [CanBeNull] string name)
     : base(
         name,
         CreateFunction(
             month,
             week,
             day,
             weekDay,
             hour,
             minute,
             second,
             minimumGap,
             calendarSystem,
             dateTimeZone),
         options)
 {
     if (calendarSystem == null)
     {
         throw new ArgumentNullException("calendarSystem");
     }
     if (dateTimeZone == null)
     {
         throw new ArgumentNullException("dateTimeZone");
     }
     Month          = month;
     Week           = week;
     Day            = day;
     WeekDay        = weekDay;
     Hour           = hour;
     Minute         = minute;
     Second         = second;
     MinimumGap     = minimumGap;
     CalendarSystem = calendarSystem;
     DateTimeZone   = dateTimeZone;
 }
Esempio n. 25
0
        public void Add()
        {
            Mock<dal.IDataHelper> mockData = this.GetMockData_ForSaving();

            Hour hour = new Hour("/DataFiles");
            hour.DataHelper = mockData.Object;

            int projectId = 1;
            decimal hours = 1.5M;
            DateTime startDate = DateTime.Today;
            DateTime endDate = DateTime.Today;
            string comments = "This is a Test.";
            int hourId = ((IHour)hour).Add(projectId, hours, startDate, endDate, comments);
            Assert.That(hourId, Is.EqualTo(2), "Wrong New Row Id");

            mockData.VerifyAll();
        }
        public void HourTask_CheckIfHourReadyToScore_RatingsException()
        {
            // Arrange
            var hourId = 444;
            var hour   = new Hour {
                Id = hourId, HourTimeStamp = DateTime.UtcNow
            };

            this.hourRepository.Setup(r => r.ReadHourReadyForScoringAsync(hourId)).ReturnsAsync(hour);
            this.ratingsRepository.Setup(m => m.Exists(hourId)).ReturnsAsync(true);

            // Act
            // Assert
            var exception = Assert.ThrowsAsync <Exception>(() => this.hourTask.CheckIfHourReadyToScore(hourId));

            Assert.That(exception.Message.StartsWith("Ratings"));
        }
        public async Task HourTask_CheckIfHourReadyToScore()
        {
            // Arrange
            var hourId = 444;
            var hour   = new Hour {
                Id = hourId, HourTimeStamp = DateTime.UtcNow
            };

            this.ratingsRepository.Setup(m => m.Exists(hourId)).ReturnsAsync(false);
            this.hourRepository.Setup(r => r.ReadHourReadyForScoringAsync(hourId)).ReturnsAsync(hour);

            // Act
            var result = await this.hourTask.CheckIfHourReadyToScore(hourId);

            // Assert
            Assert.That(result.Types.First(), Is.EqualTo(EventSourceType.ScoreHour));
        }
        private string ConvertMethod(Hour hours, int i)
        {
            //First make a System.DateTime equivalent to the UNIX Epoch.
            DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);

            dateTime = dateTime.AddSeconds(hours.value).ToLocalTime();
            if (i > 0)
            {
                return(" - " + dateTime.ToShortTimeString());
                //delivery += (" - " + dateTime.ToShortTimeString());
            }
            else
            {
                return(dateTime.ToShortTimeString());
                //delivery.Sunday = dateTime.ToShortTimeString();
            }
        }
        public async Task GetBackupsAsync()
        {
            // Arrange
            var hourTimeStamp = DateTime.UtcNow.NormilizeToHour();
            var backupEnd     = hourTimeStamp.AddMinutes(5);
            var serverName    = "TestServerName";
            var databaseName  = "TestDatabaseName";

            var testBackup = new MockBackupSet
            {
                Server          = serverName,
                Database        = databaseName,
                BackupStartDate = hourTimeStamp,
                BackupEndDate   = backupEnd,
                BackupType      = ((char)BackupType.Full).ToString()
            };

            await this.backupTestDataRepository.CreateAsync(new List <MockBackupSet> {
                testBackup
            });

            var hour = new Hour {
                HourTimeStamp = hourTimeStamp
            };
            var server = new Server {
                ServerName = serverName
            };
            var database = new Database {
                Name = databaseName
            };
            var databases = new List <Database> {
                database
            };

            // Act
            var results = await this.backupProvider.GetBackupsAsync(hour, server, databases);

            // Assert
            Assert.That(results.Count, Is.EqualTo(1));
            var result = results.First();

            Assert.That(result.DatabaseName, Is.EqualTo(testBackup.Database));
            Assert.That(result.Start, Is.EqualTo(testBackup.BackupStartDate));
            Assert.That(result.End, Is.EqualTo(testBackup.BackupEndDate));
            Assert.That(result.BackupType.ToString(), Is.EqualTo(testBackup.BackupType));
        }
 public void CheckAllHours(Hour hour)
 {
     if (hour.IsHourChecked == false)
     {
         foreach (var item in InitializeData.Hours)
         {
             item.IsHourChecked = true;
         }
     }
     else
     {
         foreach (var item in InitializeData.Hours)
         {
             item.IsHourChecked = false;
         }
     }
 }
Esempio n. 31
0
        public int CompareTo(Time other)
        {
            int hourComparation = Hour.CompareTo(other.Hour);

            if (hourComparation == 0)
            {
                int minuteComparation = Minute.CompareTo(other.Minute);
                if (minuteComparation == 0)
                {
                    return(Second.CompareTo(other.Second));
                }

                return(minuteComparation);
            }

            return(hourComparation);
        }
        public async Task <Hour> InsertHour(Hour data)
        {
            //Get employee rate
            //Since hour was not eagerly loaded, find related employee's role rate.
            var employee = await _context.Employees.Include(c => c.Role).FirstOrDefaultAsync(c => c.Id == data.EmployeeId);

            //Perform calculations
            data.RoleRateAtTime = employee.Role.RatePerHour;
            data.Total          = data.RoleRateAtTime * data.HoursWorked;

            //Add the entity to the context and save changes
            var result = await _context.Hours.AddAsync(data);

            await _context.SaveChangesAsync();

            return(null);
        }
Esempio n. 33
0
        public void DefaultCalendarTest()
        {
            DateTime now        = ClockProxy.Clock.Now;
            DateTime todayStart = new DateTime(now.Year, now.Month, now.Day);

            for (int dayHour = 0; dayHour < TimeSpec.HoursPerDay; dayHour++)
            {
                Hour hour = new Hour(todayStart.AddHours(dayHour));
                Assert.AreEqual(hour.Year, todayStart.Year);
                Assert.AreEqual(hour.Month, todayStart.Month);
                Assert.AreEqual(hour.Month, todayStart.Month);
                Assert.AreEqual(hour.Day, todayStart.Day);
                Assert.AreEqual(hour.HourValue, dayHour);
                Assert.AreEqual(hour.Start, todayStart.AddHours(dayHour).Add(hour.Calendar.StartOffset));
                Assert.AreEqual(hour.End, todayStart.AddHours(dayHour + 1).Add(hour.Calendar.EndOffset));
            }
        }         // DefaultCalendarTest
Esempio n. 34
0
        public override string ToString()
        {
            var hourToString   = Hour.ToString();
            var minuteToString = Minute.ToString();

            if (Hour < 10)
            {
                hourToString = hourToString.Insert(0, "0");
            }

            if (Minute < 10)
            {
                minuteToString = minuteToString.Insert(0, "0");
            }

            return($"{hourToString}:{minuteToString}");
        }
Esempio n. 35
0
 public string ToString(string format)
 {
     format = format.Replace("yyyy", Year.ToString("0000"));
     format = format.Replace("yy", Year.ToString("00"));
     format = format.Replace("y", Year.ToString());
     format = format.Replace("MM", Month.ToString("00"));
     format = format.Replace("M", Month.ToString());
     format = format.Replace("dd", Day.ToString("00"));
     format = format.Replace("d", Day.ToString());
     format = format.Replace("HH", Hour.ToString("00"));
     format = format.Replace("H", Hour.ToString());
     format = format.Replace("mm", Minute.ToString("00"));
     format = format.Replace("m", Minute.ToString());
     format = format.Replace("ss", Second.ToString("00"));
     format = format.Replace("s", Second.ToString());
     return(format);
 }
        public async Task <Hour> UpdateHour(int Id, Hour data)
        {
            //Update the updated property; Set tracked entity to Modified, update context with the entity and save changes
            try
            {
                data.UpdatedTS = DateTime.Now;
                _context.Attach(data).State = EntityState.Modified;
                var result = _context.Hours.Update(data);
                await _context.SaveChangesAsync();

                return(null);
            }
            catch (Exception Ex)
            {
                throw;
            }
        }
Esempio n. 37
0
        public override string ToString()
        {
            string outputString = string.Empty;

            outputString += Year.ToString();
            outputString += "/";
            outputString += Month.ToString();
            outputString += "/";
            outputString += Day.ToString();
            outputString += " ";
            outputString += Hour.ToString();
            outputString += ":";
            outputString += Minute.ToString();


            return(outputString);
        }
Esempio n. 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ITLBase.Items.EnrolledinCourse"/> class.
 /// </summary>
 /// <param name="group">Course Group Id.</param>
 /// <param name="name">Course Name.</param>
 /// <param name="sMonday">Course Start hour on monday.</param>
 /// <param name="fMonday">Course Finish hour on monday.</param>
 /// <param name="sTuesday">Course Start hour tuesday.</param>
 /// <param name="fTuesday">Course Finish hour on tuesday.</param>
 /// <param name="sWednesday">Course Start hour on wednesday.</param>
 /// <param name="fWednesday">Course Finish hour on wednesday.</param>
 /// <param name="sThursday">Course Start hour on thursday.</param>
 /// <param name="fThursday">Course Finish hour on thursday.</param>
 /// <param name="sFriday">Course Start hour on friday.</param>
 /// <param name="fFriday">Course Finish hour on friday.</param>
 /// <param name="crMonday">Course Classroom on monday.</param>
 /// <param name="crTuesday">Course Classroom on tuesday.</param>
 /// <param name="crWednesday">Course Classroom on wednesday.</param>
 /// <param name="crThursday">Course Classroom on thursday.</param>
 /// <param name="crFriday">Course Classroom on friday.</param>
 public EnrolledinCourse(string group, string name,
                          Hour sMonday, Hour fMonday,
                          Hour sTuesday, Hour fTuesday,
                          Hour sWednesday, Hour fWednesday,
                          Hour sThursday, Hour fThursday,
                          Hour sFriday, Hour fFriday,
                          string crMonday,
                          string crTuesday,
                          string crWednesday,
                          string crThursday,
                          string crFriday)
     : this(group, name)
 {
     Hours.Add(new CourseHour(sMonday, fMonday, crMonday, this));
     Hours.Add(new CourseHour(sTuesday, fTuesday, crTuesday, this));
     Hours.Add(new CourseHour(sWednesday, fWednesday, crWednesday, this));
     Hours.Add(new CourseHour(sThursday, fThursday, crThursday, this));
     Hours.Add(new CourseHour(sFriday, fFriday, crFriday, this));
 }
        // GET: /Application/
        public ActionResult Index(int jobId = 1)
        {
            var job = new Job()
            {
                JobId = jobId,
                Position = "Sales Associate",
                Description = "Customer Service, Stocking, Cashier",
                FullPartTime = "Part-time",
                SalaryRange = "$8.00 - $10.00 hourly",
                QuestionnaireId = 1,
                HoursId = 1
            };

            var applicant = new Applicant();
            var applicantQuestionAnswer = new ApplicantQuestionAnswer();
            var educations = new List<Education>();
            var jobHistories = new List<JobHistory>();
            var hour = new Hour();
            var references = new List<Reference>();
            var user = new User();
            var personalInfo = new PersonalInfo();

            var viewModel = new ApplicationViewModel()
            {
                Application = new Models.EntityModels.Application()
                {
                    DateCreated = DateTime.Now.Date,
                    JobId = jobId,
                },
                
                Job = job,
                Applicant = applicant,
                ApplicantQuestionAnswer = applicantQuestionAnswer,
                Education = educations,
                JobHistory = jobHistories,
                Hour = hour,
                Reference = references,
                User = user,
                PersonalInfo = personalInfo
            };

            return View(viewModel);
        }
        public ActionResult About()
        {
            HourDbDataContext myContext = new HourDbDataContext();
            Hour myHourEntry = new Hour();

            var myQuery = from c in myContext.Hours select c;

            List<Hour> myList = myQuery.ToList<Hour>();

            Hour pd1 = new Hour();

            myContext.Hours.InsertOnSubmit(pd1);

            int i = myQuery.Count();

            /*update statement*/
            //var rockRecord = myContext.Hours.Single(c => c.hourDescription == "rock");
            //rockRecord.hourDescription = "androll";

            myHourEntry.hourId = i + 1;
            myHourEntry.hourDescription = "Fill with data";
            myContext.Hours.InsertOnSubmit(myHourEntry);

            /*delete one entity out of db*/
            var hourEntry = myContext.Hours.Single(c => c.hourDescription == "Fill with data1");
            myContext.Hours.DeleteOnSubmit(hourEntry);

            myContext.SubmitChanges();

            foreach (var c in myQuery)
            {
                ViewBag.Message = c.hourDescription;
                ViewBag.ThisIsSomeText = c.hourDescription;
            }

            ViewBag.CountValues = i;

            return View();
        }
 public void HourShouldReturnCorrectResultWithStringArgument()
 {
     var func = new Hour();
     var result = func.Execute(FunctionsHelper.CreateArgs("2012-03-27 10:11:12"), _parsingContext);
     Assert.AreEqual(10, result.Result);
 }
Esempio n. 42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MAlainp.ITLBase.Items.CourseHour"/> class.
 /// </summary>
 /// <param name="startHour">Start hour.</param>
 /// <param name="finishHour">Finish hour.</param>
 /// <param name="classroom">Classroom.</param>
 /// <param name="course">Course.</param>
 public CourseHour(Hour startHour, Hour finishHour, string classroom, EnrolledinCourse course)
 {
     StartHour = startHour;
     FinishHour = finishHour;
     Classroom = classroom;
 }
Esempio n. 43
0
 public void ChangeTicks(Hour hour)
 {
     hour.Ticks = 9;
 }
Esempio n. 44
0
 public BuiltInFunctions()
 {
     // Text
     Functions["text"] = new CStr();
     Functions["len"] = new Len();
     Functions["lower"] = new Lower();
     Functions["upper"] = new Upper();
     Functions["left"] = new Left();
     Functions["right"] = new Right();
     Functions["mid"] = new Mid();
     Functions["replace"] = new Replace();
     Functions["substitute"] = new Substitute();
     Functions["concatenate"] = new Concatenate();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["cos"] = new Cos();
     Functions["cosh"] = new Cosh();
     Functions["power"] = new Power();
     Functions["sqrt"] = new Sqrt();
     Functions["sqrtpi"] = new SqrtPi();
     Functions["pi"] = new Pi();
     Functions["product"] = new Product();
     Functions["ceiling"] = new Ceiling();
     Functions["count"] = new Count();
     Functions["counta"] = new CountA();
     Functions["floor"] = new Floor();
     Functions["sin"] = new Sin();
     Functions["sinh"] = new Sinh();
     Functions["sum"] = new Sum();
     Functions["sumif"] = new SumIf();
     Functions["stdev"] = new Stdev();
     Functions["stdevp"] = new StdevP();
     Functions["subtotal"] = new Subtotal();
     Functions["exp"] = new Exp();
     Functions["log"] = new Log();
     Functions["log10"] = new Log10();
     Functions["max"] = new Max();
     Functions["maxa"] = new Maxa();
     Functions["min"] = new Min();
     Functions["mod"] = new Mod();
     Functions["average"] = new Average();
     Functions["round"] = new Round();
     Functions["rand"] = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["tan"] = new Tan();
     Functions["tanh"] = new Tanh();
     Functions["var"] = new Var();
     Functions["varp"] = new VarP();
     // Information
     Functions["isblank"] = new IsBlank();
     Functions["isnumber"] = new IsNumber();
     Functions["istext"] = new IsText();
     Functions["iserror"] = new IsError();
     // Logical
     Functions["if"] = new If();
     Functions["not"] = new Not();
     Functions["and"] = new And();
     Functions["or"] = new Or();
     Functions["true"] = new True();
     // Reference and lookup
     Functions["address"] = new Address();
     Functions["hlookup"] = new HLookup();
     Functions["vlookup"] = new VLookup();
     Functions["lookup"] = new Lookup();
     Functions["match"] = new Match();
     Functions["row"] = new Row();
     Functions["rows"] = new Rows();
     Functions["column"] = new Column();
     Functions["columns"] = new Columns();
     Functions["choose"] = new Choose();
     // Date
     Functions["date"] = new Date();
     Functions["today"] = new Today();
     Functions["now"] = new Now();
     Functions["day"] = new Day();
     Functions["month"] = new Month();
     Functions["year"] = new Year();
     Functions["time"] = new Time();
     Functions["hour"] = new Hour();
     Functions["minute"] = new Minute();
     Functions["second"] = new Second();
 }
Esempio n. 45
0
 private void Map(FormCollection source, Hour destination)
 {
     destination.Date = DateTime.Parse(source["Date"]);
     destination.Notes = source["Notes"];
     destination.Duration = decimal.Parse(source["Duration"]);
 }
Esempio n. 46
0
        public static Hour HourUpdate(Hour hour)
        {
            if (!hour.IsDirty)
            {
                return hour;
            }

            hour = hour.Save();

            SourceRepository.SourceUpdate(hour.HourId, SourceType.Hour, hour.Date.ToShortDateString());

            FeedRepository.FeedAdd(FeedAction.Edited, hour);

            return hour;
        }
Esempio n. 47
0
        public static Hour HourInsert(Hour hour)
        {
            hour = hour.Save();

            SourceRepository.SourceAdd(hour.HourId, SourceType.Hour, hour.Date.ToShortDateString());

            FeedRepository.FeedAdd(FeedAction.Created, hour);

            return hour;
        }
Esempio n. 48
0
        public static Hour HourSave(Hour hour)
        {
            if (!hour.IsValid)
            {
                return hour;
            }

            Hour result;

            if (hour.IsNew)
            {
                result = HourRepository.HourInsert(hour);
            }
            else
            {
                result = HourRepository.HourUpdate(hour);
            }

            StoryRepository.StoryUpdateDuration(hour.StoryId);

            return result;
        }
Esempio n. 49
0
        protected Singleton()
        {
            Test();// override sealed


            Hour h = new Hour();
            h.hour = new Hour();
            h.hour.hour = new Hour();
        }
        /// <summary>
        /// Get's the next valid second after the current .
        /// </summary>
        /// <param name="dateTime">The date time (fractions of a second are removed).</param>
        /// <param name="month">The month.</param>
        /// <param name="week">The week.</param>
        /// <param name="day">The day.</param>
        /// <param name="weekDay">The week day.</param>
        /// <param name="hour">The hour.</param>
        /// <param name="minute">The minute.</param>
        /// <param name="second">The second.</param>
        /// <param name="calendar">The calendar.</param>
        /// <param name="calendarWeekRule">The calendar week rule.</param>
        /// <param name="firstDayOfWeek">The first day of week.</param>
        /// <param name="inclusive">if set to <c>true</c> can return the time specified, otherwise, starts at the next second..</param>
        /// <returns>
        /// The next valid date (or <see cref="DateTime.MaxValue"/> if none).
        /// </returns>
        public static DateTime NextValid(
                this DateTime dateTime,
                Month month = Month.Every,
                Week week = Week.Every,
                Day day = Day.Every,
                WeekDay weekDay = WeekDay.Every,
                Hour hour = Hour.Zeroth,
                Minute minute = Minute.Zeroth,
                Second second = Second.Zeroth,
                Calendar calendar = null,
                CalendarWeekRule calendarWeekRule = CalendarWeekRule.FirstFourDayWeek,
                DayOfWeek firstDayOfWeek = DayOfWeek.Sunday,
                bool inclusive = false)
        {
            // Never case, if any are set to never, we'll never get a valid date.
            if ((month == Month.Never) || (week == Week.Never) ||
                (day == Day.Never) || (weekDay == WeekDay.Never) || (hour == Hour.Never) ||
                (minute == Minute.Never) ||
                (second == Second.Never))
                return DateTime.MaxValue;

            if (calendar == null)
                calendar = CultureInfo.CurrentCulture.Calendar;

            // Set the time to this second (or the next one if not inclusive), remove fractions of a second.
            dateTime = new DateTime(
                    dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second);
            if (!inclusive)
                dateTime = calendar.AddSeconds(dateTime, 1);

            // Every second case.
            if ((month == Month.Every) && (day == Day.Every) && (weekDay == WeekDay.Every) && (hour == Hour.Every) &&
                (minute == Minute.Every) && (second == Second.Every) &&
                (week == Week.Every))
                return calendar.AddSeconds(dateTime, 1);

            // Get days and months.
            IEnumerable<int> days = day.Days().OrderBy(dy => dy);
            IEnumerable<int> months = month.Months();

            // Remove months where the first day isn't in the month.
            int firstDay = days.First();
            if (firstDay > 28)
            {
                // 2000 is a leap year, so February has 29 days.
                months = months.Where(mn => calendar.GetDaysInMonth(2000, mn) >= firstDay);
                if (months.Count() < 1)
                    return DateTime.MaxValue;
            }

            // Get remaining date components.
            int y = calendar.GetYear(dateTime);
            int m = calendar.GetMonth(dateTime);
            int d = calendar.GetDayOfMonth(dateTime);

            int h = calendar.GetHour(dateTime);
            int n = calendar.GetMinute(dateTime);
            int s = calendar.GetSecond(dateTime);

            IEnumerable<int> weeks = week.Weeks();
            IEnumerable<DayOfWeek> weekDays = weekDay.WeekDays();
            IEnumerable<int> hours = hour.Hours().OrderBy(i => i);
            IEnumerable<int> minutes = minute.Minutes().OrderBy(i => i);
            IEnumerable<int> seconds = second.Seconds();
            
            do
            {
                foreach (int currentMonth in months)
                {
                    if (currentMonth < m)
                        continue;
                    if (currentMonth > m)
                    {
                        d = 1;
                        h = n = s = 0;
                    }
                    m = currentMonth;
                    foreach (int currentDay in days)
                    {
                        if (currentDay < d)
                            continue;
                        if (currentDay > d)
                            h = n = s = 0;
                        d = currentDay;

                        // Check day is valid for this month.
                        if ((d > 28) && (d > calendar.GetDaysInMonth(y, m)))
                            break;

                        // We have a potential day, check week and week day
                        dateTime = new DateTime(y, m, d, h, n, s);
                        if ((week != Week.Every) &&
                            (!weeks.Contains(dateTime.WeekNumber(calendar, calendarWeekRule, firstDayOfWeek))))
                            continue;
                        if ((weekDay != WeekDay.Every) &&
                            (!weekDays.Contains(calendar.GetDayOfWeek(dateTime))))
                            continue;

                        // We have a date match, check time.
                        foreach (int currentHour in hours)
                        {
                            if (currentHour < h) continue;
                            if (currentHour > h)
                                n = s = 0;
                            h = currentHour;
                            foreach (int currentMinute in minutes)
                            {
                                if (currentMinute < n) continue;
                                if (currentMinute > n)
                                    s = 0;
                                n = currentMinute;
                                foreach (int currentSecond in seconds)
                                {
                                    if (currentSecond < s) continue;
                                    return new DateTime(y, m, d, h, n, currentSecond, calendar);
                                }
                                n = s = 0;
                            }
                            h = n = s = 0;
                        }
                        d = 1;
                    }
                    d = 1;
                    h = n = s = 0;
                }
                y++;

                // Don't bother checking max year.
                if (y > 9998)
                    return DateTime.MaxValue;

                // Start next year
                m = d = 1;
                h = n = s = 0;
            } while (true);
        }
Esempio n. 51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ITLBase.Items.EnrolledinCourse"/> class.
 /// </summary>
 /// <param name="group">Course Group Id.</param>
 /// <param name="name">Course Name.</param>
 /// <param name="hours">Array of hours [start, finish]</param>
 /// <param name="classrooms">Array of classrooms.</param>
 public EnrolledinCourse(string group, string name, Hour[,] hours, string[] classrooms)
     : this(group, name)
 {
     foreach (var day in Enum.GetValues(typeof(Day)))
     {
         Hours.Add(new CourseHour(hours[(int)day, Start],hours[(int)day, Finish],classrooms[(int)day], this));
     }
 }
Esempio n. 52
0
        internal static void FeedAdd(string action, Hour hour)
        {
            var feed = FeedRepository.FeedNew(action, SourceType.Hour, hour.HourId);

            if (action == FeedAction.Edited)
            {
                feed.Description = hour.Auditor.Audit(hour);
            }
            else
            {
                feed.Description = hour.Notes;
            }

            feed.Sources.Add(SourceType.Project, hour.ProjectId);
            feed.Sources.Add(SourceType.Story, hour.StoryId);
            feed.Sources.Add(SourceType.User, hour.UserId);

            feed.Save();
        }
Esempio n. 53
0
 void Awake()
 {
     if(LevelSerializer.IsDeserializing)
     {
         return;
     }
     //Will use playerprefs here to sort this out but for testing purposes...
     currentDate = new DateTime(2012,10,18,6,0,0);
     Time.timeScale = timeSpeed;
     //month = currentDate.Month;
     currentDay = new Day();
     currentMonth = new Month();
     currentYear = new Year();
     currentHour = new Hour(currentDate.Hour);
     currentMinute = new Minute(currentDate.Minute);
     currentDay.day = currentDate.Day;
     currentYear.year = currentDate.Year;
     currentMonth.month = currentDate.Month;
     RandomMinute ();
     //PerformMonthlyActions();
 }
Esempio n. 54
0
        public void Update()
        {
            Mock<dal.IDataHelper> mockData = this.GetMockData_ForSaving();

            Hour hour = new Hour("/DataFiles");
            hour.DataHelper = mockData.Object;

            int rowId = 1;
            int projectId = 1;
            decimal hours = 1.5M;
            DateTime startDate = DateTime.Today;
            DateTime endDate = DateTime.Today;
            string comments = "This is a Test.";
            ((IHour)hour).Update(rowId, projectId, hours, startDate, endDate, comments);

            mockData.VerifyAll();
        }
Esempio n. 55
0
        public static Instant NextValid(
            this Instant instant,
            Month month = Month.Every,
            Week week = Week.Every,
            Day day = Day.Every,
            WeekDay weekDay = WeekDay.Every,
            Hour hour = Hour.Zeroth,
            Minute minute = Minute.Zeroth,
            Second second = Second.Zeroth,
            [CanBeNull] CalendarSystem calendarSystem = null,
            [CanBeNull] DateTimeZone timeZone = null)
        {
            // Never case, if any are set to never, we'll never get a valid date.
            if ((month == Month.Never) ||
                (week == Week.Never) ||
                (day == Day.Never) ||
                (weekDay == WeekDay.Never) ||
                (hour == Hour.Never) ||
                (minute == Minute.Never) ||
                (second == Second.Never))
                return Instant.MaxValue;

            if (calendarSystem == null)
                calendarSystem = CalendarSystem.Iso;
            if (timeZone == null)
                timeZone = DateTimeZone.Utc;
            Debug.Assert(calendarSystem != null);
            Debug.Assert(timeZone != null);

            // Move to next second.
            instant = instant.CeilingSecond();

            // Every second case.
            if ((month == Month.Every) &&
                (day == Day.Every) &&
                (weekDay == WeekDay.Every) &&
                (hour == Hour.Every) &&
                (minute == Minute.Every) &&
                (second == Second.Every) &&
                (week == Week.Every))
                return instant;

            // Get days and months.
            int[] days = Days(day).OrderBy(dy => dy).ToArray();
            int[] months = month.Months().ToArray();

            // Remove months where the first day isn't in the month.
            int firstDay = days.First();
            if (firstDay > 28)
            {
                // 2000 is a leap year, so February has 29 days.
                months = months.Where(mn => calendarSystem.GetDaysInMonth(2000, mn) >= firstDay).ToArray();
                if (months.Length < 1)
                    return Instant.MaxValue;
            }

            // Get zoned date time.
            ZonedDateTime zdt = new ZonedDateTime(instant, timeZone, calendarSystem);
            int y = zdt.Year;
            int m = zdt.Month;
            int d = zdt.Day;
            int h = zdt.Hour;
            int n = zdt.Minute;
            int s = zdt.Second;

            int[] weeks = week.Weeks().ToArray();

            IsoDayOfWeek[] weekDays = weekDay.WeekDays().ToArray();
            int[] hours = hour.Hours().OrderBy(i => i).ToArray();
            int[] minutes = minute.Minutes().OrderBy(i => i).ToArray();
            int[] seconds = second.Seconds().ToArray();

            do
            {
                foreach (int currentMonth in months)
                {
                    if (currentMonth < m)
                        continue;
                    if (currentMonth > m)
                    {
                        d = 1;
                        h = n = s = 0;
                    }
                    m = currentMonth;
                    foreach (int currentDay in days)
                    {
                        if (currentDay < d)
                            continue;
                        if (currentDay > d)
                            h = n = s = 0;
                        d = currentDay;

                        // Check day is valid for this month.
                        if (d > calendarSystem.GetDaysInMonth(y, m))
                            break;

                        // We have a potential day, check week and week day
                        zdt = timeZone.AtLeniently(new LocalDateTime(y, m, d, h, n, s, calendarSystem));
                        if ((week != Week.Every) &&
                            (!weeks.Contains(zdt.WeekOfWeekYear)))
                            continue;
                        if ((weekDay != WeekDay.Every) &&
                            (!weekDays.Contains(zdt.IsoDayOfWeek)))
                            continue;

                        // We have a date match, check time.
                        foreach (int currentHour in hours)
                        {
                            if (currentHour < h) continue;
                            if (currentHour > h)
                                n = s = 0;
                            h = currentHour;
                            foreach (int currentMinute in minutes)
                            {
                                if (currentMinute < n) continue;
                                if (currentMinute > n)
                                    s = 0;
                                n = currentMinute;
                                foreach (int currentSecond in seconds)
                                {
                                    if (currentSecond < s) continue;
                                    return
                                        timeZone.AtLeniently(
                                            new LocalDateTime(y, m, d, h, n, currentSecond, calendarSystem)).ToInstant();
                                }
                                n = s = 0;
                            }
                            h = n = s = 0;
                        }
                        d = 1;
                    }
                    d = 1;
                    h = n = s = 0;
                }
                y++;

                // Don't bother checking max year.
                if (y >= calendarSystem.MaxYear)
                    return Instant.MaxValue;

                // Start next year
                m = d = 1;
                h = n = s = 0;
            } while (true);
        }