CandyWrapper.CandyWrapper.doGetEntryList C# (CSharp) Method

doGetEntryList() public method

public doGetEntryList ( string sSession, string sModule, string sQuery, string sOrder, int iOffset, string sFields, int iLimit, int iDel ) : ].string[
sSession string
sModule string
sQuery string
sOrder string
iOffset int
sFields string
iLimit int
iDel int
return ].string[
        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;
        }