Пример #1
0
        /// <summary>
        /// Validating CustomePaymentterms
        /// </summary>
        /// <param name="employeeunit"></param>
        /// <returns></returns>
        protected virtual async Task ValidateEmployeeUnitAsync(EmployeeUnit employeeunit)
        {
            //Validating if Duplicate Employee exists
            if (EmployeeUnitRepository != null)
            {
                var employee = (await EmployeeUnitRepository.GetAllListAsync(p => p.LastName == employeeunit.LastName && p.OrganizationUnitId == employeeunit.OrganizationUnitId));

                if (employeeunit.Id == 0)
                {
                    if (employee.Count > 0)
                    {
                        throw new UserFriendlyException(L("Duplicate Name", employeeunit.LastName));
                    }
                }
                else
                {
                    if (employee.FirstOrDefault(p => p.Id != employeeunit.Id && p.LastName == employeeunit.LastName) != null)
                    {
                        throw new UserFriendlyException(L("Duplicate Name", employeeunit.LastName));
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///  Updating EmployeeUnit Details
        /// </summary>
        /// <param name="employeeunit"></param>
        /// <returns></returns>
        public virtual async Task UpdateAsync(EmployeeUnit employeeunit)
        {
            await ValidateEmployeeUnitAsync(employeeunit);

            await EmployeeUnitRepository.UpdateAsync(employeeunit);
        }