Esempio n. 1
0
        public SignInStatus Login(string server, string user, string password)
        {
            try
            {
                var session_settings = new SessionSettings();
                var host_settings    = new HostSettings(new HostEndpoint(server));
                var auth_settings    = new ICAuthSettings(user, password);

                ICSession = new Session();
                session_settings.ApplicationName = "DialerNetAPIDemo";

                ICSession.ConnectionStateChanged += ICSession_ConnectionStateChanged;
                ICSession.Connect(session_settings, host_settings, auth_settings, new StationlessSettings());

                DialerConfiguration = new DialerConfigurationManager(ICSession);

                InitializeCampaigns(ICSession);
                InitializeWorkgroups(ICSession);
                InitializeContactLists(ICSession);
                InitializePolicySets(ICSession);
                return(SignInStatus.Success);
            }
            catch (ININ.IceLib.Connection.RequestTimeoutException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Timeout while connecting", e);
            }
            catch (ININ.IceLib.Connection.SessionDisconnectedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch (ININ.IceLib.IceLibLicenseException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Cannot connect, missing license", e);
            }
            catch (ININ.IceLib.IceLibException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch (System.ObjectDisposedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect, session was disposed", e);
            }
            catch (Exception e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unknown error while connecting", e);
            }
            return(SignInStatus.Failure);
        }
Esempio n. 2
0
        public int ScheduleCall(string column, string key, Campaign campaign, string agent_id, string site_id, DateTime when)
        {
            var dialer_configuration = new DialerConfigurationManager(Application.ICSession);
            var select = new SelectCommand(configuration);

            select.Where = new BinaryExpression(new ColumnExpression(configuration.ColumnMap[column]), new ConstantExpression(key, configuration.ColumnMap[column]), BinaryOperationType.Equal);
            Collection <Dictionary <string, object> > contacts = configuration.GetContacts(dialer_configuration.GetHttpRequestKey(configuration.ConfigurationId), select);

            var calls = new List <ScheduledCall>();

            foreach (var ic_contact in contacts)
            {
                calls.Add(new ScheduledCall(ic_contact[ContactListConfiguration.I3_Identity.Name].ToString(), campaign.id, "", agent_id, site_id, when));
            }
            return(configuration.AddScheduledCalls(calls));
        }
Esempio n. 3
0
        public int import_contacts(string filename)
        {
            var dialer_configuration = new DialerConfigurationManager(Application.ICSession);
            var data    = new CSVDataSet(filename);
            var fields  = data.Fields;
            var columns = configuration.GetColumns();
            var mapping = new Dictionary <DBColumn, DBColumn>();

            foreach (var field in fields)
            {
                var column = fields.First(item => string.Compare(item.Name, field.Name) == 0);

                if (column != null)
                {
                    mapping.Add(field, column);
                }
            }
            if (mapping.Keys.Count <= 0)
            {
                throw new ArgumentException(string.Format("No mapping available between Contact List {0} and CSV filename {1}", DisplayName, filename), filename);
            }

            return(configuration.BulkImport(dialer_configuration.GetHttpRequestKey(configuration.ConfigurationId), data, mapping));
        }
Esempio n. 4
0
        public SignInStatus Login(string server, string user, string password)
        {
            try
            {
                var session_settings = new SessionSettings();
                var host_settings = new HostSettings(new HostEndpoint(server));
                var auth_settings = new ICAuthSettings(user, password);

                ICSession = new Session();
                session_settings.ApplicationName = "DialerNetAPIDemo";

                ICSession.ConnectionStateChanged += ICSession_ConnectionStateChanged;
                ICSession.Connect(session_settings, host_settings, auth_settings, new StationlessSettings());

                DialerConfiguration = new DialerConfigurationManager(ICSession);

                InitializeCampaigns(ICSession);
                InitializeWorkgroups(ICSession);
                InitializeContactLists(ICSession);
                InitializePolicySets(ICSession);
                return SignInStatus.Success;
            }
            catch(ININ.IceLib.Connection.RequestTimeoutException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Timeout while connecting", e);
            }
            catch(ININ.IceLib.Connection.SessionDisconnectedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch(ININ.IceLib.IceLibLicenseException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Cannot connect, missing license", e);

            }
            catch(ININ.IceLib.IceLibException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch(System.ObjectDisposedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect, session was disposed", e);
            }
            catch (Exception e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unknown error while connecting", e);
            }
            return SignInStatus.Failure;
        }
Esempio n. 5
0
        public int ScheduleCall(string column, string key, Campaign campaign, string agent_id, string site_id, DateTime when)
        {
            var dialer_configuration = new DialerConfigurationManager(Application.ICSession);
            var select = new SelectCommand(configuration);

            select.Where = new BinaryExpression(new ColumnExpression(configuration.ColumnMap[column]), new ConstantExpression(key, configuration.ColumnMap[column]), BinaryOperationType.Equal);
            Collection<Dictionary<string, object>> contacts = configuration.GetContacts(dialer_configuration.GetHttpRequestKey(configuration.ConfigurationId), select);

            var calls = new List<ScheduledCall>();

            foreach(var ic_contact in contacts)
            {
                calls.Add(new ScheduledCall(ic_contact[ContactListConfiguration.I3_Identity.Name].ToString(), campaign.id, "", agent_id, site_id, when));
            }
            return configuration.AddScheduledCalls(calls);
        }
Esempio n. 6
0
        public int import_contacts(string filename)
        {
            var dialer_configuration = new DialerConfigurationManager(Application.ICSession);
            var data    = new CSVDataSet(filename);
            var fields  = data.Fields;
            var columns = configuration.GetColumns();
            var mapping = new Dictionary<DBColumn, DBColumn>();

            foreach(var field in fields)
            {
                var column = fields.First(item => string.Compare(item.Name, field.Name) == 0);

                if (column != null)
                {
                    mapping.Add(field, column);
                }
            }
            if (mapping.Keys.Count <= 0) throw new ArgumentException(string.Format("No mapping available between Contact List {0} and CSV filename {1}", DisplayName, filename), filename);

            return configuration.BulkImport(dialer_configuration.GetHttpRequestKey(configuration.ConfigurationId), data, mapping);
        }