CandyWrapper.CandyWrapper.doSetEntry C# (CSharp) Method

doSetEntry() public method

public doSetEntry ( string sSession, string sModule, string saNames, string saValues ) : string
sSession string
sModule string
saNames string
saValues string
return string
        public string doSetEntry(string sSession, string sModule, string[] saNames, string[] saValues)
        {
            int iNVLength = saNames.Length;
            int iCounter = 0;
            string sResults = string.Empty;
            sModule = this.doConvertToProper(sModule);

            //Convert array to Sugar NV pairing
            SugarCRM.name_value[] oSugarNVList = new SugarCRM.name_value[iNVLength];

            while (iCounter < iNVLength)
            {
                oSugarNVList[iCounter] = new SugarCRM.name_value();
                oSugarNVList[iCounter].name = saNames[iCounter];
                oSugarNVList[iCounter].value = saValues[iCounter];
                iCounter++;
            }

            SugarCRM.set_entry_result oSugarSetEntryRes = null;

            try
            {
                oSugarSetEntryRes = oSugarCRM.set_entry(sSession, sModule, oSugarNVList);
            }
            catch (Exception ex)
            {
                sResults = "doSetEntry Error: " + ex.Message;
                return sResults;
            }

            SugarCRM.error_value oSugarErrVal = oSugarSetEntryRes.error;

            if (oSugarErrVal.number != "0")
            {
                sResults = "Error Creating Record: " + oSugarErrVal.number + "\r\n" + oSugarErrVal.description;
            }
            else
            {
                sResults = oSugarSetEntryRes.id;
            }

            return sResults;
        }