Beispiel #1
0
        public void SaveAgentStates(List <AgentState> states)
        {
            try
            {
                Logger.Logger.Log.Debug(string.Format("Saving AgentStates:{0}", states.Count()));
                string id = "";
                IEnumerable <AgentState> lis = states.Where(p => p.ID > 0);
                foreach (AgentState st in lis)
                {
                    id += st.ID + ",";
                }
                if (id != "")
                {
                    List <AgentState> del = _rightNowObjectProvider.GetObjects <AgentState>(string.Format(" where Id not in ({0})", id.Substring(0, id.Length - 1))).ToList();
                    if (del != null && del.Count > 0)
                    {
                        _rightNowObjectProvider.DeleteObjects(del);
                    }
                }

                List <AgentState> instate = states.Where(x => x.ID < 0).ToList();
                if (instate.Count() > 0)
                {
                    _rightNowObjectProvider.CreateObjects(instate);
                }

                instate = states.Where(x => x.ID > 0).ToList();
                if (instate.Count() > 0)
                {
                    _rightNowObjectProvider.UpdateObjects(instate);
                }
                Logger.Logger.Log.Info(string.Format("Saved successfully:{0}", states.Count()));
            }
            catch (Exception ex)
            {
                Logger.Logger.Log.Error("Stack Trace:" + ex.StackTrace);
                Logger.Logger.Log.Error("Save agent states failed, Exception:", ex);
            }
        }
Beispiel #2
0
        public IEnumerable <AgentState> GetAgentStates()
        {
            Logger.Logger.Log.Debug("RightNowConnectConfigurationProvider Loading Standard AgentStates");
            // Get configured states
            var states = new List <AgentState>();

            try
            {
                var customstates = new List <AgentState>(_objectProvider.GetObjects <AgentState>());

                HideorDisabled = customstates.FirstOrDefault(p => p.DefaultName == "Buttons").Name.Equals("true", StringComparison.OrdinalIgnoreCase) ? true : false;
                //// Add standard states
                foreach (AgentState st in customstates)
                {
                    switch (st.DefaultName)
                    {
                    case "Available":
                        StandardAgentStates.Available.Description = st.Description;
                        StandardAgentStates.Available.Name        = st.Name;
                        break;

                    case "Wrap Up":
                        StandardAgentStates.WrapUp.Description = st.Description;
                        StandardAgentStates.WrapUp.Name        = st.Name;
                        break;

                    case "Not Ready":
                        StandardAgentStates.NotReady.Description = st.Description;
                        StandardAgentStates.NotReady.Name        = st.Name;
                        break;

                    case "New Reason":
                        StandardAgentStates.NewReason.Description = st.Description;
                        StandardAgentStates.NewReason.Name        = st.Name;
                        break;

                    case "Logged In":
                        StandardAgentStates.LoggedIn.Description = st.Description;
                        StandardAgentStates.LoggedIn.Name        = st.Name;
                        break;

                    case "Logged Out":
                        StandardAgentStates.LoggedOut.Description = st.Description;
                        StandardAgentStates.LoggedOut.Name        = st.Name;
                        break;

                    case "Handling Interaction":
                        StandardAgentStates.InCall.Description = st.Description;
                        StandardAgentStates.InCall.Name        = st.Name;
                        break;
                    }
                }

                states.Add(new AgentState().NewAgentState(StandardAgentStates.Available));
                states.Add(new AgentState().NewAgentState(StandardAgentStates.WrapUp));
                states.Add(new AgentState().NewAgentState(StandardAgentStates.NotReady));

                states.Add(new AgentState().NewAgentState(StandardAgentStates.NewReason));

                states.Add(new AgentState().NewAgentState(StandardAgentStates.LoggedIn));

                states.Add(new AgentState().NewAgentState(StandardAgentStates.LoggedOut));

                states.Add(new AgentState().NewAgentState(StandardAgentStates.InCall));
                states.Add(new AgentState().NewAgentState(StandardAgentStates.Calling));
                states.Add(new AgentState().NewAgentState(StandardAgentStates.Unknown));
            }
            catch (Exception ex)
            {
                Logger.Logger.Log.Error("RightNowConnectConfigurationProvider Trace Error:" + ex.StackTrace);
                Logger.Logger.Log.Error("RightNowConnectConfigurationProvider :", ex);
            }
            return(states);
        }
        public void Load()
        {
            var objectProvider = new RightNowObjectProvider(Context);

            objectProvider.GetObjects <RightNow.Cti.Model.AgentState>();
        }