/// <summary> /// constructor no. 3, takes the properties from the user input and builds a User object with an option to build user's projects and user's Program Knowledge lists /// </summary> public UserInfo(int ID, string UserName, string Password, string Email, DateTime Birthday, int NativeLang, int Country , int WeeklyFreeTime, int NumRateVoters, int UserRate, bool IsBanned, int ProjectSum, DateTime RegistrationDate , DateTime LoginDate, int UserType, bool ListsFlag) { this.ID = ID; this.UserName = UserName; this.Password = Password; this.Email = Email; this.Birthday = Birthday; this.NativeLang = NativeLang; this.Country = Country; this.WeeklyFreeTime = WeeklyFreeTime; this.NumRateVoters = NumRateVoters; this.UserRate = UserRate; this.IsBanned = IsBanned; this.ProjectSum = ProjectSum; this.RegistrationDate = RegistrationDate; this.LoginDate = LoginDate; this.UserType = UserType; if (ListsFlag) { this.UserProjects = Project.ReturnUserProjects(ID); this.UserPK = UserKnowledge.GetUserKnowledgeBL(ID); } }
/// <summary> /// constructor no. 2, takes an ID of a user and creats a user object without or with lists of knowledge and professions. 'thing' doesn't matter. /// </summary> public UserInfo(int userID, bool BuildLists, bool thing) { try { DataRow userRow = UserDB.GetUserByID(userID); this.ID = (int)userRow["ID"]; this.UserName = (string)userRow["UserName"]; this.Password = (string)userRow["Pass"]; this.Email = (string)userRow["Email"]; this.Birthday = (DateTime)userRow["Birthday"]; this.NativeLang = (int)userRow["NativeLang"]; this.Country = (int)userRow["Country"]; this.WeeklyFreeTime = (int)userRow["WeeklyFreeTime"]; this.NumRateVoters = (int)userRow["NumRateVoters"]; this.UserRate = (int)userRow["UserRate"]; this.IsBanned = (bool)userRow["IsBanned"]; this.RegistrationDate = (DateTime)userRow["RegistrationDate"]; if (userRow["LoginDate"] != DBNull.Value) { this.LoginDate = (DateTime)userRow["LoginDate"]; } this.UserType = (int)userRow["UserType"]; this.ProfilePath = (string)userRow["ProfilePath"]; if (BuildLists) { this.UserProjects = Project.ReturnUserProjects(this.ID); this.UserPK = UserKnowledge.GetUserKnowledgeBL(this.ID); } } catch (Exception) { // does nothing } }