Ejemplo n.º 1
0
 /// <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);
     }
 }
Ejemplo n.º 2
0
 /// <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
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// the method builds a list of userKnowLedge object's by an id of a user given to it.
 /// * the method return the list after it has filled it by all matching skills in the db
 /// </summary>
 public static List <UserKnowledge> GetUserKnowledgeBL(int id)
 {
     try
     {
         List <UserKnowledge> SkillList  = new List <UserKnowledge>();
         DataTable            SkillTable = UserKnowledgeDB.GetUserKnowledge(id);
         foreach (DataRow USskill in SkillTable.Rows)
         {
             UserKnowledge UserKnow = new UserKnowledge((int)USskill["PKID"], (int)USskill["ProgramID"], (string)USskill["PName"].ToString(),
                                                        (string)USskill["ProgPath"].ToString());
             SkillList.Add(UserKnow);
         }
         return(SkillList);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         return(null);
     }
 }