public DepartmentWindowViewModel(ChildWindow aChildWindow, DepartmentEntity aDepartmentEntity)
 {
     childWindow = aChildWindow;
     DepartmentEntity = aDepartmentEntity;
     OnOK = new DelegateCommand(OnOKCommand);
     OnCancel = new DelegateCommand(OnCancelCommand);
 }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            DepartmentEntityDictionary.Clear();
            DepartmentEntityList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                DepartmentEntityDictionary.Add(departmentEntity.DepartmentID, departmentEntity);
                DepartmentEntityList.Add(departmentEntity);
            }

            DepartmentEntity departmentEntityZero = new DepartmentEntity();
            departmentEntityZero.DepartmentID = 0;
            departmentEntityZero.DepartmentName = "所有部门";
            DepartmentEntityList.Add(departmentEntityZero);

            LoadOperation<ProductManager.Web.Model.user> loadOperationUser =
                SystemManageDomainContext.Load<ProductManager.Web.Model.user>(SystemManageDomainContext.GetUserQuery());
            loadOperationUser.Completed += loadOperationUser_Completed;
        }
 void loadOperationDepartment_Completed(object sender, EventArgs e)
 {
     //DepartmemtList.Clear();
     DepartmentDictionary.Clear();
     LoadOperation loadOperation = sender as LoadOperation;
     foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
     {
         DepartmentEntity departmentEntity = new DepartmentEntity();
         departmentEntity.Department = department;
         departmentEntity.Update();
         //DepartmemtList.Add(departmentEntity);
         DepartmentDictionary.Add(departmentEntity.DepartmentID, departmentEntity);
     }
     UpdateChanged("DepartmemtList");
     IsBusy = true;
     LoadOperation<ProductManager.Web.Model.user> loadOperationUser =
         systemManageDomainContext.Load<ProductManager.Web.Model.user>(systemManageDomainContext.GetUserQuery());
     loadOperationUser.Completed += loadOperation_Completed;
 }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                departmentIdNameDictionary.Add(departmentEntity.DepartmentID, departmentEntity.DepartmentName);
            }
            IsBusy = true;

            planManagerDomainContext.projects.Clear();
            //LoadOperation<project> loadOperationProject =
            //    planManagerDomainContext.Load<project>(planManagerDomainContext.GetProjectQuery());
            //loadOperationProject.Completed += loadOperationProject_Completed;
            this.prjectSource = new EntityList<project>(this.planManagerDomainContext.projects);
            this.projectLoader = new DomainCollectionViewLoader<project>(
                this.LoadProjectEntities,
                this.LoadOperationProjectCompleted);
            this.projectView = new DomainCollectionView<project>(this.projectLoader, this.prjectSource);
            using (this.CollectionProjectView.DeferRefresh())
            {
                this.projectView.MoveToFirstPage();
            }
        }
 public DepartmentWindow(DepartmentEntity aDepartmentEntity)
 {
     InitializeComponent();
     this.DataContext = new DepartmentWindowViewModel(this, aDepartmentEntity);
 }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            departmentIdNameDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                departmentIdNameDictionary.Add(departmentEntity.DepartmentID, departmentEntity.DepartmentName);
            }

            IsBusy = true;

            planManagerDomainContext.projects.Clear();
            LoadOperation<ProductManager.Web.Model.project> loadOperationProject =
                planManagerDomainContext.Load<project>(planManagerDomainContext.GetProjectQuery());
            loadOperationProject.Completed += loadOperationProject_Completed;
        }
 private void OnAddCommand()
 {
     AddDepartmentEntity = new DepartmentEntity();
     AddDepartmentEntity.Department = new ProductManager.Web.Model.department();
     AddDepartmentEntity.Update();
     DepartmentWindow departmentWindow = new DepartmentWindow(AddDepartmentEntity);
     departmentWindow.Closed += departmentWindow_Closed;
     departmentWindow.Show();
 }
 private void loadOperationDepartment_Completed(object sender, EventArgs e)
 {
     DepartmentEntityList.Clear();
     LoadOperation loadOperation = sender as LoadOperation;
     foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
     {
         DepartmentEntity departmentEntity = new DepartmentEntity();
         departmentEntity.Department = department;
         departmentEntity.Update();
         DepartmentEntityList.Add(departmentEntity);
     }
     UpdateChanged("DepartmentEntityList");
     IsBusy = false;
 }
 public void LoadData()
 {
     systemManageDomainContext = new SystemManageDomainContext();
     SelectDepartmentEntity = null;
     IsBusy = true;
     LoadOperation<ProductManager.Web.Model.department> loadOperationDepartment =
         systemManageDomainContext.Load<ProductManager.Web.Model.department>(systemManageDomainContext.GetDepartmentQuery());
     loadOperationDepartment.Completed += loadOperationDepartment_Completed;
 }
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            DepartmemtList.Clear();
            DepartmentDictionary.Clear();
            LoadOperation loadOperation = sender as LoadOperation;
            foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                DepartmemtList.Add(departmentEntity);
                DepartmentDictionary.Add(departmentEntity.DepartmentID, departmentEntity);
            }
            DepartmentEntity departmentEntityZero = new DepartmentEntity();
            departmentEntityZero.DepartmentID = 0;
            departmentEntityZero.DepartmentName = "请选择部门";
            DepartmemtList.Add(departmentEntityZero);
            UpdateChanged("DepartmemtList");

            LoadOperation<ProductManager.Web.Model.project> loadOperationProject =
                ProductDomainContext.Load<ProductManager.Web.Model.project>(ProductDomainContext.GetProjectQuery());
            loadOperationProject.Completed += loadOperationProject_Completed;
        }