private void OnUserProjectCommand() { ProductManagersViewModel.IsBusy = true; if (!isUserProject) { ProductDomainContext.user_projects.Remove(UserProjectEntity.UserProject); } else { UserProjectEntity = new UserProjectEntity(); UserProjectEntity.UserProject = new ProductManager.Web.Model.user_project(); UserProjectEntity.ManufactureNumber = manufactureNumber; App app = Application.Current as App; UserProjectEntity.UserID = app.UserInfo.UserID; UserProjectEntity.DUpdate(); UserProjectEntity.RaisALL(); ProductDomainContext.user_projects.Add(UserProjectEntity.UserProject); } SubmitOperation submitOperation = ProductDomainContext.SubmitChanges(); submitOperation.Completed += submitOperation_Completed; }
void LoadUserProjectComplete(object sender, EventArgs e) { UserProjectEntityDictionary.Clear(); LoadOperation loadOperation = sender as LoadOperation; foreach (user_project user_project in loadOperation.Entities) { UserProjectEntity lUserProjectEntity = new UserProjectEntity(); lUserProjectEntity.UserProject = user_project; lUserProjectEntity.Update(); UserProjectEntityDictionary.Add(lUserProjectEntity.ManufactureNumber, lUserProjectEntity); } planManagerDomainContext.plan_extras.Clear(); LoadOperation<plan_extra> loadOperationPlanExtra = planManagerDomainContext.Load<plan_extra>(planManagerDomainContext.GetPlan_extraQuery()); loadOperationPlanExtra.Completed += loadOperationPlanExtra_Completed; }
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); } } this.prjectSource = new EntityList<ProductManager.Web.Model.project>(this.ProductDomainContext.projects); this.projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>( this.LoadProjectEntities, this.LoadOperationProjectCompleted); this.projectView = new DomainCollectionView<ProductManager.Web.Model.project>(this.projectLoader, this.prjectSource); using (this.CollectionProjectView.DeferRefresh()) { this.projectView.MoveToFirstPage(); } this.productSource = new EntityList<ProductManager.Web.Model.product>(this.ProductDomainContext.products); this.productLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.product>( this.LoadProductEntities, this.LoadOperationProductCompleted ); this.productView = new DomainCollectionView<ProductManager.Web.Model.product>(this.productLoader, this.productSource); this.projectResponsibleSource = new EntityList<ProductManager.Web.Model.project_responsible>(this.ProductDomainContext.project_responsibles); this.projectResponsibleLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_responsible>( this.LoadProjectResponsibleEntities, this.LoadOperationProjectResponsibleCompleted); this.projectResponsibleView = new DomainCollectionView<ProductManager.Web.Model.project_responsible>(this.projectResponsibleLoader, this.projectResponsibleSource); 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); this.importantPartRejesterSource = new EntityList<ProductManager.Web.Model.important_part_rejester>(this.ProductDomainContext.important_part_rejesters); this.importantPartRejesterLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.important_part_rejester>( this.LoadImportantPartRejesterEntities, this.LoadImportantPartRejesterCompleted ); this.importantPartRejesterView = new DomainCollectionView<ProductManager.Web.Model.important_part_rejester>(this.importantPartRejesterLoader, this.importantPartRejesterSource); UpdateChanged("CollectionProjectView"); IsBusy = false; }