示例#1
0
        /// <summary>
        /// Retreives a list of staff
        /// </summary>
        private IEnumerable <Staff> SendRequestStaff()
        {
            GetStaffDataMessage msg = new GetStaffDataMessage(0);

            msg.Send();

            if (msg.ReturnCode != ServerReturnCode.Success)
            {
                throw new SessionSummaryException(ServerErrorTranslator.GetReturnCodeMessage(msg.ReturnCode));
            }

            if (msg.Staff == null)
            {
                return(new List <Staff>());
            }
            else
            {
                return(msg.Staff);
            }
        }
示例#2
0
        /// <summary>
        /// Gets the specified staff from the server.
        /// </summary>
        /// <param name="staffId">The id of the staff to retrieve.</param>
        /// <returns>A Staff object.</returns>
        private Staff GetStaff(int staffId)
        {
            GetStaffDataMessage staffDataMsg = new GetStaffDataMessage(staffId);

            try
            {
                staffDataMsg.Send();
            }
            catch (Exception e)
            {
                ReformatException(e);
            }

            // We only care about the first staff if more than one was
            // returned.
            Staff[] staffList = staffDataMsg.StaffList;

            if (staffList == null || staffList.Length == 0)
            {
                throw new ModuleException(Resources.StaffNotFound);
            }

            return(staffList[0]);
        }