Пример #1
0
        /// <summary>
        /// update existing Staff info
        /// </summary>
        /// <param name="s"></param>
        public static void UpdateStaff(PLStaff s)
        {
            SLStaff.Staff newStaff = DTO_to_SL(s);

            SLStaff.ISLStaff           SLStaff = new SLStaff.SLStaffClient();
            string[]                   errors  = new string[0];
            SLStaff.UpdateStaffRequest request = new SLStaff.UpdateStaffRequest(newStaff, errors);
            SLStaff.UpdateStaff(request);
        }
Пример #2
0
        /// <summary>
        /// this is data transfer object for Staff.
        /// Converting from presentation layer Staff object to business layer Staff object
        /// </summary>
        /// <param name="staffMember"></param>
        /// <returns>instance of SLStaff</returns>
        private static SLStaff.Staff DTO_to_SL(PLStaff staffMember)
        {
            SLStaff.Staff slStaff = new SLStaff.Staff();
            slStaff.id           = staffMember.ID;
            slStaff.first_name   = staffMember.FirstName;
            slStaff.last_name    = staffMember.LastName;
            slStaff.email        = staffMember.EmailAddress;
            slStaff.password     = staffMember.Password;
            slStaff.dept         = DTO_to_SL(staffMember.Department);
            slStaff.isInstructor = staffMember.isInstructor;

            return(slStaff);
        }
Пример #3
0
        /// <summary>
        /// This is the data transfer object for Staff.
        /// Converting business layer Staff object to presentation layer Staff object
        /// </summary>
        /// <param name="Staff"></param>
        /// <returns> a presentation layer Staff object</returns>
        private static PLStaff DTO_to_PL(SLStaff.Staff staffMember)
        {
            PLStaff PLStaff = new PLStaff();

            PLStaff.ID           = staffMember.id;
            PLStaff.FirstName    = staffMember.first_name;
            PLStaff.LastName     = staffMember.last_name;
            PLStaff.EmailAddress = staffMember.email;
            PLStaff.Password     = staffMember.password;
            PLStaff.Department   = DTO_to_PL(staffMember.dept);
            PLStaff.isInstructor = staffMember.isInstructor;

            return(PLStaff);
        }
Пример #4
0
        public static List <PLStaff> GetStaffList()
        {
            List <PLStaff> staffList = new List <PLStaff>();

            SLStaff.ISLStaff client = new SLStaff.SLStaffClient();

            string[] errors = new string[0];
            SLStaff.GetStaffListRequest  request  = new SLStaff.GetStaffListRequest(errors);
            SLStaff.GetStaffListResponse response = client.GetStaffList(request);
            SLStaff.Staff[] staffMembersLoaded    = response.GetStaffListResult;

            foreach (SLStaff.Staff s in staffMembersLoaded)
            {
                PLStaff staffMember = DTO_to_PL(s);
                staffList.Add(staffMember);
            }

            return(staffList);
        }