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; }