コード例 #1
0
    private void setupDlGroupContent(DropDownList dlGroup, string strSQL)
    {
        Hints.DB.clsHintsDB myDB = new Hints.DB.clsHintsDB();
        DataTable           dt   = myDB.getDataSet(strSQL).Tables[0];

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string strGroupName = dt.Rows[i]["cGroup"].ToString();

                ListItem liGroup = new ListItem(strGroupName, strGroupName);
                dlGroup.Items.Add(liGroup);
            }
        }
    }
コード例 #2
0
    private void setupDlClassContent(DropDownList dlClass, string strSQL)
    {
        Hints.DB.clsHintsDB myDB = new Hints.DB.clsHintsDB();
        DataTable           dt   = myDB.getDataSet(strSQL).Tables[0];

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string strClassName = dt.Rows[i]["cClass"].ToString();

                ListItem liClass = new ListItem(strClassName, strClassName);
                dlClass.Items.Add(liClass);
            }
        }
    }
コード例 #3
0
    void btnFinish_ServerClick(object sender, EventArgs e)
    {
        //呼叫寫入Paper_AssignedQuestion的函式
        string strSQL = "";

        if (rbClass.Checked == true)
        {
            strSQL = "SELECT DISTINCT cUserID FROM HintsUser WHERE cClass = '" + dlClass1.SelectedItem.Value + "' ";
        }
        else
        {
            strSQL = "SELECT DISTINCT cUserID FROM UserGroup WHERE cGroup = '" + dlGroup.SelectedItem.Value + "' ";
        }

        Hints.Learning.Question.QuestionUtility myUtility = new Hints.Learning.Question.QuestionUtility();
        Hints.DB.clsHintsDB myDB = new Hints.DB.clsHintsDB();
        DataTable           dt   = myDB.getDataSet(strSQL).Tables[0];

        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string strUserID = dt.Rows[i]["cUserID"].ToString();

                //確認此問卷是不是有資料存在Paper_AssignedQuestion,如果沒有則寫入資料。
                bool bCheck = Hints.Learning.Question.DataReceiver.checkUserDataFromPaper_AssignedQuestion(usi.PaperID, "00000000000000", strUserID);
                if (bCheck == false)
                {
                    myUtility.setupPaper_AssignedQuestionByPaperIDStartTimeUserID(usi.PaperID, "00000000000000", strUserID);
                }
            }
        }

        //將指派測驗的日期和對象記錄在OnlineQuiz_Assign
        string StartTime     = TransferDateFormat(tb_StartTime, ddl_StartHr, ddl_StartMin);
        string EndTime       = TransferDateFormat(tb_EndTime, ddl_EndHr, ddl_EndMin);
        string SelectedValue = "";

        if (rbClass.Checked == true)
        {
            SelectedValue = dlClass1.SelectedItem.Value;
            strSQL        = "INSERT INTO OnlineQuiz_Assign VALUES ('" + usi.CaseID + "','" + usi.PaperID + "','" + StartTime + "','" + EndTime + "','" + SelectedValue + "','class',0)";
        }
        else
        {
            SelectedValue = dlGroup.SelectedItem.Value;
            strSQL        = "INSERT INTO OnlineQuiz_Assign VALUES ('" + usi.CaseID + "','" + usi.PaperID + "','" + StartTime + "','" + EndTime + "','" + SelectedValue + "','group',0)";
        }
        try
        {
            myDB.ExecuteNonQuery(strSQL);
        }
        catch
        { }

        string strScript = "<script language='javascript'>\n";

        strScript += "closeWindow();\n";
        strScript += "</script>\n";
        Page.RegisterStartupScript("closeWindow", strScript);
    }