Example #1
0
        public Expert getAllTheExpertInfo(string tuid)
        {
            DbMethods DbMethods        = new DbMethods();
            Expert    expertProfileObj = new Expert();

            //add information from ExpertProfile table
            DataSet expertInfoDS = DbMethods.GetExpertInfo(tuid);

            expertProfileObj.tuID           = expertInfoDS.Tables[0].Rows[0][0].ToString();
            expertProfileObj.firstName      = expertInfoDS.Tables[0].Rows[0][3].ToString();
            expertProfileObj.lastName       = expertInfoDS.Tables[0].Rows[0][2].ToString();
            expertProfileObj.username       = expertInfoDS.Tables[0].Rows[0][1].ToString();
            expertProfileObj.email          = expertInfoDS.Tables[0].Rows[0][4].ToString();
            expertProfileObj.dateJoined     = Convert.ToDateTime(expertInfoDS.Tables[0].Rows[0][5].ToString());
            expertProfileObj.phoneNumber    = expertInfoDS.Tables[0].Rows[0][6].ToString();
            expertProfileObj.aboutMe        = expertInfoDS.Tables[0].Rows[0][7].ToString();
            expertProfileObj.college        = expertInfoDS.Tables[0].Rows[0][8].ToString();
            expertProfileObj.major          = expertInfoDS.Tables[0].Rows[0][9].ToString();
            expertProfileObj.linkedIn       = expertInfoDS.Tables[0].Rows[0][10].ToString();
            expertProfileObj.isActive       = Convert.ToBoolean(expertInfoDS.Tables[0].Rows[0][12].ToString());
            expertProfileObj.skillGroupID   = Convert.ToInt32(expertInfoDS.Tables[0].Rows[0][13].ToString());
            expertProfileObj.genderID       = Convert.ToInt32(expertInfoDS.Tables[0].Rows[0][14].ToString());
            expertProfileObj.ethnicityID    = Convert.ToInt32(expertInfoDS.Tables[0].Rows[0][15].ToString());
            expertProfileObj.lastUpdateDate = Convert.ToDateTime(expertInfoDS.Tables[0].Rows[0][16].ToString());
            expertProfileObj.lastUpdateUser = expertInfoDS.Tables[0].Rows[0][17].ToString();
            expertProfileObj.picture        = (byte[])expertInfoDS.Tables[0].Rows[0][11];

            //add skill group name
            expertProfileObj.SkillGroupName = DbMethods.GetSkillGroupName(expertProfileObj.skillGroupID).ToString();

            //add roles and venture names
            DataSet roleAndVentureNameDS = DbMethods.GetExpertRoleAndVenture(tuid);

            for (int i = 0; i < roleAndVentureNameDS.Tables[0].Select().Length; i++)
            {
                string role        = roleAndVentureNameDS.Tables[0].Rows[i][0].ToString();
                string ventureName = roleAndVentureNameDS.Tables[0].Rows[i][1].ToString();

                expertProfileObj.roleVentureNameList.Add(new Tuple <string, string>(ventureName, role));
            }

            //get all expert sklls and add them to the expert object
            DataTable expertSklls = DbMethods.GetExpertsSkills(tuid).Tables[0];

            for (int z = 0; z < expertSklls.Rows.Count; z++)
            {
                int    SkillID   = Convert.ToInt32(expertSklls.Rows[z][0]);
                string SkillName = expertSklls.Rows[z][1].ToString();

                expertProfileObj.AllExpertSkills.Add(new Tuple <int, string>(SkillID, SkillName));
            }
            return(expertProfileObj);
        }