Example #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);
        }
Example #2
0
        /// <summary>
        /// Get Staff detail
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static PLStaff GetStaffDetail(int id)
        {
            SLStaff.ISLStaff slStaff = new SLStaff.SLStaffClient();

            string[] errors = new string[0];
            SLStaff.GetStaffRequest  request  = new SLStaff.GetStaffRequest(id, errors);
            SLStaff.GetStaffResponse response = slStaff.GetStaff(request);
            SLStaff.Staff            newStaff = response.GetStaffResult;
            // this is the data transfer object code...
            return(DTO_to_PL(newStaff));
        }
Example #3
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);
        }
Example #4
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);
        }