public string[,] doSearchByModule(string sUser, string sPass, string sValue, string[] saModules, int iOffset, int iLimit) { SugarCRM.get_entry_list_result oSugarGetEntryListRes = oSugarCRM.search_by_module(sUser, sPass, sValue, saModules, iOffset, iLimit); SugarCRM.entry_value[] oSugarEntryVals = oSugarGetEntryListRes.entry_list; string[,] saResults = new string[oSugarEntryVals.Length, 2]; Console.WriteLine("ALF: " + oSugarEntryVals.LongLength); foreach (SugarCRM.entry_value oSugarEntryVal in oSugarEntryVals) { SugarCRM.name_value[] oSugarNameVals = oSugarEntryVal.name_value_list; Console.WriteLine("NVLen:" + oSugarNameVals.Length); int iCounter = 0; foreach (SugarCRM.name_value oSugarNameVal in oSugarNameVals) { //saResults[iCounter, 0] = oSugarNameVal.name; //saResults[iCounter, 1] = oSugarNameVal.value; Console.WriteLine(oSugarNameVal.name); Console.WriteLine(oSugarNameVal.value); Console.WriteLine(oSugarEntryVal.module_name); iCounter++; } } return(saResults); }
public string[,] doGetEntryList(string sSession, string sModule, string sQuery, string sOrder, int iOffset, string[] sFields, int iLimit, int iDel) { sModule = this.doConvertToProper(sModule); string[,] sResults = null; try { SugarCRM.get_entry_list_result oSugarGetListRes = oSugarCRM.get_entry_list(sSession, sModule, sQuery, sOrder, iOffset, sFields, iLimit, iDel); SugarCRM.error_value oSugarErrVal = oSugarGetListRes.error; if (oSugarErrVal.number != "0") { string[,] saErrResults = new string[1, 1]; saErrResults[0, 0] = oSugarErrVal.number; saErrResults[0, 1] = oSugarErrVal.description; return(saErrResults); } SugarCRM.entry_value[] oSugarListVals = oSugarGetListRes.entry_list; int iRows = oSugarGetListRes.result_count; int iColumns = sFields.Length + 1; //Additional column added to accommodate ID value sResults = new string[iRows, iColumns]; //Iterate through each row to process results int iRecords = 0; foreach (SugarCRM.entry_value oSugarEntryVal in oSugarListVals) { int iCounter = 1; SugarCRM.name_value[] oSugarNV = oSugarEntryVal.name_value_list; //First column on each row is always the ID value sResults[iRecords, 0] = oSugarEntryVal.id; //Iterate through the rest of the columns before moving to next record foreach (SugarCRM.name_value oSugarVal in oSugarNV) { sResults[iRecords, iCounter] = oSugarVal.value; iCounter++; } iRecords++; } } catch (Exception ex) { sResults = new string[1, 1]; sResults[0, 0] = "0"; } return(sResults); }