Beispiel #1
0
        protected int initEntryData(OdbcConnection od)
        {
            int r = 0;

            try
            {
                OdbcDataReader odr;
                OdbcCommand    oc;
                string         sdbval;
                m_DirMLGuid = null;
                sdbval      = m_cfg.GetParameter("BCM_Dir_Attribute", "Lync");
                string sq = "SELECT TOP 1 DirectoryMasterListGUID FROM DirectoryMasterListAttr WHERE Value='" + sdbval + "'";
                oc  = new OdbcCommand(sq, od);
                odr = oc.ExecuteReader();
                while (odr.Read())
                {
                    m_DirMLGuid = Convert.ToString(odr.GetValue(0));
                }
                odr.Close();
            }
            catch (Exception e)
            {
                m_log.Log("Exception in AddUpdate:" + e);
                r = -1;
            }
            return(r);
        }
Beispiel #2
0
        ////////////////////////////////////////////////////////
        // Startup
        public bool Start(string sServerAddress, string sUserName, string sUserPassword)
        {
            m_PSI     = new PSI();
            m_sPSIUrl = sServerAddress;
            m_PSI.Url = m_sPSIUrl;

            m_sPSIUser = sUserName;
            m_sPSIPass = sUserPassword;

            m_log.Log("BcmControl.Start PSIUrl=" + m_sPSIUrl);

            if (Util.IsNullOrEmpty(m_sPSIUser) || Util.IsNullOrEmpty(m_sPSIPass))
            {
                m_log.Log("Using empty credentials for PSI (no user/password set)");
            }
            else
            {
                m_log.Log("Using credentials for PSI " + m_sPSIUser + "," + m_sPSIPass);
                m_CCache = new System.Net.CredentialCache();
                m_CCache.Add(new System.Uri(m_sPSIUrl), "Basic", new System.Net.NetworkCredential(m_sPSIUser, m_sPSIPass));
                m_PSI.Credentials = m_CCache;
            }

            try
            {
                CreateSessionResult r;
                string stmp;

                r = m_PSI.CreateSession();

                m_PSI_Session = r.SessionID;
                m_log.Log("Created PSI session " + m_PSI_Session);


                if (GetProfileConfig() == false)
                {
                    m_log.Log("Cannot get profile configuration, ending...");
                    return(false);
                }
                if (GetUserConfig() == false)
                {
                    m_log.Log("Cannot get user configuration, ending...");
                    return(false);
                }

                m_EvtFlags = EventFlags.All;
                string stype = m_CFG.GetParameter("EventFlags", "All");
                if (stype == "Call_and_Login")
                {
                    m_EvtFlags = EventFlags.Call_and_Login;
                }
                if (stype == "Call")
                {
                    m_EvtFlags = EventFlags.Call;
                }
                if (stype == "Call_and_Service")
                {
                    m_EvtFlags = EventFlags.Call_and_Service;
                }
                if (stype == "Login")
                {
                    m_EvtFlags = EventFlags.Login;
                }
                if (stype == "Login_and_Service")
                {
                    m_EvtFlags = EventFlags.Login_and_Service;
                }

                stmp = m_CFG.GetParameter("BCM_LyncStateAsEntry", "0");
                if (stmp == "1")
                {
                    stmp = m_CFG.GetParameter("BCM_DB_Directory", "none");
                    if (stmp.Length > 0 && stmp != "none")
                    {
                        m_BcmDB = new Bcm_DB();
                        m_BcmDB.init(m_CFG, m_log, stmp);
                        m_use_dir_entry = 1;
                    }
                }
            }
            catch (Exception x)
            {
                m_log.Log("Error in Bcm_Control start - cannot create session for PSI (" + x + ")");
                return(false);
            }
            return(true);
        }