public ContragentOrganizationEditorViewModel(ContragentOrganization agent) { Agent = agent; if (Agent.Address == null) { Agent.Address = new Address { Country = Session.DataModel.Countries.First() }; } }
void CreateContragent() { if (Contract.ContragentType.Id == 1) { var agent = new ContragentPerson { LastName = Contract.Entrant.LastName, FirstName = Contract.Entrant.FirstName, Patronymic = Contract.Entrant.Patronymic, Address = Contract.Entrant.Address, PhoneNumber = Contract.Entrant.Phone, Email = Contract.Entrant.Email, DocumentSeries = Contract.Entrant.Claim.IdentityDocuments.First().Series, DocumentNumber = Contract.Entrant.Claim.IdentityDocuments.First().Number, DocumentDate = Contract.Entrant.Claim.IdentityDocuments.First().Date, DocumentOrganization = Contract.Entrant.Claim.IdentityDocuments.First().Organization, BirthDate = Contract.Entrant.Claim.IdentityDocuments.First().BirthDate, IdentityDocumentType = Contract.Entrant.Claim.IdentityDocuments.First().IdentityDocumentType }; Contract.ContragentPerson = agent; RaisePropertyChanged("Contract"); } if (Contract.ContragentType.Id == 2) { var agent = new ContragentPerson(); var vm = new ContragentPersonEditorViewModel(agent); if (DialogService.DialogLayer.ShowEditor(EditingContent.ContragentPerson, vm)) { Contract.ContragentPerson = agent; RaisePropertyChanged("Contract"); } } if (Contract.ContragentType.Id == 3) { var agent = new ContragentOrganization(); var vm = new ContragentOrganizationEditorViewModel(agent); if (DialogService.DialogLayer.ShowEditor(EditingContent.ContragentOrganization, vm)) { Contract.ContragentOrganization = agent; RaisePropertyChanged("Contract"); } } }