private async void AddSchedule() { GXSchedule m = new GXSchedule(); m.Name = "Minutely"; GXDateTime dt = new GXDateTime(DateTime.Now.Date); dt.Skip = DateTimeSkips.Year | DateTimeSkips.Month | DateTimeSkips.Day | DateTimeSkips.Hour | DateTimeSkips.Minute; m.Start = dt.ToFormatString(); UpdateSchedule us = new UpdateSchedule(); us.Schedules.Add(m); GXSchedule h = new GXSchedule(); h.Name = "Hourly"; dt.Skip = DateTimeSkips.Year | DateTimeSkips.Month | DateTimeSkips.Day | DateTimeSkips.Hour; h.Start = dt.ToFormatString(); us.Schedules.Add(h); GXSchedule d = new GXSchedule(); d.Name = "Daily"; dt.Skip = DateTimeSkips.Year | DateTimeSkips.Month | DateTimeSkips.Day; d.Start = dt.ToFormatString(); us.Schedules.Add(d); using (HttpClient client = new HttpClient()) { using (HttpResponseMessage response = await client.PostAsJsonAsync(ServerAddress + "/api/schedule/UpdateSchedule", us)) { Helpers.CheckStatus(response); UpdateScheduleResponse r = await response.Content.ReadAsAsync <UpdateScheduleResponse>(); } } }
public ActionResult <UpdateScheduleResponse> Post(UpdateSchedule request) { if (request.Schedules == null || request.Schedules.Count == 0) { return(BadRequest("Schedules array is empty.")); } UpdateScheduleResponse ret = new UpdateScheduleResponse(); List <UInt64> list = new List <UInt64>(); List <GXScheduleToAttribute> list2 = new List <GXScheduleToAttribute>(); foreach (var it in request.Schedules) { List <GXObject> tmp = it.Objects; it.Objects = null; if (it.Id == 0) { host.Connection.Insert(GXInsertArgs.Insert(it)); list.Add(it.Id); if (tmp != null) { foreach (GXObject o in tmp) { if (o.Attributes != null) { foreach (GXAttribute a in o.Attributes) { list2.Add(new GXScheduleToAttribute() { ScheduleId = it.Id, AttributeId = a.Id }); } } } host.Connection.Insert(GXInsertArgs.InsertRange(list2)); } } else { host.Connection.Update(GXUpdateArgs.Update(it)); } } ret.ScheduleIds = list.ToArray(); host.SetChange(TargetType.Schedule, DateTime.Now); return(ret); }
public async Task UpdateTeamSchedule(UpdateSchedule command) { await _administratorService.ValidateAtLeastModerator(command.UserId, command.GroupId); var group = await _groupRepository.GetWithTeamScheduleAndCourses(command.GroupId, command.TeamName); if (group == null) { throw new AppException($"Team with name {command.TeamName} doesn't exist.", AppErrorCode.DOESNT_EXIST); } var schedule = ScheduleFactory.Create(command.Schedule, group.Courses); var scheduleToUpdate = group.Teams.First(t => t.Name == command.TeamName) .Schedules.FirstOrDefault(s => s.Semester == command.Schedule.Semester); if (scheduleToUpdate == null) { throw new AppException($"There is no schedule to update for semester {command.Schedule.Semester}", AppErrorCode.DOESNT_EXIST); } scheduleToUpdate.Update(schedule.Semester, schedule.ScheduledCourses); await _groupRepository.SaveChangesAsync(); }
public async Task <IActionResult> Put(UpdateSchedule command) { await DispatchAsync(command); return(NoContent()); }
void addSeasonalUpdates(RemoteFortressReader.MapBlock block, int mapBlockX, int mapBlockY, int mapBlockZ) { if (DFConnection.Instance.NetPlantRawList == null) return; mapBlockX /= blockSize; mapBlockY /= blockSize; if (blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ] != null) blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ].Clear(); foreach (var material in block.materials) { if (material.mat_type != 419 || material.mat_index < 0 || DFConnection.Instance.NetPlantRawList.plant_raws.Count <= material.mat_index || DFConnection.Instance.NetPlantRawList.plant_raws[material.mat_index].growths.Count == 0) continue; PlantRaw plantRaw = DFConnection.Instance.NetPlantRawList.plant_raws[material.mat_index]; if (blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ] == null) blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ] = new UpdateSchedule(); var schedule = blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ]; foreach (TreeGrowth growth in plantRaw.growths) { schedule.Add(growth.timing_start); schedule.Add(growth.timing_end); foreach (GrowthPrint print in growth.prints) { schedule.Add(print.timing_start); schedule.Add(print.timing_end); } } } }
public async Task <ActionResult> UpdateSchedule(UpdateSchedule command) { await DispatchCommandAsync(command); return(Ok()); }
public async Task <ActionResult> UpdateSchedule(Guid groupId, string teamName, [FromBody] UpdateSchedule command) { command.GroupId = groupId; command.UserId = User.GetUserId(); command.TeamName = teamName; await _scheduleService.UpdateTeamSchedule(command); return(Ok()); }
public Task <OperationResult <bool> > Update(UpdateSchedule cmd) => _lazyDbConnection.TryExecuteDbMessageAsync(cmd);