private void LoadOperationProjectCompleted(LoadOperation <ProductManager.Web.Model.project> aLoadOperation) { ProjectEntityList.Clear(); UserProjectCount = 0; foreach (ProductManager.Web.Model.project project in aLoadOperation.Entities) { ProjectEntity projectEntity = new ProjectEntity(); projectEntity.Project = project; projectEntity.Update(); UserProjectEntity lUserProjectEntity; if (UserProjectEntityDictionary.TryGetValue(projectEntity.ManufactureNumber, out lUserProjectEntity)) { projectEntity.UserProjectEntity = lUserProjectEntity; projectEntity.SetIsUserProject(true); } if (IsUserProject && !projectEntity.IsUserProject) { continue; } ProjectEntityList.Add(projectEntity); UserProjectCount++; } if (aLoadOperation.TotalEntityCount != -1) { this.projectView.SetTotalItemCount(aLoadOperation.TotalEntityCount); } UpdateChanged("ProjectEntityList"); UpdateChanged("CollectionProjectView"); UpdateChanged("RecorderCount"); this.IsBusy = false; }
void submitOperation_Completed(object sender, EventArgs e) { SubmitOperation submitOperation = sender as SubmitOperation; ProductManagersViewModel.IsBusy = false; if (submitOperation.HasError) { if (!isUserProject) { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "取消自选失败!"); notifyWindow.Show(); } else { submitOperation.MarkErrorAsHandled(); NotifyWindow notifyWindow = new NotifyWindow("错误", "添加自选失败!"); notifyWindow.Show(); } } else { if (!isUserProject) { NotifyWindow notifyWindow = new NotifyWindow("成功", "取消自选成功!"); notifyWindow.Show(); //isUserProject = false; UserProjectEntityDictionary.Remove(manufactureNumber); } else { NotifyWindow notifyWindow = new NotifyWindow("成功", "添加自选成功!"); notifyWindow.Show(); //isUserProject = true; UserProjectEntityDictionary.Add(manufactureNumber, UserProjectEntity); } } }
void LoadUserProjectComplete(object sender, EventArgs e) { UserProjectEntityDictionary.Clear(); LoadOperation loadOperation = sender as LoadOperation; foreach (ProductManager.Web.Model.user_project user_project in loadOperation.Entities) { UserProjectEntity lUserProjectEntity = new UserProjectEntity(); lUserProjectEntity.UserProject = user_project; lUserProjectEntity.Update(); UserProjectEntity lUserProjectEntityTemp; if (!UserProjectEntityDictionary.TryGetValue(lUserProjectEntity.ManufactureNumber, out lUserProjectEntityTemp)) { UserProjectEntityDictionary.Add(lUserProjectEntity.ManufactureNumber, lUserProjectEntity); } } LoadOperation <ProductManager.Web.Model.department> loadOperationDepartment = SystemManageDomainContext.Load <ProductManager.Web.Model.department>(SystemManageDomainContext.GetDepartmentQuery()); loadOperationDepartment.Completed += loadOperationDepartment_Completed; }