public void SetConfig(LeaveConfig config) { ThrowIfDisposed(); if (config == null) { throw new ArgumentNullException("config"); } this.ConfigStore.SetConfig(config); }
public async Task SetConfigAsync(LeaveConfig config) { ThrowIfDisposed(); if (config == null) { throw new ArgumentNullException("config"); } await this.ConfigStore.SetConfigAsync(config); }
public async Task <ActionResult> Edit(LeaveConfig config) { var teachers = await UserManager.GetInPositionTeachersAsync(); ViewBag.Teachers = new SelectList(teachers, "Id", "Name"); if (ModelState.IsValid) { await LeaveConfigManager.SetConfigAsync(config); return(RedirectToAction("Index")); } return(View(config)); }
public async Task <bool> IsAllLeaveConditionMeeted(string userId, LeaveConfig config) { ThrowIfDisposed(); if (config == null) { throw new ArgumentNullException("config"); } var userLeaves = LeaveStore.GetAllEntities().Where(e => e.Student.Student.Id == userId); var time1 = DateTime.Now; var time2 = DateTime.Now.AddMonths(-1); var c1 = await userLeaves.Where(e => e.AddTime <time1& e.AddTime> time2).ToListAsync(); if (c1.Count() > config.MaxLeaveTimeInOneMonth) { return(false); } return(true); }
public async Task SetConfigAsync(LeaveConfig config) { ThrowIfDisposed(); this.ConfigStore.Update(config); await this.SaveChangesAsync(); }
public void SetConfig(LeaveConfig config) { ThrowIfDisposed(); this.ConfigStore.Update(config); this.SaveChanges(); }