コード例 #1
0
 public void SetConfig(LeaveConfig config)
 {
     ThrowIfDisposed();
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     this.ConfigStore.SetConfig(config);
 }
コード例 #2
0
 public async Task SetConfigAsync(LeaveConfig config)
 {
     ThrowIfDisposed();
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     await this.ConfigStore.SetConfigAsync(config);
 }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public async Task SetConfigAsync(LeaveConfig config)
 {
     ThrowIfDisposed();
     this.ConfigStore.Update(config);
     await this.SaveChangesAsync();
 }
コード例 #6
0
 public void SetConfig(LeaveConfig config)
 {
     ThrowIfDisposed();
     this.ConfigStore.Update(config);
     this.SaveChanges();
 }