示例#1
0
        public InteractionCredentials ReSetCredentials(string AgentID = "", string password = "", string location = "", string queue = "0", string AgentName = "Guest")
        {
            // This is a simple implementation of the credentials provider.
            // Here, we're using the current user credentials but credentials could
            // come from any source, custom fields, objects or a UI prompt.
            var objectProvider            = new RightNowObjectProvider(_context);
            StaffAccountInfo staffAccount = new StaffAccountInfo();

            staffAccount.Name = AgentName;

            staffAccount.AgentID   = IntTryPrase(AgentID);
            staffAccount.Password  = password;
            staffAccount.Extension = IntTryPrase(location);
            staffAccount.Queue     = IntTryPrase(queue);
            objectProvider.UpdateStaffAccountInformation(staffAccount);


            return(new InteractionCredentials
            {
                AgentCredentials = new SwitchCredentials
                {
                    Id = staffAccount.AgentID.ToString(),
                    Name = staffAccount.Name,
                    Password = staffAccount.Password,
                    AgentID = staffAccount.AgentID,
                    Extension = staffAccount.Extension,
                    Queue = staffAccount.Queue
                },
                LocationInfo = new LocationInfo
                {
                    ComputerName = location,
                    DeviceAddress = location
                }
            });
        }
示例#2
0
        public InteractionCredentials GetCredentials()
        {
            // This is a simple implementation of the credentials provider.
            // Here, we're using the current user credentials but credentials could
            // come from any source, custom fields, objects or a UI prompt.
            var objectProvider            = new RightNowObjectProvider(_context);
            StaffAccountInfo staffAccount = objectProvider.GetStaffAccountInformation(_context.AccountId);

            return(new InteractionCredentials {
                AgentCredentials = new SwitchCredentials {
                    Id = _context.AccountId.ToString(),
                    Name = staffAccount.Name,
                    Password = staffAccount.Password,
                    AgentID = staffAccount.AgentID,
                    Extension = staffAccount.Extension,
                    Queue = staffAccount.Queue
                },
                LocationInfo = new LocationInfo {
                    ComputerName = staffAccount.Extension.ToString(),
                    DeviceAddress = staffAccount.Extension.ToString()
                }

                //LocationInfo = new LocationInfo {
                //    ComputerName = Environment.MachineName,
                //    DeviceAddress = string.Format("{0}{1}{2}", _context.InterfaceId, _context.ProfileId, _context.AccountId)
                //}
            });
        }
        internal StaffAccountInfo GetStaffAccountInformation(int id)
        {
            var request = new QueryCSVRequest(getClientInfoHeader(),
                                              string.Format(@"SELECT DisplayName, CustomFields.Oracle_Cti.acd_id, CustomFields.Oracle_Cti.acd_password, CustomFields.c.AgentID, CustomFields.c.Password, CustomFields.c.Extension,CustomFields.c.Queue FROM Account WHERE id= {0}", id), 1, ",", false, true);

            var rightNowChannel = getChannel();

            var result = rightNowChannel.QueryCSV(request);

            var staffAccount = new StaffAccountInfo();

            if (result.CSVTableSet != null && result.CSVTableSet.CSVTables.Length > 0 && result.CSVTableSet.CSVTables[0].Rows.Length > 0)
            {
                var resultRow = result.CSVTableSet.CSVTables[0].Rows[0].Split(',');
                staffAccount.Name        = resultRow[0];
                staffAccount.AcdId       = resultRow[1];
                staffAccount.AcdPassword = resultRow[1];
                int val;
                int.TryParse(resultRow[3], out val);
                staffAccount.AgentID  = val;
                staffAccount.Password = resultRow[4];
                int.TryParse(resultRow[5], out val);
                staffAccount.Extension = val;
                int.TryParse(resultRow[6], out val);
                staffAccount.Queue = val;
            }

            return(staffAccount);
        }
        internal void UpdateStaffAccountInformation(StaffAccountInfo staffActInfo)
        {
            try
            {
                Logger.Logger.Log.Debug("RightNowObjectProvider: Get User Account Details");
                Account acobj = new Account();
                acobj.ID = new ID()
                {
                    id = Global.Context.AccountId, idSpecified = true
                };
                GenericObject genericObject      = new GenericObject();
                GenericObject genericObjectFinal = new GenericObject();

                RNObjectType rnobj = new RNObjectType();

                List <GenericField> genericFields = new List <GenericField>();
                List <GenericField> genericField  = new List <GenericField>();
                //Convert.ToInt64(AgentID))
                staffActInfo.Password = string.IsNullOrEmpty(staffActInfo.Password) ? " " : staffActInfo.Password;
                genericFields.Add(createGenericField("AgentID", ItemsChoiceType.StringValue, staffActInfo.AgentID.ToString()));
                genericFields.Add(createGenericField("password", ItemsChoiceType.StringValue, staffActInfo.Password));
                genericFields.Add(createGenericField("Extension", ItemsChoiceType.StringValue, staffActInfo.Extension.ToString()));
                genericFields.Add(createGenericField("Queue", ItemsChoiceType.IntegerValue, staffActInfo.Queue));

                genericObject.GenericFields = genericFields.ToArray();
                rnobj.TypeName           = "AccountCustomFields";
                genericObject.ObjectType = rnobj;

                genericField.Add(createGenericField("c", ItemsChoiceType.ObjectValue, genericObject));
                genericObjectFinal.GenericFields = genericField.ToArray();
                genericObjectFinal.ObjectType    = new RNObjectType()
                {
                    TypeName = "AccountCustomFieldsc"
                };
                acobj.CustomFields = genericObjectFinal;

                UpdateProcessingOptions cpo = new UpdateProcessingOptions();
                cpo.SuppressExternalEvents = false;
                cpo.SuppressRules          = false;
                UpdateRequest  cre = new UpdateRequest(getClientInfoHeader(), new RNObject[] { acobj }, cpo);
                UpdateResponse res = getChannel().Update(cre);
            }
            catch (Exception ex)
            {
                Logger.Logger.Log.Error("RightNowObjectProvider:", ex);
            }
        }
示例#5
0
 public void SetCredentials(string AgentID, string password, string location, string AgentName = "Guest")
 {
     var objectProvider            = new RightNowObjectProvider(_context);
     StaffAccountInfo staffAccount = new StaffAccountInfo();
 }