Esempio n. 1
0
 /// <summary>
 /// 创建实体
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 protected virtual async Task CreateEmployeeAsync(CreateOrUpdateEmployeeInput input)
 {
     var employee = input.Employee.MapTo<BaseEmployeeInfo>();
     employee.CreatorUserId = YLSession.UserId;
     employee.CreatorUserName = "";
     employee.CreationTime = Clock.Now;
     await _employeeRepository.InsertAsync(employee);
     cacheHandler.Remove(CacheCategoryEmployee, "GetEmployeeList");
 }
Esempio n. 2
0
        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        protected virtual async Task UpdateEmployeeAsync(CreateOrUpdateEmployeeInput input)
        {
            Debug.Assert(input.Employee.Id != null, "input.Employee.Id should be set.");

            var employee = await _employeeRepository.GetAsync(input.Employee.Id);
            employee = input.Employee.MapTo<BaseEmployeeInfo>();
            employee.LastModifierUserId = YLSession.UserId;
            employee.LastModifierUserName = "";
            employee.LastModificationTime = Clock.Now;
            await _employeeRepository.UpdateAsync(employee);
            cacheHandler.Remove(CacheCategoryEmployee, "GetEmployeeList");
        }
Esempio n. 3
0
 /// <summary>
 /// 添加修改实体
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task CreateOrUpdateEmployee(CreateOrUpdateEmployeeInput input)
 {
     if (input.Employee.Id != null && input.Employee.Id != Guid.Empty)
     {
         await UpdateEmployeeAsync(input);
     }
     else
     {
         await CreateEmployeeAsync(input);
     }
 }