public TransactionsDownloadService() { module=IntegrationModule.QuickBooks; _userName = CredentialsManager.GetUserName(); _password = CredentialsManager.GetPassword(); _transactionData=new List<QuickBooksOrderDocumentDto>(); }
public ExportImportAudit(IntegrationModule module, DocumentAuditStatus auditStatus, Guid documentId, string docRef, string externalDocRef) { DocumentId = documentId; IntegrationModule = module; AuditStatus = auditStatus; DocumentReference = docRef; ExternalDocumentRef = externalDocRef; }
public InventoryTransferService() { _userName = CredentialsManager.GetUserName(); _password = CredentialsManager.GetPassword(); try { module = CredentialsManager.GetIntegrator(); }catch(Exception) { module=IntegrationModule.Other; } }
public void SaveExportedDocument(Guid documentId, string externalDocumentId, int documentType, IntegrationModule integrationModule) { IntegrationExportedDocument document = new IntegrationExportedDocument() { DocumentId = documentId, ExternalDocumentRef = externalDocumentId, DocumentType = documentType, DateUploaded = DateTime.Now, IntegrationModule = (int) integrationModule }; var existing = GetExportedDocumentById(documentId, integrationModule); if (existing == null) { _ctx.Set<IntegrationExportedDocument>().Add(document); _ctx.SaveChanges(); } }
public List<IntegrationExportedDocument> GetAllExportedDocuments(IntegrationModule integrationModule) { var items = _ctx.Set<IntegrationExportedDocument>().Where(n => n.IntegrationModule == (int)integrationModule).ToList(); return items; }
private async Task<bool> Acknowledge(IEnumerable<string> externalDocrefs,IntegrationModule integrationModule) { return await Task.Run(() => { var res = ObjectFactory.GetInstance<IIntegrationDocumentRepository>(). MarkInventoryDocumentAsImported(externalDocrefs, integrationModule); return res; }); }
public List<string> GetInventoryAcknowledgements(IntegrationModule integrationModule, DateTime date) { return ObjectFactory.GetInstance<IIntegrationDocumentRepository>().GetInventoryAcknowledgements(integrationModule, date); }
private IEnumerable<string> GetExportedPayments(IntegrationModule integrationModule) { return _ctx.tblExportImportAudit.Where(p => p.IntegrationModule == (int) integrationModule && p.DocumentAuditStatus == (int) DocumentAuditStatus.Exported && p.DocumentType == (int)DocumentType.Receipt).Select( n => n.DocumentReference).ToList(); }
public void SetCredentials(string username, string password, IntegrationModule module = IntegrationModule.PZCussons) { CredentialsManager.SetUserName(username); CredentialsManager.SetPassword(password); CredentialsManager.SetIntegrator(module); }
public int GetCount(IntegrationModule integrationModule) { throw new NotImplementedException(); }
private IEnumerable<string> GetExportedExternalDocRefs(IntegrationModule module) { return _ctx.tblExportImportAudit.Where(p => p.DocumentAuditStatus == (int)DocumentAuditStatus.Exported && p.IntegrationModule==(int)module && !string.IsNullOrEmpty(p.ExternalDocumentReference)).Select( n => n.ExternalDocumentReference).Distinct().ToList(); }
private IQueryable<string> GetExportedDocRefsByIntegrationModule(IntegrationModule integrationModule,int time) { var refs = _ctx.tblExportImportAudit.Where(p => p.IntegrationModule == (int)integrationModule && p.DocumentAuditStatus == (int)DocumentAuditStatus.Exported).Select( n => n.DocumentReference); return refs.Distinct().AsQueryable(); }
public static void SetIntegrator(IntegrationModule mod) { module = mod.ToString(); }
public void SetCredentials(string usrname,string passw,IntegrationModule mod) { userName = usrname; password = passw; module = mod.ToString(); }
public IntegrationExportedDocument GetExportedDocumentById(Guid documentId, IntegrationModule integrationModule) { int moduleId = (int) integrationModule; var item = _ctx.Set<IntegrationExportedDocument>().Find(documentId, moduleId); return item; }
public bool IsDocumentExported(Guid documentId, IntegrationModule integrationModule) { return GetExportedDocumentById(documentId, integrationModule) != null; }
public bool MarkInventoryDocumentAsImported(IEnumerable<string> docrefs, IntegrationModule module) { try { var orderRefs = docrefs.Distinct().ToList(); var logRepo = ObjectFactory.GetInstance<IExportImportAuditRepository>(); foreach (var orderRef in orderRefs) { if (logRepo.IsExported(orderRef)) continue; var exported = new ExportImportAudit() { IntegrationModule = module, ExternalDocumentRef = orderRef, DocumentReference = orderRef, DocumentId = Guid.NewGuid(), DocumentType = DocumentType.InventoryTransferNote,//GO=> TODo:receipt/invoices..? not an issue=>we track with ref AuditStatus = DocumentAuditStatus.Imported }; logRepo.Save(exported); } return true; } catch (Exception ex) { return false; } }
public TransactionsDownloadService() { _userName = CredentialsManager.GetUserName(); _password = CredentialsManager.GetPassword(); module = CredentialsManager.GetIntegrator(); }
public List<string> GetInventoryAcknowledgements(IntegrationModule module, DateTime date) { var query =string.Format(@"select * from tblExportImportAudit audit WHERE (convert(Date,audit.DateUploaded, 103) =convert(Date, {0}, 103)) AND (audit.DocumentType=4 OR audit.DocumentType=9) AND (audit.IntegrationModule={1}) order by audit.ExternalDocumentReference",date,module); var dat = date.Date; return _ctx.ExecuteStoreQuery<tblExportImportAudit>(query).Select(n => n.ExternalDocumentReference).Distinct(). ToList(); /* tblExportImportAudit.Where(p => p.DocumentAuditStatus == (int)DocumentAuditStatus.Imported && (p.DocumentType == (int)DocumentType.InventoryTransferNote || p.DocumentType == (int)DocumentType.InventoryAdjustmentNote) && p.IntegrationModule == (int)module && !string.IsNullOrEmpty(p.ExternalDocumentReference)).OrderByDescending(p => p.DateUploaded) .Where(p => p.DateUploaded.HasValue && p.DateUploaded.Value.Date == dat) .Select( n => n.ExternalDocumentReference).Distinct().ToList(); * */ }