Example #1
0
        private void ProcessDepartmentChangedCmd()
        {
            if (IsAddMode)
            {
                //Apply default role of department
                CurrentUser.UserDeviceRoles = new [] { new UserDeviceRole {
                                                           DeviceRoleID = DepartmentInfo.DeviceRoleID
                                                       } }.ToList();
            }
            else
            {
                //Change default role of department
                var previousDefaultItem   = DeviceRoleListBoxSource.First(x => x.IsDefault);
                var departmentDefaultRole = CurrentUser.UserDeviceRoles.First(x => x.DeviceRoleID == previousDefaultItem.ID);
                departmentDefaultRole.DeviceRoleID = DepartmentInfo.DeviceRoleID;
            }

            DeviceRoleListBoxSource = GetDeviceRoleListBoxSource();
            RaisePropertyChanged(null);
        }