コード例 #1
0
        public EmployeeModel(Guid employeeGuid, Guid currentUser)
        {
            Employee            = DBHelper.GetEmployee(employeeGuid);
            DepartmentState     = DBHelper.GetEmployeeDepartment(employeeGuid);
            DivisionState       = DBHelper.GetEmployeeDivision(employeeGuid);
            PositionState       = DBHelper.GetEmployeePositionState(employeeGuid);
            SpecificStaffPlaces = DBHelper.GetEmployeeSpecificStaffPlaces(employeeGuid);
            EmployeePlaces      = DBHelper.GetEmployeePlaces(employeeGuid);

            if (EmployeePlaces.Any(t => t.Location != null))
            {
                Place    = EmployeePlaces.First(t => t.Location != null);
                Location = Place.Location;
            }

            IsFavorite   = DBHelper.CheckIsFavorite(currentUser, employeeGuid);
            _currentUser = currentUser;
        }
コード例 #2
0
        public EmployeeModel(Guid employeeGuid, bool loadDepartmentInfo,
                             bool loadDivision,
                             bool loadPosition,
                             bool loadSpecificStaffs,
                             bool loadEmployeePlace)
        {
            Employee = DBHelper.GetEmployee(employeeGuid);

            if (loadDepartmentInfo)
            {
                DepartmentState = DBHelper.GetEmployeeDepartment(employeeGuid);
            }

            if (loadDivision)
            {
                DivisionState = DBHelper.GetEmployeeDivision(employeeGuid);
            }

            if (loadPosition)
            {
                PositionState = DBHelper.GetEmployeePositionState(employeeGuid);
            }

            if (loadSpecificStaffs)
            {
                SpecificStaffPlaces = DBHelper.GetEmployeeSpecificStaffPlaces(employeeGuid);
            }

            if (loadEmployeePlace)
            {
                EmployeePlaces = DBHelper.GetEmployeePlaces(employeeGuid);
                if (EmployeePlaces.Any(t => t.Location != null))
                {
                    Location = EmployeePlaces.First(t => t.Location != null).Location;
                }
            }
        }