public SignatureLibraryApp(string personId, PersonInformationApp personInformation) { PersonId = personId ?? throw new ArgumentNullException(nameof(personId)); PersonInformation = personInformation; }
/// <summary> /// Найти подпись по информации о пользователе /// </summary> public ISignatureLibraryApp FindByPersonInformation(PersonInformationApp personInformation) => PersonsInformation.IndexOf(personInformation). WhereContinue(foundIndex => foundIndex > -1, okFunc: foundIndex => _signaturesLibrary.Values[foundIndex], badFunc: foundIndex => null);
/// <summary> /// Найти подпись по информации о пользователе или получить случайную /// </summary> public IResultAppValue <ISignatureLibraryApp> FindByPersonInformationOrRandom(PersonInformationApp personInformation) => new ResultAppValue <ISignatureLibraryApp>(FindByPersonInformation(personInformation), new ErrorApplication(ErrorApplicationType.SignatureNotFound, $"Подпись по имени {personInformation.FullName} не найдена")). ResultValueBadBind(_ => new ResultAppValue <ISignatureLibraryApp>(GetRandomSignature(), new ErrorApplication(ErrorApplicationType.SignatureNotFound, "База подписей пуста")));
/// <summary> /// Найти подпись по идентификатору или информации о пользователе или получить случайную /// </summary> public IResultAppValue <ISignatureLibraryApp> FindByIdOrPersonInformationOrRandom(string id, PersonInformationApp personInformation) => new ResultAppValue <ISignatureLibraryApp>(FindById(id), new ErrorApplication(ErrorApplicationType.SignatureNotFound, $"Подпись по идентификатору {id} не найдена")). ResultValueBadBind(_ => FindByPersonInformationOrRandom(personInformation));
public SignatureFileApp(string personId, PersonInformationApp personInformation, string signatureFilePath, bool isVerticalImage) : base(personId, personInformation) { SignatureFilePath = signatureFilePath ?? throw new ArgumentNullException(nameof(signatureFilePath)); IsVerticalImage = isVerticalImage; }