private static DocumentConcept GetDocumentConcept(int docId, string filePath) { DocumentConcept response = null; int connDocos, dbResponse, fqResponse; StringBuilder sConceptCode = new StringBuilder(31); StringBuilder sConceptName = new StringBuilder(61); string key, conceptCode, conceptName; connDocos = AdminPaqLib.dbLogIn("", filePath); if (connDocos == 0) { ErrLogger.Log("Unable to open connection to concepts table from [" + filePath + "]"); return(response); } key = docId.ToString().PadLeft(11); dbResponse = AdminPaqLib.dbGetNoLock(connDocos, TableNames.CONCEPTOS_DOCUMENTOS, IndexNames.PRIMARY_KEY, key); if (dbResponse == 0) { fqResponse = AdminPaqLib.dbFieldChar(connDocos, TableNames.CONCEPTOS_DOCUMENTOS, 2, sConceptCode, 31); conceptCode = sConceptCode.ToString().Substring(0, 30).Trim(); fqResponse = AdminPaqLib.dbFieldChar(connDocos, TableNames.CONCEPTOS_DOCUMENTOS, 3, sConceptName, 61); conceptName = sConceptName.ToString().Substring(0, 60).Trim(); response = new DocumentConcept(); response.Id = docId; response.Code = conceptCode; response.Name = conceptName; } AdminPaqLib.dbLogOut(connDocos); return(response); }
private string GetCompanyCode(int companyId, string filePath) { int connCompany, dbResponse, fqResponse; StringBuilder sbCompanyCode = new StringBuilder(31); string key, result = null; connCompany = AdminPaqLib.dbLogIn("", filePath); if (connCompany == 0) { return(null); } key = companyId.ToString().PadLeft(11); dbResponse = AdminPaqLib.dbGetNoLock(connCompany, "MGW10002", "PRIMARYKEY", key); if (dbResponse == 0) { fqResponse = AdminPaqLib.dbFieldChar(connCompany, "MGW10002", 2, sbCompanyCode, 31); result = sbCompanyCode.ToString().Substring(0, 30).Trim(); } AdminPaqLib.dbLogOut(connCompany); return(result); }
private int AdvanceConnectionIndex(string tipoDoc, string startDate, bool useDocDate, int connection) { int dbResponse; string key; key = tipoDoc; if (useDocDate) { key = tipoDoc + startDate; dbResponse = AdminPaqLib.dbGetNoLock(connection, TableNames.DOCUMENTOS, IndexNames.DOCUMENTOS_ID_DOCUMENTO01, key); if (dbResponse != 0) { key = tipoDoc + startDate.Substring(0, 6); dbResponse = AdminPaqLib.dbGetNoLock(connection, TableNames.DOCUMENTOS, IndexNames.DOCUMENTOS_ID_DOCUMENTO01, key); if (dbResponse != 0) { key = tipoDoc + startDate.Substring(0, 4); dbResponse = AdminPaqLib.dbGetNoLock(connection, TableNames.DOCUMENTOS, IndexNames.DOCUMENTOS_ID_DOCUMENTO01, key); if (dbResponse != 0) { key = tipoDoc; dbResponse = AdminPaqLib.dbGetNoLock(connection, TableNames.DOCUMENTOS, IndexNames.DOCUMENTOS_ID_DOCUMENTO01, key); } } } } else { dbResponse = AdminPaqLib.dbGetNoLock(connection, TableNames.DOCUMENTOS, IndexNames.DOCUMENTOS_ID_DOCUMENTO01, key); } return(dbResponse); }
private static string CurrencyName(int currencyId, string filePath) { int connCurrency, dbResponse, fqResponse; StringBuilder sbCurrencyName = new StringBuilder(61); string key, sCurrencyName = String.Empty; connCurrency = AdminPaqLib.dbLogIn("", filePath); if (connCurrency == 0) { ErrLogger.Log("Unable to open connection for currency table from [" + filePath + "]"); return(null); } key = currencyId.ToString().PadLeft(11); dbResponse = AdminPaqLib.dbGetNoLock(connCurrency, TableNames.MONEDAS, IndexNames.PRIMARY_KEY, key); if (dbResponse == 0) { fqResponse = AdminPaqLib.dbFieldChar(connCurrency, TableNames.MONEDAS, 6, sbCurrencyName, 61); sCurrencyName = sbCurrencyName.ToString().Substring(0, 60).Trim(); } AdminPaqLib.dbLogOut(connCurrency); return(sCurrencyName); }