예제 #1
0
파일: Info.cs 프로젝트: greeduomacro/RuneUO
		public ScheduleInfo(
			ScheduleMonths months = ScheduleMonths.All, ScheduleDays days = ScheduleDays.All, ScheduleTimes times = null)
		{
			Months = months;
			Days = days;
			Times = times ?? new ScheduleTimes();
		}
예제 #2
0
    public async Task Test_ScheduleTimes_CRUD()
    {
        #region Arrange
        var tmpEmployee = await FortnoxClient.EmployeeConnector.GetAsync("TEST_EMP") ?? await FortnoxClient.EmployeeConnector.CreateAsync(new Employee()
        {
            EmployeeId = "TEST_EMP"
        });

        #endregion Arrange

        var connector = FortnoxClient.ScheduleTimesConnector;

        #region CREATE

        //Create method is not supported
        var newScheduleTimes = new ScheduleTimes()
        {
            Hours      = 6.5m,
            EmployeeId = tmpEmployee.EmployeeId,
            Date       = new DateTime(2050, 10, 10)
        };

        var createdScheduleTimes = await connector.UpdateAsync(newScheduleTimes);

        Assert.AreEqual(6.5m, createdScheduleTimes.Hours);

        #endregion CREATE

        #region UPDATE

        createdScheduleTimes.Hours = 7;

        var updatedScheduleTimes = await connector.UpdateAsync(createdScheduleTimes);

        Assert.AreEqual(7, updatedScheduleTimes.Hours);

        #endregion UPDATE

        #region READ / GET

        var retrievedScheduleTimes = await connector.GetAsync(createdScheduleTimes.EmployeeId, createdScheduleTimes.Date);

        Assert.AreEqual(7, retrievedScheduleTimes.Hours);

        #endregion READ / GET

        #region DELETE
        //Not available
        #endregion DELETE

        #region Delete arranged resources
        #endregion Delete arranged resources
    }
        public void Test_ScheduleTimes_CRUD()
        {
            #region Arrange
            var tmpEmployee = new EmployeeConnector().Get("TEST_EMP") ?? new EmployeeConnector().Create(new Employee()
            {
                EmployeeId = "TEST_EMP"
            });
            #endregion Arrange

            IScheduleTimesConnector connector = new ScheduleTimesConnector();

            #region CREATE

            //Create method is not supported
            var newScheduleTimes = new ScheduleTimes()
            {
                Hours      = 6.5m,
                EmployeeId = tmpEmployee.EmployeeId,
                Date       = new DateTime(2050, 10, 10)
            };

            var createdScheduleTimes = connector.Update(newScheduleTimes);
            MyAssert.HasNoError(connector);
            Assert.AreEqual(6.5m, createdScheduleTimes.Hours);

            #endregion CREATE

            #region UPDATE

            createdScheduleTimes.Hours = 7;

            var updatedScheduleTimes = connector.Update(createdScheduleTimes);
            MyAssert.HasNoError(connector);
            Assert.AreEqual(7, updatedScheduleTimes.Hours);

            #endregion UPDATE

            #region READ / GET

            var retrievedScheduleTimes = connector.Get(createdScheduleTimes.EmployeeId, createdScheduleTimes.Date);
            MyAssert.HasNoError(connector);
            Assert.AreEqual(7, retrievedScheduleTimes.Hours);

            #endregion READ / GET

            #region DELETE
            //Not available
            #endregion DELETE

            #region Delete arranged resources
            #endregion Delete arranged resources
        }
예제 #4
0
        public static void Configure()
        {
            // 12:00:00 noon
            var times = new ScheduleTimes(new TimeSpan(12, 00, 00));

            // Every month, every day (at 12 noon)
            _Schedule = new Schedule("Auto Restart", Enabled, ScheduleMonths.All, ScheduleDays.All, times, DoRestart);

            // Register the Schedule to appear in [Schedules interface.
            _Schedule.Register();

            EventSink.WorldLoad += Deserialize;
            EventSink.WorldSave += Serialize;
        }
예제 #5
0
파일: Schedule.cs 프로젝트: Ravenwolfe/Core
		public Schedule(
			string name,
			bool enabled,
			ScheduleMonths months = ScheduleMonths.None,
			ScheduleDays days = ScheduleDays.None,
			ScheduleTimes times = null,
			params Action<Schedule>[] onTick)
			: this(name, enabled, new ScheduleInfo(months, days, times), onTick)
		{ }
예제 #6
0
파일: Info.cs 프로젝트: Ravenwolfe/Core
		public virtual void Deserialize(GenericReader reader)
		{
			var version = reader.ReadInt();

			switch (version)
			{
				case 0:
				{
					Months = reader.ReadFlag<ScheduleMonths>();
					Days = reader.ReadFlag<ScheduleDays>();
					Times = reader.ReadTypeCreate<ScheduleTimes>(reader) ?? new ScheduleTimes();
				}
					break;
			}
		}