public TransferPageViewModel() { ProjectDal = new ProjectDal(); ApplicantDal = new ApplicantDal(); TransferDal = new TransferDal(); // 初始化下拉框 InitialComboBoxList(); AddOrEditApplicantCommand = new DelegateCommand(() => { switch (ApplicantButtonContent) { case "确认新增": AddApplicant(); break; case "确认修改": EditApplicant(); break; default: break; } }); EditTransferCommand = new DelegateCommand(EditTransfer); SelectApplicantCommand = new DelegateCommand <object>(SelectApplicant); AddApplicantCommand = new DelegateCommand(() => { // 重新加载页面 OnNavigatedTo(NavigationContext); }); DelApplicantCommand = new DelegateCommand(DelApplicant); }
/// <summary> /// 删除项目 /// </summary> private void DelProject() { if (Project == null) { MessageBox.Show("请选择一个项目", "提示"); return; } try { if ("1".Equals(Project.Type)) // 楼盘表项目 { NaturalBuildingDal naturalBuildingDal = new NaturalBuildingDal(); LogicalBuildingDal logicalBuildingDal = new LogicalBuildingDal(); FloorDal floorDal = new FloorDal(); HouseholdDal householdDal = new HouseholdDal(); ObligeeDal obligeeDal = new ObligeeDal(); MortgageDal mortgageDal = new MortgageDal(); SequestrationDal sequestrationDal = new SequestrationDal(); naturalBuildingDal.DelBy(t => t.ProjectID == Project.ID); logicalBuildingDal.DelBy(t => t.ProjectID == Project.ID); floorDal.DelBy(t => t.ProjectID == Project.ID); householdDal.DelBy(t => t.ProjectID == Project.ID); obligeeDal.DelBy(t => t.ProjectID == Project.ID); mortgageDal.DelBy(t => t.ProjectID == Project.ID); sequestrationDal.DelBy(t => t.ProjectID == Project.ID); } else if ("2".Equals(Project.Type)) // 登记业务项目 { TransferDal transferDal = new TransferDal(); ApplicantDal applicantDal = new ApplicantDal(); transferDal.DelBy(t => t.ProjectID == Project.ID); applicantDal.DelBy(t => t.ProjectID == Project.ID); FileHelper.DelDir(Project); } projectDal.Del(Project); } catch (Exception ex) { ErrorDialogViewModel.getInstance().show(ex); return; } RefreshProjectList(); }
/// <summary> /// 初始化登记业务项目 /// </summary> /// <param name="project"></param> /// <returns></returns> public Project InitialRegistrationProject(Project project) { if (project == null) { return(null); } if ("2".Equals(project.Type)) { ApplicantDal applicantDal = new ApplicantDal(); TransferDal transferDal = new TransferDal(); FileInfoDal fileInfoDal = new FileInfoDal(); project.Applicants = applicantDal.GetListBy(a => a.ProjectID == project.ID); project.Transfer = transferDal.GetModel(t => t.ProjectID == project.ID); project.FileInfos = fileInfoDal.GetListBy(f => f.ProjectID == project.ID); } return(project); }
private void DelApplicant() { if (Applicant == null) { MessageBox.Show("请选择申请人", "提示"); return; } try { ApplicantDal.Del(Applicant); // 重新加载页面 OnNavigatedTo(NavigationContext); } catch (Exception ex) { ErrorDialogViewModel.getInstance().show(ex); return; } }