コード例 #1
0
        public void GetAllStaffGroups()
        {
            StaffGroupCollection staffGroups = TestSetup.KayakoApiService.Staff.GetStaffGroups();

            Assert.IsNotNull(staffGroups, "No staff groups were returned");
            Assert.IsNotEmpty(staffGroups, "No staff groups were returned");
        }
コード例 #2
0
        /// <summary>
        /// Retrieve a staff group identified by <paramref name="groupId"/>.
        /// </summary>
        /// <param name="groupId">The numeric identifier of the staff group.</param>
        /// <returns>The staff group</returns>
        public StaffGroup GetStaffGroup(int groupId)
        {
            string apiMethod = String.Format("/Base/StaffGroup/{0}/", groupId);

            StaffGroupCollection grps = Connector.ExecuteGet <StaffGroupCollection>(apiMethod);

            if (grps != null && grps.Count > 0)
            {
                return(grps[0]);
            }

            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Update the staff group identified by its internal identifer
        /// </summary>
        /// <param name="staffGroup">Data representing the staff group to update. Staff Group Id and Title must be supplied</param>
        /// <returns></returns>
        public StaffGroup UpdateStaffGroup(StaffGroupRequest staffGroup)
        {
            string apiMethod = String.Format("/Base/StaffGroup/{0}", staffGroup.Id);

            RequestBodyBuilder parameters = PopulateRequestParameters(staffGroup, RequestTypes.Update);

            StaffGroupCollection staffGroups = Connector.ExecutePut <StaffGroupCollection>(apiMethod, parameters.ToString());

            if (staffGroups != null && staffGroups.Count > 0)
            {
                return(staffGroups[0]);
            }

            return(null);
        }
コード例 #4
0
        public void GetStaffGroup()
        {
            StaffGroupCollection staffGroups = TestSetup.KayakoApiService.Staff.GetStaffGroups();

            Assert.IsNotNull(staffGroups, "No staff groups were returned");
            Assert.IsNotEmpty(staffGroups, "No staff groups were returned");

            StaffGroup staffGroupToGet = staffGroups[new Random().Next(staffGroups.Count)];

            Trace.WriteLine("GetStaffGroup using staff group id: " + staffGroupToGet.Id);

            StaffGroup staffGroup = TestSetup.KayakoApiService.Staff.GetStaffGroup(staffGroupToGet.Id);

            CompareStaffGroups(staffGroup, staffGroupToGet);
        }
コード例 #5
0
ファイル: StaffGroup.cs プロジェクト: paulusyeung/RT2020
        /// <summary>
        /// Loads a collection of StaffGroup objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the StaffGroup objects in the database.</returns>
        public static StaffGroupCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            StaffGroupCollection result = new StaffGroupCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    StaffGroup tmp = new StaffGroup();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }
コード例 #6
0
        public void CreateUpdateDeleteStaffUser()
        {
            StaffUser dummyStaffUser = TestData;

            StaffUserRequest req = StaffUserRequest.FromResponseData(dummyStaffUser);

            req.Password = "******";

            StaffUser createdStaffUser = TestSetup.KayakoApiService.Staff.CreateStaffUser(req);

            Assert.IsNotNull(createdStaffUser);
            dummyStaffUser.Id = createdStaffUser.Id;
            CompareStaffUsers(dummyStaffUser, createdStaffUser);

            dummyStaffUser.Designation = "Mrs";
            dummyStaffUser.Email       = "*****@*****.**";
            dummyStaffUser.EnableDst   = false;
            dummyStaffUser.FirstName   = "UpdatedFirstName";
            dummyStaffUser.Greeting    = "UpdatedGreetingtext";
            StaffGroupCollection staffGroups = TestSetup.KayakoApiService.Staff.GetStaffGroups();

            dummyStaffUser.GroupId      = staffGroups[staffGroups.Count - 1].Id;
            dummyStaffUser.IsEnabled    = false;
            dummyStaffUser.LastName     = "UpdatedLastName";
            dummyStaffUser.MobileNumber = "0798765432";
            //Can't test signature as it doesn't come back from the Api
            //dummyStaffUser.Signature = "Signature Updated";
            dummyStaffUser.TimeZone = "GMT BST";
            dummyStaffUser.UserName = "******";

            StaffUser updatedStaffUser = TestSetup.KayakoApiService.Staff.UpdateStaffUser(StaffUserRequest.FromResponseData(dummyStaffUser));

            dummyStaffUser.FullName = String.Format("{0} {1}", dummyStaffUser.FirstName, dummyStaffUser.LastName);

            Assert.IsNotNull(updatedStaffUser);
            CompareStaffUsers(dummyStaffUser, updatedStaffUser);

            bool success = TestSetup.KayakoApiService.Staff.DeleteStaffUser(updatedStaffUser.Id);

            Assert.IsTrue(success);
        }