private async Task Delete_Document_UnitTest(string authKey) { Command deleteResponse = new Command(); IdentityDocument getResponse = new IdentityDocument(); try { if (authKey.Equals("")) { deleteResponse = await _bucketService.DeleteAsync(FirstDocumentId, _logger); getResponse = await _bucketService.GetAsync <IdentityDocument>(FirstDocumentId, _logger); } else { var bucketService = new BucketService(authKey); deleteResponse = await bucketService.DeleteAsync(SecondDocumentId, _logger); getResponse = await bucketService.GetAsync <IdentityDocument>(SecondDocumentId, _logger); } } catch (BlipHttpClientException) { getResponse.Value.ShouldBeNull(); } finally { deleteResponse.Status.ShouldBe(CommandStatus.Success); } }
public async Task HandleAsync(SignUp command) { _validator.Validate(command).ThrowIfInvalid(); var alreadyExists = await _repository.ExistsAsync(u => u.Username == command.Username || u.Email == command.Email); if (alreadyExists) { throw new UserAlreadyExistsException(command.Username, command.Email); } var salt = _passwordService.CreateSalt(); var passwordHash = _passwordService.HashPassword(command.Password, salt); var user = new IdentityDocument { Id = command.Id, Username = command.Username, FullName = command.FullName, Email = command.Email, PhoneNumber = command.PhoneNumber, Password = passwordHash, Salt = salt, UpdatedAt = DateTime.UtcNow }; await _repository.AddAsync(user); }
public IActionResult Update(long id, [FromBody] IdentityDocument item) { if (item == null || item.Id != id) { return(BadRequest()); } var document = _context.IdentityDocuments.FirstOrDefault(t => t.Id == id); if (document == null) { return(NotFound()); } document.Type = item.Type; document.NaturalPersonId = item.NaturalPersonId; document.Number = item.Number; document.Name = item.Name; document.Surname = item.Surname; document.Patronymic = item.Patronymic; document.Sex = item.Sex; document.DateOfBirth = item.DateOfBirth; document.DateOfIssue = item.DateOfIssue; document.Authority = item.Authority; document.DateOfExpiration = item.DateOfExpiration; document.RegistrationAddressId = item.RegistrationAddressId; _context.IdentityDocuments.Update(document); _context.SaveChanges(); return(new NoContentResult()); }
public string GenerateRandomIdentity() { // Generate a random seed and new identity. var mnemonic = new Mnemonic(Wordlist.English, WordCount.Twelve); ExtKey masterNode = mnemonic.DeriveExtKey(); ExtPubKey walletRoot = masterNode.Derive(new KeyPath("m/44'")).Neuter(); ExtKey identityRoot = masterNode.Derive(new KeyPath("m/302'")); ExtKey identity0 = identityRoot.Derive(0, true); ExtKey identity1 = identityRoot.Derive(1, true); BitcoinPubKeyAddress identity0Address = identity0.PrivateKey.PubKey.GetAddress(profileNetwork); BitcoinPubKeyAddress identity1Address = identity1.PrivateKey.PubKey.GetAddress(profileNetwork); string identity0Id = identity0Address.ToString(); // Create an identity profile that should be signed and pushed. IdentityModel identityModel = new IdentityModel { Id = identity0Id, Name = "Random Person", ShortName = "Random", Alias = "Who Knows", Email = "*****@*****.**", Title = "President" }; byte[] entityBytes = MessagePackSerializer.Serialize(identityModel); // Testing to only sign the name. string signature = identity0.PrivateKey.SignMessage(entityBytes); IdentityDocument identityDocument = new IdentityDocument { Owner = identityModel.Id, Body = identityModel, Signature = signature }; string json = JsonConvert.SerializeObject(identityDocument); RestClient client = CreateClient(); // Persist the identity. var request2 = new RestRequest($"/identity/{identityModel.Id}"); request2.AddJsonBody(identityDocument); IRestResponse <string> response2 = client.Put <string>(request2); if (response2.StatusCode != System.Net.HttpStatusCode.OK) { throw new ApplicationException(response2.ErrorMessage); } return(identity0Id); }
void Add() { var address = new Address() { Country = Session.DataModel.Countries.FirstOrDefault() }; var entrant = new Entrant() { Address = address, Gender = Session.DataModel.Genders.First() }; var ord = new OtherRequiredDocument { Fluorography = false, Certificate = false, Photos = false, MedicinePermission = false }; var identityDocument = new IdentityDocument(); var claim = new Claim() { RegistrationDate = DateTime.Now, IsHostelNeed = false, PersonalReturning = true, ClaimStatus = Session.DataModel.ClaimStatuses.FirstOrDefault() }; claim.Entrants.Add(entrant); claim.OtherRequiredDocuments.Add(ord); claim.IdentityDocuments.Add(identityDocument); Session.DataModel.OtherRequiredDocuments.Add(ord); Session.DataModel.Addresses.Add(address); Session.DataModel.Entrants.Add(entrant); Session.DataModel.IdentityDocuments.Add(identityDocument); Session.DataModel.Claims.Add(claim); var vm = new ClaimEditorViewModel(claim); var validator = new ClaimValidator(claim); if (DialogLayer.ShowEditor(EditingContent.ClaimEditor, vm, validator)) { Session.DataModel.SaveChanges(); RaisePropertyChanged("ClaimList"); } else { Session.DataModel.Claims.Remove(claim); Session.DataModel.SaveChanges(); } }
public TestIdentityDocument(IdentityDocument d) { if (d != null) { document = d; document.DocN = document.DocN.Replace("-", ""); if (document.IssuedDate == DateTime.MinValue) document.IssuedDate = null; } }
public async Task BucketStoreLogUnitTest_ShouldSucceed() { var document = new IdentityDocument(IdentityString); var client = BuildSenderSubstitute_ReturnsSuccessStatus(); var bucketService = new BucketService(client); var logger = Substitute.For <ILogger>(); var task = bucketService.SetAsync(FirstDocumentId, document, logger); await TestInfoLogsWithTwoArgs <IdentityDocument, string>(task, 2, logger); }
public IActionResult GetIdentityDocument(int id) { IdentityDocument identitydocument = _context.IdentityDocument.FirstOrDefault(s => s.PersonOnBoardId == id); if (identitydocument == null) { return(NotFound()); } return(Json(identitydocument)); }
private string PrintIdentityDocument(IdentityDocument document) { var result = document.Number; if (document.ExpiryDate != null) { var expiryDate = BindConvert.Current.ShortDate.Format(new DateTime(document.ExpiryDate.Year, document.ExpiryDate.Month, document.ExpiryDate.Day)); result += $", {expiryDate}"; } return(result); }
public TestIdentityDocument(IdentityDocument d) { if (d != null) { document = d; document.DocN = document.DocN.Replace("-", ""); if (document.IssuedDate == DateTime.MinValue) { document.IssuedDate = null; } } }
public IActionResult Post([FromBody] IdentityDocument item) { if (item == null) { return(BadRequest()); } item.Id = _context.IdentityDocuments.Count() + 1; _context.IdentityDocuments.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetIdentityDocument", new { id = item.Id }, item)); }
public IActionResult Get(int id) { IdentityDocument identityDocument = _context.IdentityDocument.Where(i => i.IdentityDocumentId == id) .Include(i => i.IssuingNation) .Include(i => i.IdentityDocumentType) .FirstOrDefault(); if (identityDocument == null) { return(NotFound()); } return(Json(identityDocument)); }
void AddIdentityDocument() { var doc = new IdentityDocument { BirthPlace = IdentityDocument.BirthPlace, BirthDate = IdentityDocument.BirthDate, Organization = IdentityDocument.Organization }; var vm = new IdentityDocumentEditorViewModel(doc); if (DialogLayer.ShowEditor(EditingContent.IdentityDocumentEditor, vm)) { EditedClaim.IdentityDocuments.Add(doc); } }
private async Task Get_Document_UnitTest(string authKey) { IdentityDocument getResponse; var document = new IdentityDocument(IdentityString); if (authKey.Equals("")) { getResponse = await _bucketService.GetAsync <IdentityDocument>(FirstDocumentId, _logger); } else { var bucketService = new BucketService(authKey); getResponse = await bucketService.GetAsync <IdentityDocument>(SecondDocumentId, _logger); } getResponse.Value.Equals(document.Value).ShouldBeTrue(); }
public override async Task UpdateAsync(IRepository <Employee, Guid> repository) { var employee = await repository.GetAsync(Id); employee.IsNull().Throw <DataNotFoundException>(Id); if (Email.HasValue() && !employee.Email.Equals(Email, StringComparison.CurrentCultureIgnoreCase)) { var employeeSameEmail = await repository.GetFirstAsync(e => e.Email == Email); employeeSameEmail.IsNotNull().Throw <BusinessConflictException>(string.Format(Messages.AlreadyExists, "email")); employee.Email = Email; } if (FirstName.HasValue()) { employee.FirstName = FirstName; } if (LastName.HasValue()) { employee.LastName = LastName; } if (Password.HasValue()) { employee.Password = Password; } if (IdentityDocument.HasValue()) { employee.IdentityDocument = IdentityDocument; } if (SocialSecurity.HasValue()) { employee.SocialSecurity = SocialSecurity; } employee.Active = Active; ModifiedDate = DateTime.UtcNow; await repository.SaveAsync(employee); }
private async Task Store_Document_UnitTest(string authKey) { Command setResponse; var document = new IdentityDocument(IdentityString); if (authKey.Equals("")) { setResponse = await _bucketService.SetAsync(FirstDocumentId, document, _logger); } else { var bucketService = new BucketService(authKey); setResponse = await bucketService.SetAsync(SecondDocumentId, document, _logger); } setResponse.Status.ShouldBe(CommandStatus.Success); }
public async Task BucketStoreLogUnitTest_ShouldThrowEx() { var document = new IdentityDocument(IdentityString); var logger = Substitute.For <ILogger>(); var client = BuildSenderSubstitute_ThrowsException(); var bucketService = new BucketService(client); var exceptionThrown = false; try { await bucketService.SetAsync(FirstDocumentId, document, logger); } catch (Exception ex) { logger.Received(1).Error(ex, Arg.Any <string>(), Arg.Any <IdentityDocument>(), Arg.Any <string>()); exceptionThrown = true; } finally { exceptionThrown.ShouldBe(true); } }
public IActionResult Update([FromBody] IdentityDocument identityDocument) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { if (_context.IdentityDocument.Any(i => i.IdentityDocumentId == identityDocument.IdentityDocumentId)) { _context.IdentityDocument.Update(identityDocument); } else { _context.IdentityDocument.Add(identityDocument); } _context.SaveChanges(); return(Json(identityDocument)); } catch (Exception e) { return(BadRequest(e)); } }
public IdentityDocumentEditorViewModel(IdentityDocument document) { _document = document; }
static public List <TestIdentityDocument> BuildDocumentsFromDataBaseData(string idPerson) { List <TestIdentityDocument> documents = new List <TestIdentityDocument>(); using (SqlConnection connection = Global.GetSqlConnection()) { foreach (int i in Enum.GetValues(typeof(docs))) { string findPatient = "SELECT TOP(1) * FROM Document WHERE IdDocument = (SELECT MAX(IdDocument) FROM Document WHERE IdPerson = '" + idPerson + "' AND IdDocumentType = '" + i + "')"; SqlCommand person = new SqlCommand(findPatient, connection); using (SqlDataReader documentReader = person.ExecuteReader()) { // bool a = documentReader.Read(); while (documentReader.Read()) { IdentityDocument doc = new IdentityDocument(); if (documentReader["DocN"].ToString() != "") { doc.DocN = Convert.ToString(documentReader["DocN"]); } if (documentReader["ProviderName"].ToString() != "") { doc.ProviderName = Convert.ToString(documentReader["ProviderName"]); } if (documentReader["IdDocumentType"].ToString() != "") { doc.IdDocumentType = Convert.ToByte(documentReader["IdDocumentType"]); } if (documentReader["DocS"].ToString() != "") { doc.DocS = Convert.ToString(documentReader["DocS"]); } if (documentReader["IdProvider"].ToString() != "") { doc.IdProvider = Convert.ToInt32(documentReader["IdProvider"]); } if (documentReader["IssuedDate"].ToString() != "") { doc.IssuedDate = Convert.ToDateTime(documentReader["IssuedDate"]); } if (documentReader["ExpiredDate"].ToString() != "") { doc.ExpiredDate = Convert.ToDateTime(documentReader["ExpiredDate"]); } if (documentReader["RegionCode"].ToString() != "") { doc.RegionCode = Convert.ToString(documentReader["RegionCode"]); } TestIdentityDocument document = new TestIdentityDocument(doc); documents.Add(document); } } } } if (documents.Count != 0) { return(documents); } else { return(null); } }
public string GenerateIdentity() { // Generate a fixed identity. string recoveryPhrase = "mystery problem faith negative member bottom concert bundle asthma female process twelve"; var mnemonic = new Mnemonic(recoveryPhrase); ExtKey masterNode = mnemonic.DeriveExtKey(); ExtPubKey walletRoot = masterNode.Derive(new KeyPath("m/44'")).Neuter(); ExtKey identityRoot = masterNode.Derive(new KeyPath("m/302'")); ExtKey identity0 = identityRoot.Derive(0, true); ExtKey identity1 = identityRoot.Derive(1, true); BitcoinPubKeyAddress identity0Address = identity0.PrivateKey.PubKey.GetAddress(profileNetwork); BitcoinPubKeyAddress identity1Address = identity1.PrivateKey.PubKey.GetAddress(profileNetwork); string identity0Id = identity0Address.ToString(); // PTe6MFNouKATrLF5YbjxR1bsei2zwzdyLU string identity1Id = identity1Address.ToString(); // PAcmQwEMW2oxzRBz7u6oFQMtYPSYqoXyiw // Create an identity profile that should be signed and pushed. IdentityModel identityModel = new IdentityModel { Id = identity0Id, Name = "This is a person", ShortName = "None of yoru concern", Alias = "JD", Title = "President of the World", Email = "*****@*****.**" }; byte[] entityBytes = MessagePackSerializer.Serialize(identityModel); // Testing to only sign the name. string signature = identity0.PrivateKey.SignMessage(entityBytes); IdentityDocument identityDocument = new IdentityDocument { Owner = identityModel.Id, Body = identityModel, Signature = signature }; string json = JsonConvert.SerializeObject(identityDocument); RestClient client = CreateClient(); // Get the identity, if it exists. var request = new RestRequest($"/identity/{identityModel.Id}"); IRestResponse <string> response = client.Get <string>(request); //if (response.StatusCode != System.Net.HttpStatusCode.OK) //{ // throw new ApplicationException(response.ErrorMessage); //} string data = response.Data; // Persist the identity. var request2 = new RestRequest($"/identity/{identityModel.Id}"); request2.AddJsonBody(identityDocument); IRestResponse <string> response2 = client.Put <string>(request2); if (response2.StatusCode != System.Net.HttpStatusCode.OK) { throw new ApplicationException(response2.ErrorMessage); } return(identity0Id); }
public static List<TestIdentityDocument> BuildDocumentsFromDataBaseData(string idPerson) { List<TestIdentityDocument> documents = new List<TestIdentityDocument>(); using (SqlConnection connection = Global.GetSqlConnection()) { foreach (int i in Enum.GetValues(typeof(docs))) { string findPatient = "SELECT TOP(1) * FROM Document WHERE IdDocument = (SELECT MAX(IdDocument) FROM Document WHERE IdPerson = '" + idPerson + "' AND IdDocumentType = '" + i + "')"; SqlCommand person = new SqlCommand(findPatient, connection); using (SqlDataReader documentReader = person.ExecuteReader()) { // bool a = documentReader.Read(); while (documentReader.Read()) { IdentityDocument doc = new IdentityDocument(); if (documentReader["DocN"].ToString() != "") doc.DocN = Convert.ToString(documentReader["DocN"]); if (documentReader["ProviderName"].ToString() != "") doc.ProviderName = Convert.ToString(documentReader["ProviderName"]); if (documentReader["IdDocumentType"].ToString() != "") doc.IdDocumentType = Convert.ToByte(documentReader["IdDocumentType"]); if (documentReader["DocS"].ToString() != "") doc.DocS = Convert.ToString(documentReader["DocS"]); if (documentReader["IdProvider"].ToString() != "") doc.IdProvider = Convert.ToInt32(documentReader["IdProvider"]); if (documentReader["IssuedDate"].ToString() != "") doc.IssuedDate = Convert.ToDateTime(documentReader["IssuedDate"]); if (documentReader["ExpiredDate"].ToString() != "") doc.ExpiredDate = Convert.ToDateTime(documentReader["ExpiredDate"]); if (documentReader["RegionCode"].ToString() != "") doc.RegionCode = Convert.ToString(documentReader["RegionCode"]); TestIdentityDocument document = new TestIdentityDocument(doc); documents.Add(document); } } } } if (documents.Count != 0) return documents; else return null; }
private List <PersonOnBoard> ConvertToCrew(ExcelWorksheet worksheet, CrewSheet sheetDefinition, int crewTypeId, int portCallId) { var crewList = new List <PersonOnBoard>(); var validator = new PersonOnBoardSpreadSheetValidator(); var identityType = _context.IdentityDocumentType.Where(idt => idt.EnumValue == IDENTITY_DOCUMENT_TYPES.PASSPORT.ToString()).FirstOrDefault(); var sequenceNo = 0; var genders = _context.Gender.ToList(); var portDictionairy = new Dictionary <string, int>(); var countriesDictionairy = new Dictionary <string, int>(); var master = true; for (var rowNum = sheetDefinition.startRow; rowNum <= worksheet.Dimension.End.Row; rowNum++) { var row = worksheet.Cells[string.Format("{0}:{0}", rowNum)]; var LastName = worksheet.Cells[rowNum, sheetDefinition.LastNameAddress].Text; var FirstName = worksheet.Cells[rowNum, sheetDefinition.FirstNameAddress].Text + " " + worksheet.Cells[rowNum, sheetDefinition.MiddleNameAddress].Text; var Nationality = worksheet.Cells[rowNum, sheetDefinition.NationalityAddress].Text; var Sex = worksheet.Cells[rowNum, sheetDefinition.SexAddress].Text; var DateOfBirth = worksheet.Cells[rowNum, sheetDefinition.DateOfBirthAddress].Text; var DocumentNumber = worksheet.Cells[rowNum, sheetDefinition.DocumentNumberAddress].Text; var CountryOfIssue = worksheet.Cells[rowNum, sheetDefinition.CountryOfIssueAddress].Text; var DateOfExpiry = worksheet.Cells[rowNum, sheetDefinition.DateOfExpiryAddress].Text; var PortOfEmbarkation = worksheet.Cells[rowNum, sheetDefinition.PortOfEmbarkAddress].Text; var PortOfDebarkation = worksheet.Cells[rowNum, sheetDefinition.PortOfDebarkAddress].Text; var RankOrRating = worksheet.Cells[rowNum, sheetDefinition.RankOrRatingAddress].Text; var PlaceOfBirth = worksheet.Cells[rowNum, sheetDefinition.PlaceOfBirthAddress].Text; var Effects = worksheet.Cells[rowNum, sheetDefinition.EffectsCustomsAddress].Text; Regex rgx = new Regex($"^[{_validCharacters}]+[*]?$"); FirstName = FirstName.TrimEnd(); LastName = rgx.Replace(LastName, ""); FirstName = rgx.Replace(FirstName, ""); if (string.IsNullOrWhiteSpace(LastName) && string.IsNullOrWhiteSpace(FirstName)) { continue; } Nationality = rgx.Replace(Nationality, ""); Sex = rgx.Replace(Sex, ""); DocumentNumber = rgx.Replace(DocumentNumber, ""); CountryOfIssue = rgx.Replace(CountryOfIssue, ""); PortOfEmbarkation = rgx.Replace(PortOfEmbarkation, ""); PortOfDebarkation = rgx.Replace(PortOfDebarkation, ""); RankOrRating = rgx.Replace(RankOrRating, ""); PlaceOfBirth = rgx.Replace(PlaceOfBirth, ""); Effects = rgx.Replace(Effects, ""); var crew = new PersonOnBoard { FamilyName = LastName, GivenName = FirstName, PersonOnBoardTypeId = crewTypeId, PortCallId = portCallId, IsMaster = master }; master = false; if (!string.IsNullOrWhiteSpace(Nationality)) { if (countriesDictionairy.ContainsKey(Nationality)) { crew.NationalityId = countriesDictionairy.GetValueOrDefault(Nationality); } else { var nationality = GetCountryByThreeCharCode(Nationality); if (nationality != null) { crew.NationalityId = nationality.CountryId; countriesDictionairy.Add(Nationality, nationality.CountryId); } } } if (!string.IsNullOrWhiteSpace(Sex)) { var genderEnum = ConvertToGender(Sex); var gender = genders.FirstOrDefault(g => g.EnumValue == genderEnum.ToString()); if (gender == null) { gender = genders.FirstOrDefault(g => g.EnumValue == GENDER_TYPES.OTHER.ToString()); } crew.GenderId = gender.GenderId; } if (!string.IsNullOrWhiteSpace(DateOfBirth)) { crew.DateOfBirth = ConvertToDatetime(DateOfBirth); } if (!string.IsNullOrWhiteSpace(DocumentNumber) || !string.IsNullOrWhiteSpace(CountryOfIssue) || !string.IsNullOrWhiteSpace(DateOfExpiry)) { var expiryDate = ConvertToDatetime(DateOfExpiry); if (identityType != null) { var identityDocument = new IdentityDocument { IdentityDocumentNumber = DocumentNumber, IdentityDocumentExpiryDate = expiryDate, IdentityDocumentType = identityType }; if (countriesDictionairy.ContainsKey(CountryOfIssue)) { identityDocument.IssuingNationId = countriesDictionairy.GetValueOrDefault(CountryOfIssue); } else { var issuingNation = GetCountryByThreeCharCode(CountryOfIssue); if (issuingNation != null) { identityDocument.IssuingNationId = issuingNation.CountryId; countriesDictionairy.Add(CountryOfIssue, issuingNation.CountryId); } } crew.IdentityDocument = new List <IdentityDocument> { identityDocument }; } } if (!string.IsNullOrWhiteSpace(PortOfEmbarkation)) { if (portDictionairy.ContainsKey(PortOfEmbarkation)) { crew.PortOfEmbarkationId = portDictionairy.GetValueOrDefault(PortOfEmbarkation); } else { var portOfEmbark = GetPortByCode(PortOfEmbarkation); if (portOfEmbark != null) { crew.PortOfEmbarkationId = portOfEmbark.LocationId; portDictionairy.Add(PortOfEmbarkation, portOfEmbark.LocationId); } } } if (!string.IsNullOrWhiteSpace(PortOfDebarkation)) { if (portDictionairy.ContainsKey(PortOfDebarkation)) { crew.PortOfDisembarkationId = portDictionairy.GetValueOrDefault(PortOfDebarkation); } else { var portOfDebarkation = GetPortByCode(PortOfEmbarkation); if (portOfDebarkation != null) { crew.PortOfDisembarkationId = portOfDebarkation.LocationId; portDictionairy.Add(PortOfDebarkation, portOfDebarkation.LocationId); } } } if (!string.IsNullOrWhiteSpace(PlaceOfBirth)) { crew.PlaceOfBirth = PlaceOfBirth; } if (!string.IsNullOrWhiteSpace(RankOrRating)) { crew.RankName = RankOrRating; } if (!string.IsNullOrWhiteSpace(Effects)) { crew.CrewEffects = Effects; } var errors = validator.ValidatePersonOnBoardSpreadSheetModel(crew); crew.Errors = errors; crew.ExcelRowNum = rowNum; crew.ErrorMessages = validator.ConvertErrorsToMsg(errors); crew.SequenceNumber = sequenceNo; crew.IsPax = false; sequenceNo++; crewList.Add(crew); } return(crewList); }
/// <summary> /// Отправляет заявление в архив и создает на его основе новое с такми же данными, но с опущенными номером /// заявления, условиями приёма, внутренними вступительными испытаниями. /// Также выставляет текущую дату регистрации заявления. /// </summary> /// <param name="existingClaim">Существующее заявление, отправляемое в архив</param> void CopyAndArchiveClaim() { var existingClaim = SelectedClaim; // Копируем текущие данные в новое заявление var newClaim = new Claim { RegistrationDate = DateTime.Now, ClaimStatus = existingClaim.ClaimStatus, IsHostelNeed = existingClaim.IsHostelNeed, PersonalReturning = existingClaim.PersonalReturning }; newClaim.ClaimStatus = existingClaim.ClaimStatus; // Документы о результатах ЕГЭ foreach (var egeDoc in existingClaim.EgeDocuments) { var newEgeDoc = new EgeDocument { OriginalReceivedDate = egeDoc.OriginalReceivedDate, Number = egeDoc.Number, Date = egeDoc.Date, Year = egeDoc.Year }; // Сами результаты ЕГЭ foreach (var result in egeDoc.EgeResults) { var newResult = new EgeResult { ExamSubject = result.ExamSubject, Value = result.Value, IsChecked = result.IsChecked }; newEgeDoc.EgeResults.Add(newResult); } newClaim.EgeDocuments.Add(newEgeDoc); } // Индивидуальные достижения foreach (var individualAchievement in existingClaim.EntranceIndividualAchievements) { var newIndAch = new EntranceIndividualAchievement { CampaignIndividualAchievement = individualAchievement.CampaignIndividualAchievement }; newClaim.EntranceIndividualAchievements.Add(newIndAch); } // Документы об образовании // Аттестаты среднего образования foreach (var eduDoc in existingClaim.SchoolCertificateDocuments) { var newEduDoc = new SchoolCertificateDocument { OriginalReceivedDate = eduDoc.OriginalReceivedDate, Series = eduDoc.Series, Number = eduDoc.Number, Date = eduDoc.Date, SubdivisionCode = eduDoc.SubdivisionCode, EducationOrganization = eduDoc.EducationOrganization, FiveCount = eduDoc.FiveCount, FourCount = eduDoc.FourCount, ThreeCount = eduDoc.ThreeCount }; newClaim.SchoolCertificateDocuments.Add(newEduDoc); } // Дипломы СПО foreach (var eduDoc in existingClaim.MiddleEducationDiplomaDocuments) { var newEduDoc = new MiddleEducationDiplomaDocument { OriginalReceivedDate = eduDoc.OriginalReceivedDate, Series = eduDoc.Series, Number = eduDoc.Number, Date = eduDoc.Date, SubdivisionCode = eduDoc.SubdivisionCode, EducationOrganization = eduDoc.EducationOrganization, FiveCount = eduDoc.FiveCount, FourCount = eduDoc.FourCount, ThreeCount = eduDoc.ThreeCount }; newClaim.MiddleEducationDiplomaDocuments.Add(newEduDoc); } // Дипломы ВО foreach (var eduDoc in existingClaim.HighEducationDiplomaDocuments) { var newEduDoc = new HighEducationDiplomaDocument { OriginalReceivedDate = eduDoc.OriginalReceivedDate, Series = eduDoc.Series, Number = eduDoc.Number, Date = eduDoc.Date, SubdivisionCode = eduDoc.SubdivisionCode, EducationOrganization = eduDoc.EducationOrganization, FiveCount = eduDoc.FiveCount, FourCount = eduDoc.FourCount, ThreeCount = eduDoc.ThreeCount }; newClaim.HighEducationDiplomaDocuments.Add(newEduDoc); } // Документы // Документы, подтверждающие льготу foreach (var quotaDoc in existingClaim.OrphanDocuments) { var newQuotaDoc = new OrphanDocument { OriginalReceivedDate = quotaDoc.OriginalReceivedDate, OrphanDocumentType = quotaDoc.OrphanDocumentType, Series = quotaDoc.Series, Number = quotaDoc.Number, Date = quotaDoc.Date, Organization = quotaDoc.Organization }; newClaim.OrphanDocuments.Add(newQuotaDoc); } // Другие истребуемые документы var oldOtherRequiredDoc = existingClaim.OtherRequiredDocuments.First(); var newOtherRequiredDoc = new OtherRequiredDocument { Certificate = oldOtherRequiredDoc.Certificate, Photos = oldOtherRequiredDoc.Photos, MedicinePermission = oldOtherRequiredDoc.MedicinePermission, Fluorography = oldOtherRequiredDoc.Fluorography }; newClaim.OtherRequiredDocuments.Add(newOtherRequiredDoc); // Личные данные абитуриента var oldEntrant = existingClaim.Entrants.First(); var newEntrant = new Entrant { LastName = oldEntrant.LastName, FirstName = oldEntrant.FirstName, Patronymic = oldEntrant.Patronymic, Gender = oldEntrant.Gender, CustomInformation = oldEntrant.CustomInformation, Email = oldEntrant.Email, Address = oldEntrant.Address, Phone = oldEntrant.Phone, MobilePhone = oldEntrant.MobilePhone, FatherName = oldEntrant.FatherName, FatherPhone = oldEntrant.FatherPhone, FatherJob = oldEntrant.FatherJob, MotherName = oldEntrant.MotherName, MotherPhone = oldEntrant.MotherPhone, MotherJob = oldEntrant.MotherJob, JobPost = oldEntrant.JobPost, JobOrganization = oldEntrant.JobOrganization, JobStage = oldEntrant.JobStage, ForeignLanguage = oldEntrant.ForeignLanguage }; newClaim.Entrants.Add(newEntrant); // Документ, удостоверяющий личность foreach (var identityDoc in existingClaim.IdentityDocuments) { var newIdentityDoc = new IdentityDocument { OriginalReceivedDate = identityDoc.OriginalReceivedDate, Series = identityDoc.Series, Number = identityDoc.Number, Date = identityDoc.Date, SubdivisionCode = identityDoc.SubdivisionCode, Organization = identityDoc.Organization, Citizenship = identityDoc.Citizenship, IdentityDocumentType = identityDoc.IdentityDocumentType, BirthDate = identityDoc.BirthDate, BirthPlace = identityDoc.BirthPlace }; newClaim.IdentityDocuments.Add(newIdentityDoc); } Session.DataModel.Claims.Add(newClaim); // Открываем редактор нового заявления var vm = new ClaimEditorViewModel(newClaim); var validator = new ClaimValidator(newClaim); if (DialogLayer.ShowEditor(EditingContent.ClaimEditor, vm, validator)) { Session.DataModel.SaveChanges(); // Производим возврат текущего заявления SendClaimToArchive(); // Обновляем список заявлений Session.RefreshAll(); RaisePropertyChanged("ClaimList"); } }