using Soneta.Business; using Soneta.Core; using Soneta.Kasa; using Soneta.Types; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FX2_SP_VERIFIERS.IstniejacyDokument { internal class CzyPodmiotNumerDubleVerifier : RowVerifier { public CzyPodmiotNumerDubleVerifier(IRow row) : base(row) { } public override string Description => "Dokument o podanym numerze oraz podmiocie już istnieje"; public override VerifierType Type => VerifierType.Error; private new DokEwidencji Row => (DokEwidencji)base.Row; protected override bool IsValid() { try { if (Row.Dokument is null && Row.Podmiot is not null && Row.NumerDokumentu.Trim() != "") { DokEwidencji dok = CoreModule.GetInstance(Row.Session).DokEwidencja.WgNumeruDokumentu[Row.NumerDokumentu].FirstOrDefault(x => x.Podmiot == Row.Podmiot); if(dok is not null && dok != Row) return false; } } catch {} return true; } } }