public static SystemUserTO Map(User user) { if (user == null) { throw new ArgumentNullException("user"); } var privilegeTO = PrivilegeDAO.GetInstance().GetByPrivilegeLevelEq(user.PrivilegeLevel).FirstOrDefault(); if (privilegeTO == null) { privilegeTO = new PrivilegeTO { PrivilegeName = user.Name + " privilege", PrivilegeLevel = user.PrivilegeLevel }; privilegeTO = PrivilegeDAO.GetInstance().Insert(privilegeTO); } return(new SystemUserTO { UserId = user.Id, UserName = user.Name, UserPassword = user.Password, PhoneNumber = user.PhoneNumber, PrivilegeId = privilegeTO.PrivilegeId }); }
private static void WritePrivilege(PrivilegeTO privilege) { Console.WriteLine("Id: {0}", privilege.PrivilegeId); Console.WriteLine("Name: {0}", privilege.PrivilegeName); Console.WriteLine("Description: {0}", privilege.PrivilegeDesc); Console.WriteLine("Level: {0}", privilege.PrivilegeLevel); }