コード例 #1
0
    public void loadTabsInfo(string colName)
    {
        DataSet ds = new DataSet();
        DatabaseFunctions db = new DatabaseFunctions();
        string userID = Membership.GetUser().ProviderUserKey.ToString();

        if (colName == "HasJambData")
        {
            ds = db.loadJamDataByUserID(userID);
            if (ds.Tables[0].Rows.Count > 0)
            {
                txtJambRegNo.Text = ds.Tables[0].Rows[0]["JambRegNo"].ToString();
                dropdownSubject1.SelectedValue = ds.Tables[0].Rows[0]["Subject1"].ToString();
                txtScore1.Text = ds.Tables[0].Rows[0]["Score1"].ToString();
                dropdownSubject2.SelectedValue = ds.Tables[0].Rows[0]["Subject2"].ToString();
                txtscore2.Text = ds.Tables[0].Rows[0]["Score2"].ToString();
                dropdownSubject3.SelectedValue = ds.Tables[0].Rows[0]["Subject3"].ToString();
                txtscore3.Text = ds.Tables[0].Rows[0]["Score3"].ToString();
                dropdownSubject4.SelectedValue = ds.Tables[0].Rows[0]["Subject4"].ToString();
                txtscore4.Text = ds.Tables[0].Rows[0]["Score4"].ToString();
                dropdownJambchoice.SelectedValue = ds.Tables[0].Rows[0]["ChoiceOfPolytechnic"].ToString();

                if (txtScore1.Text != "" && txtscore2.Text != "" && txtscore3.Text != "" && txtscore4.Text != "")
                {
                    int sum = Convert.ToInt16(txtScore1.Text) + Convert.ToInt16(txtscore2.Text) + Convert.ToInt16(txtscore3.Text) + Convert.ToInt16(txtscore4.Text);

                    txtJambUtmeScore.Value = sum.ToString();
                }
            }
        }
        else if (colName == "HasBioDataSection")
        {
            ds = db.loadBiodataUserID(userID);
            if (ds.Tables[0].Rows.Count > 0)
            {
                string picture = ds.Tables[0].Rows[0]["ProfilePic"].ToString();
                if (picture != "")
                {
                    hidden_dpImage.Value = picture;
                    imgDisplay.Src = "profilepics/" + picture;
                    imgDisplay.Style.Add("display", "inline");
                }
                txtSurname.Text = ds.Tables[0].Rows[0]["Surname"].ToString();
                txtFirstName.Text = ds.Tables[0].Rows[0]["Firstname"].ToString();
                txtOtherName.Text = ds.Tables[0].Rows[0]["Othername"].ToString();
                dropdownGender.SelectedValue = ds.Tables[0].Rows[0]["Gender"].ToString();
                string dob = ds.Tables[0].Rows[0]["DOB"].ToString();
                //SPLIE AND ASSIGN

                string[] splitter = dob.Split('-');
                if (splitter.Length > 0)
                {
                    dropdownDay.SelectedValue = splitter[2];
                    dropdownMonth.SelectedValue = splitter[1];
                    dropdownyears.SelectedValue = splitter[0];
                }

                txtPhonenumber.Value = ds.Tables[0].Rows[0]["Phonenumber"].ToString();
                txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString();
                txtHomeaddress.Text = ds.Tables[0].Rows[0]["Address"].ToString();


                if (dropdownSto.Items.Count == 1)
                {
                    getstates();
                }
                try
                {
                    dropdownSto.SelectedValue = ds.Tables[0].Rows[0]["state"].ToString();
                }
                catch (Exception exx)
                { }
                DataSet dstate = new DataSet();
                dstate = db.getAreas_States(Convert.ToInt16(ds.Tables[0].Rows[0]["state"].ToString()));
                if (dstate.Tables[0].Rows.Count > 0)
                {
                    dropdownLocalGovtarea.DataSource = dstate.Tables[0];
                    dropdownLocalGovtarea.DataTextField = "Area";
                    dropdownLocalGovtarea.DataValueField = "ID";

                    dropdownLocalGovtarea.DataBind();
                }

                dropdownLocalGovtarea.SelectedValue = ds.Tables[0].Rows[0]["LocalGovtArea"].ToString();

            }
        }
        else if (colName == "HasOlevelResult")
        {
            loadSubjectandGrades();
            ds = db.loadOlevelDataUserID_fs1(userID);
            if (ds.Tables[0].Rows.Count > 0)
            {


                dropdownExam.SelectedValue = ds.Tables[0].Rows[0]["Examtype"].ToString();
                dropdownExamMonth.SelectedValue = ds.Tables[0].Rows[0]["Exammonth"].ToString();
                dropdownExamYear.SelectedValue = ds.Tables[0].Rows[0]["ExamYear"].ToString();
                txtExamNum.Text = ds.Tables[0].Rows[0]["Examnumber"].ToString();


                dropdownOlevelSub1.SelectedValue = ds.Tables[0].Rows[0]["Subject1"].ToString();
                dropdownolevelGrade1.SelectedValue = ds.Tables[0].Rows[0]["Grade1"].ToString();
                dropdownOlevelSub2.SelectedValue = ds.Tables[0].Rows[0]["Subject2"].ToString();
                dropdownGrade2.SelectedValue = ds.Tables[0].Rows[0]["Grade2"].ToString();
                dropdownolevelSub3.SelectedValue = ds.Tables[0].Rows[0]["Subject3"].ToString();
                dropdownGrade3.SelectedValue = ds.Tables[0].Rows[0]["Grade3"].ToString();
                dropdownOlvlSub4.SelectedValue = ds.Tables[0].Rows[0]["Subject4"].ToString();
                dropdownGrade4.SelectedValue = ds.Tables[0].Rows[0]["Grade4"].ToString();
                dropdownOlevelsub5.SelectedValue = ds.Tables[0].Rows[0]["Subject5"].ToString();
                dropdownGrade5.SelectedValue = ds.Tables[0].Rows[0]["Grade5"].ToString();
                dropdownOlevelSub6.SelectedValue = ds.Tables[0].Rows[0]["Subject6"].ToString();
                dropdownGrade6.SelectedValue = ds.Tables[0].Rows[0]["Grade6"].ToString();
                dropdownOlevelSub7.SelectedValue = ds.Tables[0].Rows[0]["Subject7"].ToString();
                dropdonGrade7.SelectedValue = ds.Tables[0].Rows[0]["Grade7"].ToString();
                dropdownolevelSub8.SelectedValue = ds.Tables[0].Rows[0]["Subject8"].ToString();
                dropdownGrade8.SelectedValue = ds.Tables[0].Rows[0]["Grade8"].ToString();
                dropdowOlevelSub9.SelectedValue = ds.Tables[0].Rows[0]["Subject9"].ToString();
                dropdownGrade9.SelectedValue = ds.Tables[0].Rows[0]["Grade9"].ToString();

            }
            ds = new DataSet();
            ds = db.loadOlevelDataUserID_fs2(userID);
            if (ds.Tables[0].Rows.Count > 0)
            {
                dropdownExamType2.SelectedValue = ds.Tables[0].Rows[0]["Examtype"].ToString();
                dropdownExamMonth2.SelectedValue = ds.Tables[0].Rows[0]["Exammonth"].ToString();
                dropdownListexamyear2.SelectedValue = ds.Tables[0].Rows[0]["ExamYear"].ToString();
                txtExamNum2.Text = ds.Tables[0].Rows[0]["Examnumber"].ToString();


                dropdownOlevelsubject1b.SelectedValue = ds.Tables[0].Rows[0]["Subject1"].ToString();
                dropdownListGrade2.SelectedValue = ds.Tables[0].Rows[0]["Grade1"].ToString();
                dropdownOlevelSub2b.SelectedValue = ds.Tables[0].Rows[0]["Subject2"].ToString();
                dropdownGrade2b.SelectedValue = ds.Tables[0].Rows[0]["Grade2"].ToString();
                dropdownolevelSub3b.SelectedValue = ds.Tables[0].Rows[0]["Subject3"].ToString();
                dropdownGrade3b.SelectedValue = ds.Tables[0].Rows[0]["Grade3"].ToString();
                dropdownOlvlSub4b.SelectedValue = ds.Tables[0].Rows[0]["Subject4"].ToString();
                dropdownGrade4b.SelectedValue = ds.Tables[0].Rows[0]["Grade4"].ToString();
                dropdownOlevelsub5b.SelectedValue = ds.Tables[0].Rows[0]["Subject5"].ToString();
                dropdownGrade5b.SelectedValue = ds.Tables[0].Rows[0]["Grade5"].ToString();
                dropdownOlevelSub6b.SelectedValue = ds.Tables[0].Rows[0]["Subject6"].ToString();
                dropdownGrade6b.SelectedValue = ds.Tables[0].Rows[0]["Grade6"].ToString();
                dropdownOlevelSub7b.SelectedValue = ds.Tables[0].Rows[0]["Subject7"].ToString();
                dropdonGrade7b.SelectedValue = ds.Tables[0].Rows[0]["Grade7"].ToString();
                dropdownolevelSub8b.SelectedValue = ds.Tables[0].Rows[0]["Subject8"].ToString();
                dropdownGrade8b.SelectedValue = ds.Tables[0].Rows[0]["Grade8"].ToString();
                dropdowOlevelSub9b.SelectedValue = ds.Tables[0].Rows[0]["Subject9"].ToString();
                dropdownGrade9b.SelectedValue = ds.Tables[0].Rows[0]["Grade9"].ToString();

            }
        }
        else if (colName == "HasPreviousRecord")
        {
            loadInstitutions();
            ds = db.loadPreviousAcademicRecordByUserID(userID);
            if (ds.Tables[0].Rows.Count > 0)
            {

                txtNdMetricNum.Text = ds.Tables[0].Rows[0]["ND_Matric_Number"].ToString();
                txtjaRegno_previous.Text = ds.Tables[0].Rows[0]["JAMBRegno"].ToString();
                dropdownJambExamYear_Previous.SelectedValue = ds.Tables[0].Rows[0]["JambExamyear"].ToString();
                txtJambFullName_previous.Text = ds.Tables[0].Rows[0]["JambFullName"].ToString();
                dropdwnJamIns_Previous.SelectedValue = ds.Tables[0].Rows[0]["InstitutionAttented"].ToString();
                txtJambCourseName_previous.Text = ds.Tables[0].Rows[0]["CourseName"].ToString();
                dropdownCourseType_Previous.Text = ds.Tables[0].Rows[0]["CourseType"].ToString();
                dropdownCourseGrade_Prvious.Text = ds.Tables[0].Rows[0]["CourseGrade"].ToString();
                dropdownyearCompleted_Previous.SelectedValue = ds.Tables[0].Rows[0]["YearCompleted"].ToString();
                string insStart = ds.Tables[0].Rows[0]["IndTrainingStart"].ToString();
                string[] splitter = insStart.Split('-');

                dropdownIndustrialtrainingStart.SelectedValue = splitter[0];
                dropdownIndustrialTrainingEndYear.SelectedValue = splitter[1];

                string[] splitter2 = ds.Tables[0].Rows[0]["IndTrainingEnd"].ToString().Split('-');

                dropdownIndustrialStarmonth2.SelectedValue = splitter2[0];
                dropdownIndustrialTrainingYearStart2.SelectedValue = splitter2[1];

            }
        }
        else if (colName == "HasCBTSchedule")
        {
            loadDates_CBT();

            ds = db.loadCbtScheduleUserID(userID);
            if (ds.Tables[0].Rows.Count > 0)
            {
                string dateTxt = ds.Tables[0].Rows[0]["ScheduleDate"].ToString();
                dropdownScheduleDate.SelectedItem.Text = dateTxt;
                dropdownTime.SelectedItem.Text = ds.Tables[0].Rows[0]["ScheduleTime"].ToString();
                //DataSet dm = db.getAllTimes_CBT(dateTxt, Convert.ToInt32(ViewState["programID"]));
                //if (dm.Tables[0].Rows.Count > 0)
                //{
                //    dropdownTime.DataSource = dm.Tables[0];
                //    dropdownTime.DataBind();
                //}
                string time = ds.Tables[0].Rows[0]["ScheduleTime"].ToString();
                //string timeID = ds.Tables[0].Rows[0]["timeID"].ToString();
                //dropdownTime.SelectedValue = timeID;
                labelScheduleTxt.Text = dateTxt + ", " + time;
                labelCbtUser.Text = ds.Tables[0].Rows[0]["CbtUserName"].ToString();
                lblCbtPassword.Text = ds.Tables[0].Rows[0]["CbtPassword"].ToString();

                dropdownTime.Enabled = false;
                RequiredFieldValidator87.Enabled = false;
                RequiredFieldValidator76.Enabled = false;
                dropdownScheduleDate.Enabled = false;
            }
        }

    }