public static WCFStaffModel LogIn(string userId, string password) { WCFStaffModel wcfStaff = new WCFStaffModel(); LoginController loginController = new LoginController(); if (loginController.CheckUser(userId, password)) { Staff staff = loginController.GetUser(userId); wcfStaff.StaffId = staff.StaffId; wcfStaff.Password = staff.Password; wcfStaff.StaffName = staff.StaffName; wcfStaff.RoleId = staff.RoleId; wcfStaff.RoleName = staff.Role.RoleName; wcfStaff.DepartmentId = staff.DepartmentId; if (wcfStaff.RoleId == 4 || wcfStaff.RoleId == 5 || wcfStaff.RoleId == 6) { wcfStaff.DepartmentName = "Stationary Store Department"; wcfStaff.DepartmentHeadId = ""; } else { wcfStaff.DepartmentName = staff.Department.DepartmentName; wcfStaff.DepartmentHeadId = staff.Department.DepartmentHead_ID; } wcfStaff.Email = staff.Email; wcfStaff.PhoneNumber = staff.PhoneNumber; wcfStaff.Address = staff.Address; wcfStaff.EmailPassword = staff.EmailPassword; } return(wcfStaff); }
// Delegate public static List <WCFStaffModel> GetStaffNameByDepartmentId(string depId, string staffId) { ManageAuthorityDelegationController manageAuthorityDelegationController = new ManageAuthorityDelegationController(); List <Staff> staffList = manageAuthorityDelegationController.GetStaffNameByDepartmentId(depId, staffId); List <WCFStaffModel> wcfStaffList = new List <WCFStaffModel>(); foreach (Staff s in staffList) { WCFStaffModel w = new WCFStaffModel(); w.StaffId = s.StaffId; w.Password = s.Password; w.StaffName = s.StaffName; w.RoleId = s.RoleId; w.RoleName = s.Role.RoleName; w.DepartmentId = s.DepartmentId; w.DepartmentName = s.Department.DepartmentName; w.Email = s.Email; w.PhoneNumber = s.PhoneNumber; w.Address = s.Address; w.EmailPassword = s.EmailPassword; w.DepartmentHeadId = s.Department.DepartmentHead_ID; wcfStaffList.Add(w); } return(wcfStaffList); }