Exemple #1
0
        public string doLogin(string sUser, string sPass, string sVersion, string sAppName)
        {
            SugarCRM.user_auth        oSugarUserAuth    = new SugarCRM.user_auth();
            SugarCRM.set_entry_result oSugarSetEntryRes = new SugarCRM.set_entry_result();
            string sPassHash = this.getMD5Hash(sPass);
            string sResult   = string.Empty;

            oSugarUserAuth.user_name = sUser;
            oSugarUserAuth.password  = sPassHash;
            oSugarUserAuth.version   = sVersion;

            try
            {
                oSugarSetEntryRes = oSugarCRM.login(oSugarUserAuth, sAppName);
                //Check if error occurred
                sResult = oSugarSetEntryRes.id;
                if (oSugarSetEntryRes.error.number != "0")
                {
                    sResult = oSugarSetEntryRes.error.number;
                }
            }
            catch (Exception ex)
            {
                sResult = "05";
            }

            return(sResult);
        }
Exemple #2
0
 public void doSetNoteAttachment(string sSession, string sFilePathName, string sFileName, string sID)
 {
     SugarCRM.note_attachment oSugarNoteAttachment = new SugarCRM.note_attachment();
     oSugarNoteAttachment.file     = sFilePathName;
     oSugarNoteAttachment.filename = sFileName;
     oSugarNoteAttachment.id       = sID;
     SugarCRM.set_entry_result oSugarSetEntryResult = oSugarCRM.set_note_attachment(sSession, oSugarNoteAttachment);
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        public string doLogin(string sUser, string sPass, string sVersion, string sAppName)
        {
            SugarCRM.user_auth oSugarUserAuth = new SugarCRM.user_auth();
            SugarCRM.set_entry_result oSugarSetEntryRes = new SugarCRM.set_entry_result();
            string sPassHash = this.getMD5Hash(sPass);
            string sResult = string.Empty;

            oSugarUserAuth.user_name = sUser;
            oSugarUserAuth.password = sPassHash;
            oSugarUserAuth.version = sVersion;

            try
            {
                oSugarSetEntryRes = oSugarCRM.login(oSugarUserAuth, sAppName);
                //Check if error occurred
                sResult = oSugarSetEntryRes.id;
                if (oSugarSetEntryRes.error.number != "0")
                {
                    sResult = oSugarSetEntryRes.error.number;
                }
            }
            catch (Exception ex)
            {
                sResult = "05";
            }

            return sResult;
        }