public UserEntityViewModule(ChildWindow aChileWindow, UserEntityViewType aUserEntityViewType, UserEntity aUserEntity, ObservableCollection<DepartmentEntity> aDepartmentEntity)
        {
            this.UserEntityVIewType = aUserEntityViewType;
            this.childWindow = aChileWindow;
            this.UserEntity = aUserEntity;
            this.DepartmentList = aDepartmentEntity;
            if(String.IsNullOrEmpty(aUserEntity.UserName))
            {
                Title = "添加用户";
            }
            else
            {
                Title = "修改用户 编号:" + aUserEntity.UserID.ToString();
            }
            OnOK = new DelegateCommand(OnOKCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);
            OnClose = new DelegateCommand(OnCloseCommand);

            if (aUserEntityViewType == UserEntityViewType.ADD)
            {
                IsAdd = true;
            }
            else
            {
                IsAdd = false;
            }

            CompositionInitializer.SatisfyImports(this);
        }
 private void loadOperationloadOnLineUser_Completed(object sender, EventArgs e)
 {
     LoadOperation loadOpseration = sender as LoadOperation;
     foreach (ProductManager.Web.Model.user user in loadOpseration.Entities)
     {
         UserEntity userEntity = new UserEntity();
         userEntity.User = user;
         //userEntity.UserNameDictionary = UserEntityDictionary;
         userEntity.Update();
         OnLineUserList.Add(userEntity);
     }
 }
 void loadOperationUser_Completed(object sender, EventArgs e)
 {
     UserEntityDictionary.Clear();
     LoadOperation loadOperation = sender as LoadOperation;
     foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
     {
         if (user.user_name == "admin")
         {
             continue;
         }
         UserEntity userEntity = new UserEntity();
         userEntity.User = user;
         userEntity.Update();
         UserEntityDictionary.Add(userEntity.UserID, userEntity);
     }
     using (questionTraceView.DeferRefresh())
     {
         questionTraceView.MoveToFirstPage();
     }
 }
 public UserEntityWindow(UserEntityViewType aUserEntityViewType, UserEntity aUserEntity, ObservableCollection<DepartmentEntity> aDepartmentEntity)
 {
     InitializeComponent();
     UserEntityViewModule userEntityViewModule = new UserEntityViewModule(this, aUserEntityViewType, aUserEntity, aDepartmentEntity);
     this.DataContext = userEntityViewModule;
 }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
            }

            LoadOperation<ProductManager.Web.Model.filetype> loadOperationFiletype =
                SystemManageDomainContext.Load<ProductManager.Web.Model.filetype>(SystemManageDomainContext.GetFiletypeQuery());
            loadOperationFiletype.Completed += loadOperationFileType_Completed;
        }
        void loadOperation_Completed(object sender, EventArgs e)
        {
            UserList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                DepartmentEntity departmentEntity;
                if (DepartmentDictionary.TryGetValue(userEntity.UserDepartmentID, out departmentEntity))
                {
                    userEntity.UserDepartment = departmentEntity.DepartmentName;
                    UserList.Add(userEntity);
                }
            }

            PagedCollectionView lPagedCollectionView = new PagedCollectionView(UserList);
            lPagedCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("UserDepartment"));
            UserDataView = lPagedCollectionView;
            UserDataView.Refresh();
            UpdateChanged("UserList");
            IsBusy = false;
            finishLoaded();
        }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            UserEntityList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityList.Add(userEntity);
            }

            planManagerDomainContext.departments.Clear();
            LoadOperation<department> loadOperationDepartment =
                planManagerDomainContext.Load<department>(planManagerDomainContext.GetDepartmentQuery());
            loadOperationDepartment.Completed += loadOperationDepartment_Completed;
        }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            UserEntityDictionaryName.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityDictionaryName.Add(userEntity.CUserName, userEntity);
            }

            LoadOperation<ProductManager.Web.Model.project> loadOperationProject =
                ProductDomainContext.Load<ProductManager.Web.Model.project>(ProductDomainContext.GetProjectQuery());
            loadOperationProject.Completed += loadOperationProject_Completed;
        }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            UserEntityDictionary.Clear();
            UserEntityList.Clear();

            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityList.Add(userEntity);
            }

            this.importantPartSource = new EntityList<ProductManager.Web.Model.important_part>(this.productDomainContext.important_parts);
            this.importantPartLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.important_part>(
                this.LoadImportantPartEntities,
                this.LoadImportantPartCompleted);
            this.importantPartView = new DomainCollectionView<ProductManager.Web.Model.important_part>(this.importantPartLoader, this.importantPartSource);
            using (this.importantPartView.DeferRefresh())
            {
                this.importantPartView.MoveToFirstPage();
            }
            IsBusy = false;
        }
        void loadOperationUser_Completed(object sender, EventArgs e)
        {
            //UserEntityDictionary.Clear();
            UserEntityList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (user user in loadOperation.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                //UserEntityDictionary.Add(userEntity.UserID, userEntity);
                UserEntityList.Add(userEntity);
            }

            UserEntity userEntityZero = new UserEntity();
            userEntityZero.UserID = -2;
            userEntityZero.CUserName = "******";
            UserEntityList.Add(userEntityZero);

            BusyIndicator.IsBusy = false;
        }
        private void OnAddUserCommand()
        {
            //InvokeOperation<int> loadMaxUserID = operationDomainComtext.GetMaxUserID();
            //loadMaxUserID.Completed += loadMaxUserID_Completed;
            AddUserEntity = new UserEntity();
            ProductManager.Web.Model.user user = new ProductManager.Web.Model.user();
            AddUserEntity.User = user;
            AddUserEntity.UserNameDictionary = UserEntityDictionary;
            user.user_password = Cryptography.MD5CryptoServiceProvider.GetMd5String("123456");
            AddUserEntity.Update();
            UserEntityWindow userEntityWindow = new UserEntityWindow(UserEntityViewType.ADD, AddUserEntity, DepartmemtList);
            userEntityWindow.Closed += new EventHandler(AddUser_Closed);

            userEntityWindow.Show();
        }
        void loadOperation_Completed(LoadOperation<ProductManager.Web.Model.user> sender)
        {
            UserList.Clear();
            //LoadOperation loadOperation = sender as LoadOperation;
            this.userSource.Source = sender.Entities;
            foreach (ProductManager.Web.Model.user user in sender.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.UserNameDictionary = UserEntityDictionary;
                userEntity.Update();
                UserList.Add(userEntity);
                DepartmentEntity departmentEntity;
                if (DepartmentDictionary.TryGetValue(userEntity.UserDepartmentID, out departmentEntity))
                {
                    userEntity.UserDepartment = departmentEntity.DepartmentName;
                }

            }

            if (sender.TotalEntityCount != -1)
            {
                this.userView.SetTotalItemCount(sender.TotalEntityCount);
            }

            UpdateChanged("UserList");
            UpdateChanged("CollectionView");
            IsBusy = false;
        }