internal static Guid?GetDocumentByChiave(string tipoDocumento, string idCliente, string chiave, out CodiceErrore errore) { DocumentKey documentKey; errore = CodiceErrore.NessunErrore; using (var db = new BiblosDS2010APIEntities()) { documentKey = db.DocumentKeys.Where(x => x.IdCustomer == idCliente && x.DocumentClass == tipoDocumento && x.Code == chiave).SingleOrDefault(); } if (documentKey == null) { return(null); } if (documentKey.IdCustomer != idCliente) { errore = CodiceErrore.DocumentoNonDelCliente; } //Ritorna il documento legato al customer/document class return(documentKey == null ? null : documentKey.IdDocument); }
internal static Guid?GetDocumentByChiave(RequestBase request, string chiave, out CodiceErrore errore) { return(GetDocumentByChiave(request.TipoDocumento, request.IdCliente, chiave, out errore)); }