Example #1
0
    private string BindQuizable(string testid)
    {
        //string htmltext = ChecekMode?"<table class=\"History_Quiz_tabel\">":"<table class=\"Quiz_table\">";
        string  htmltext    = "";
        DataSet Ds          = new DataSet();
        string  SelectCmd_Q = "Select TTRelationship.RelationshipID,Topic.TopicID,Topic.TopicContent,Topic.HaveContent,Topic.MoreContent From TTRelationship inner join Topic on TTRelationship.TopicID=Topic.TopicID where TTRelationship.TestID=" + testid;

        using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
        {
            Sc.Open(); MySqlDataAdapter Da = new MySqlDataAdapter(SelectCmd_Q, Sc);
            Da.Fill(Ds);
        }
        int       TestCount = 0;
        DataTable Dt        = Ds.Tables[0];

        using (MySqlDataReader read = new Diya().RowReader("select TestCount from TestInfo where TestID=" + testid))
        {
            if (read.Read())
            {
                TestCount = read.GetInt32(0);
            }
            else
            {
                TestCount = 0;
            }
            read.Close();
        }
        for (int i = 0; i < TestCount; i++)
        {
            htmltext = "<tr class=\"item_Quiz\"><td style=\text-align:left\"><label>" + (i + 1) + " ." + Dt.Rows[i]["TopicContent"] + "</label></td></tr>";
            DataSet Dso = new DataSet();
            using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
            {
                Sc.Open(); MySqlDataAdapter da = new MySqlDataAdapter("Select Options.OptionID,Options.OptionContent From Options inner join OTRelationship on OTRelationship.OptionID=Options.OptionID Where OTRelationship.TTRelationshipID=" + Dt.Rows[i]["RelationshipID"].ToString(), Sc);
                da.Fill(Dso);
            }
            DataTable Options = Dso.Tables[0];
            for (int j = 0; j < Options.Rows.Count; j++)
            {
                htmltext += "<tr style=\"height:2%\"><td>&nbsp;</td></tr>";
                htmltext += "<tr><td><div class=\"item_Options\"> title=\"\"  id=\"" + Options.Rows[j]["OptionID"] + "n\"><input type=\"checkbox\" runat=\"server\" id=\"" + Options.Rows[j]["OptionID"] + "\" onserverchange=\"test_ServerChange\" disabled=\"disabled\" style=\"border:1px solid Black\">" + Convert.ToChar(65 + j) + ". " + Options.Rows[j]["OptionContent"] + "</div></td></tr>";
                if (j == Options.Rows.Count - 1)
                {
                    htmltext += "<tr style=\"height:5%\"><td>&nbsp</td></tr>";
                }
            }
            Dst.Addstate(htmltext);
        }

        return(htmltext);
    }
Example #2
0
    protected void ScreachBtn_Click(object sender, EventArgs e)
    {
        string    startTime       = this.MinTime.Value;
        string    endTime         = this.MaxTime.Value;
        DataTable KnowledgePoints = new DataTable();
        DataTable Knowledgelest   = new DataTable();

        Knowledgelest.Columns.Add("KonwledgePointID");
        Knowledgelest.Columns.Add("Count");
        Knowledgelest.Columns.Add("Rights");
        using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
        {
            Sc.Open();
            MySqlDataAdapter da = new MySqlDataAdapter("Select TKRelationship.KnowledgePointID from TSRelationship inner join TTRelationship on TTRelationship.TestID=TSRelationship.TestID inner join TKRelationship on TKRelationship.TopicID=TTRelationship.TopicID inner join TestInfo on TSRelationship.TestID=TestInfo.TestID where TestInfo.TestStartTime Between '" + this.MinTime.Value + "' and '" + this.MaxTime.Value + "' and TSRelationship.Contactid=" + ViewState["Contactid"].ToString() + " order by TKRelationship.KnowledgePointID ", Sc);
            da.Fill(KnowledgePoints);
        }
        int Knowledgecount = 0;

        if (KnowledgePoints.Rows.Count != 0)
        {
            this.TestCount_div.Visible = true;
            this.Myhistory_Gw.Visible  = true;
            string KnowledgeIDFlage = KnowledgePoints.Rows[0][0].ToString();

            for (int i = 0; i < KnowledgePoints.Rows.Count; i++)
            {
                if (KnowledgePoints.Rows[i][0].ToString() == KnowledgeIDFlage)
                {
                    Knowledgecount++;
                }
                else
                {
                    Knowledgelest.Rows.Add(Knowledgelest.NewRow());
                    Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["Count"]            = Knowledgecount;
                    Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["KonwledgePointID"] = KnowledgeIDFlage;
                    Knowledgecount   = 1;
                    KnowledgeIDFlage = KnowledgePoints.Rows[i][0].ToString();
                }
            }
            KnowledgeIDFlage = KnowledgePoints.Rows[KnowledgePoints.Rows.Count - 1][0].ToString();
            Knowledgecount   = 0;
            for (int i = KnowledgePoints.Rows.Count - 1; i >= 0; i--)
            {
                if (KnowledgePoints.Rows[i][0].ToString() == KnowledgeIDFlage)
                {
                    Knowledgecount++;
                }
                else
                {
                    Knowledgelest.Rows.Add(Knowledgelest.NewRow());
                    Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["Count"]            = Knowledgecount;
                    Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["KonwledgePointID"] = KnowledgeIDFlage;
                    break;
                }
            }

            foreach (DataRow Dr in Knowledgelest.Rows)
            {
                int Rights = 0;
                using (MySqlDataReader read = new Diya().RowReader("Select Count(*) as a from TSRelationship inner join HTRelationship on HTRelationship.TSRelationshipID=TSRelationship.RelationshipID inner join TKRelationship on TKRelationship.TopicID=HTRelationship.TopicID inner join Options on Options.OptionID=HTRelationship.SelectedOptionID inner join TestInfo on TestInfo.TestID=TSRelationship.TestID where TestInfo.TestStartTime between '" + this.MinTime.Value + "' and '" + this.MaxTime.Value + "' and TKRelationship.KnowledgePointID=" + Dr["KonwledgePointID"] + " and TSRelationship.Contactid=" + ViewState["Contactid"].ToString() + " and Options.IsTrue=1"))
                {
                    read.Read();
                    Rights = read.GetInt32(0);
                }
                Dr["Rights"] = Rights;
            }

            DataSet Datasource = new DataSet();
            int     Colindex   = 0;
            for (int i = 0; i < Knowledgelest.Rows.Count; i++)
            {
                if (i % 6 == 0)
                {
                    Datasource.Tables.Add(new DataTable());
                    Colindex = 0;
                    //foreach (DataRow Dr in Knowledgelest.Rows)
                    //{
                    for (int j = i; j < i + 6 && j < Knowledgelest.Rows.Count; j++)
                    {
                        string KnowledgeName = "";
                        using (MySqlDataReader read = new Diya().RowReader("Select KnowledgePointName from KnowledgePoint where KnowledgePointID=" + Knowledgelest.Rows[j]["KonwledgePointID"]))
                        {
                            read.Read();
                            KnowledgeName = read["KnowledgePointName"].ToString();
                        }
                        Datasource.Tables[Datasource.Tables.Count - 1].Columns.Add(KnowledgeName);
                        //}
                    }
                    Datasource.Tables[Datasource.Tables.Count - 1].Rows.Add(Datasource.Tables[Datasource.Tables.Count - 1].NewRow());
                }
                double score = Convert.ToDouble(Knowledgelest.Rows[i]["Rights"]) / Convert.ToDouble(Knowledgelest.Rows[i]["Count"]);

                Datasource.Tables[Datasource.Tables.Count - 1].Rows[0][Colindex++] = score.ToString("P") + "(" + Knowledgelest.Rows[i]["Rights"] + "/" + Knowledgelest.Rows[i]["Count"] + ")";
            }
            ViewState["GvIndex"]   = 0;
            ViewState["CountData"] = Datasource;
            this.Count.Columns.Clear();
            this.Count.DataSource = Datasource.Tables[0];
            this.Count.DataBind();
            string Selectcmd = "Select * from TSRelationship inner join TestInfo on TestInfo.Testid=TSRelationship.Testid where TSRelationship.Score is not null and TSRelationship.Contactid=" + ViewState["Contactid"] + " and TestInfo.TestStartTime Between '" + this.MinTime.Value + "' and '" + this.MaxTime.Value + "' order by TSRelationship.RelationshipID DESC";
            ViewState["DataSource"] = new Diya().Gridviewbind(this.Myhistory_Gw, Selectcmd);
            BindWorngPageInfo();
        }
        else
        {
            Literal Message = new Literal();
            Message.Text = "<script>alert('目前没有任何记录')</script>";
            this.Page.Controls.Add(Message);
            this.TestCount_div.Visible = false;
            this.Myhistory_Gw.Visible  = false;
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["UserInfo"] == null)
            {
                if (Request.Cookies["UserConfig"] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    HttpCookie cookie = Request.Cookies["UserConfig"];
                    Session["UserInfo"] = Server.HtmlEncode(new Diya().GetDESDecrypt(cookie.Value));
                }
            }
            ViewState["Contactid"] = Session["Contactid_S"];
            //string Selectcmd = "Select * from TSRelationship inner join TestInfo on TestInfo.Testid=TSRelationship.Testid where TSRelationship.Score is not null and TSRelationship.Contactid=" + Session["Contactid_S"];
            //ViewState["DataSource"] = Diya.Gridviewbind(this.Myhistory_Gw, Selectcmd);
            using (MySql.Data.MySqlClient.MySqlDataReader read = new Diya().RowReader("select * from ConsultingInfo where Contactid=" + ViewState["Contactid"].ToString()))
            {
                read.Read();
                this.landinfo.Text = read["ChildrenCall"].ToString() + "的考试信息";
            }
            string Contactid = Session["Contactid_S"].ToString();
            string startTime = System.DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
            string endTime   = System.DateTime.Now.ToString("yyyy-MM-dd");
            this.MinTime.Value = startTime + " 00:00:00";
            this.MaxTime.Value = endTime + " 23:59:59";
            DataTable KnowledgePoints = new DataTable();
            DataTable Knowledgelest   = new DataTable();
            Knowledgelest.Columns.Add("KonwledgePointID");
            Knowledgelest.Columns.Add("Count");
            Knowledgelest.Columns.Add("Rights");
            using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
            {
                Sc.Open();
                MySqlDataAdapter da = new MySqlDataAdapter("Select TKRelationship.KnowledgePointID from TSRelationship inner join TTRelationship on TTRelationship.TestID=TSRelationship.TestID inner join TKRelationship on TKRelationship.TopicID=TTRelationship.TopicID inner join TestInfo on TSRelationship.TestID=TestInfo.TestID where TestInfo.TestStartTime Between '" + this.MinTime.Value + "' and '" + this.MaxTime.Value + "' and TSRelationship.Contactid=" + ViewState["Contactid"].ToString() + " order by TKRelationship.KnowledgePointID ", Sc);
                da.Fill(KnowledgePoints);
            }
            int Knowledgecount = 0;
            if (KnowledgePoints.Rows.Count != 0)
            {
                this.TestCount_div.Visible = true;
                this.Myhistory_Gw.Visible  = true;
                string KnowledgeIDFlage = KnowledgePoints.Rows[0][0].ToString();
                foreach (DataRow Dr in KnowledgePoints.Rows)
                {
                    if (Dr[0].ToString() == KnowledgeIDFlage)
                    {
                        Knowledgecount++;
                    }
                    else
                    {
                        Knowledgelest.Rows.Add(Knowledgelest.NewRow());
                        Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["Count"]            = Knowledgecount;
                        Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["KonwledgePointID"] = KnowledgeIDFlage;
                        Knowledgecount   = 1;
                        KnowledgeIDFlage = Dr[0].ToString();
                    }
                }
                KnowledgeIDFlage = KnowledgePoints.Rows[KnowledgePoints.Rows.Count - 1][0].ToString();
                Knowledgecount   = 0;
                for (int i = KnowledgePoints.Rows.Count - 1; i >= 0; i--)
                {
                    if (KnowledgePoints.Rows[i][0].ToString() == KnowledgeIDFlage)
                    {
                        Knowledgecount++;
                    }
                    else
                    {
                        Knowledgelest.Rows.Add(Knowledgelest.NewRow());
                        Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["Count"]            = Knowledgecount;
                        Knowledgelest.Rows[Knowledgelest.Rows.Count - 1]["KonwledgePointID"] = KnowledgeIDFlage;
                        break;
                    }
                }
                foreach (DataRow Dr in Knowledgelest.Rows)
                {
                    int Rights = 0;
                    using (MySqlDataReader read = new Diya().RowReader("Select Count(*) as a from TSRelationship inner join HTRelationship on HTRelationship.TSRelationshipID=TSRelationship.RelationshipID inner join TKRelationship on TKRelationship.TopicID=HTRelationship.TopicID inner join Options on Options.OptionID=HTRelationship.SelectedOptionID inner join TestInfo on TestInfo.TestID=TSRelationship.TestID where TestInfo.TestStartTime between '" + startTime + "' and '" + endTime + "' and TKRelationship.KnowledgePointID=" + Dr["KonwledgePointID"] + " and TSRelationship.Contactid=" + ViewState["Contactid"].ToString() + " and Options.IsTrue=1"))
                    {
                        read.Read();
                        Rights = read.GetInt32(0);
                    }
                    Dr["Rights"] = Rights;
                }

                DataSet Datasource = new DataSet();
                int     Colindex   = 0;
                for (int i = 0; i < Knowledgelest.Rows.Count; i++)
                {
                    if (i % 6 == 0)
                    {
                        Datasource.Tables.Add(new DataTable());
                        Colindex = 0;
                        //foreach (DataRow Dr in Knowledgelest.Rows)
                        //{
                        for (int j = i; j < i + 6 && j < Knowledgelest.Rows.Count; j++)
                        {
                            string KnowledgeName = "";
                            using (MySqlDataReader read = new Diya().RowReader("Select KnowledgePointName from KnowledgePoint where KnowledgePointID=" + Knowledgelest.Rows[j]["KonwledgePointID"]))
                            {
                                read.Read();
                                KnowledgeName = read["KnowledgePointName"].ToString();
                            }
                            Datasource.Tables[Datasource.Tables.Count - 1].Columns.Add(KnowledgeName);
                            //}
                        }
                        Datasource.Tables[Datasource.Tables.Count - 1].Rows.Add(Datasource.Tables[Datasource.Tables.Count - 1].NewRow());
                    }
                    double score = Convert.ToDouble(Knowledgelest.Rows[i]["Rights"]) / Convert.ToDouble(Knowledgelest.Rows[i]["Count"]);

                    Datasource.Tables[Datasource.Tables.Count - 1].Rows[0][Colindex++] = score.ToString("P") + "(" + Knowledgelest.Rows[i]["Rights"] + "/" + Knowledgelest.Rows[i]["Count"] + ")";
                }
                ViewState["GvIndex"]   = 0;
                ViewState["CountData"] = Datasource;
                this.Count.Columns.Clear();
                this.Count.DataSource = Datasource.Tables[0];
                this.Count.DataBind();
                string Selectcmd = "Select * from TSRelationship inner join TestInfo on TestInfo.Testid=TSRelationship.Testid where TSRelationship.Score is not null and TSRelationship.Contactid=" + ViewState["Contactid"] + " and TestInfo.TestStartTime Between '" + startTime + "' and '" + endTime + "' order by TSRelationship.RelationshipID DESC";
                ViewState["DataSource"] = new Diya().Gridviewbind(this.Myhistory_Gw, Selectcmd);
            }
            else
            {
                Literal Message = new Literal();
                Message.Text = "<script>alert('目前没有任何记录')</script>";
                this.Page.Controls.Add(Message);
                this.TestCount_div.Visible = false;
                this.Myhistory_Gw.Visible  = false;
            }
            BindWorngPageInfo();
            //    string Selectcmd = "Select * from TSRelationship inner join TestInfo on TestInfo.Testid=TSRelationship.Testid where TSRelationship.Score is not null and TSRelationship.Contactid=" + ViewState["Contactid"]+" order by TSRelationship.RelationshipID DESC";
            //ViewState["DataSource"] = Diya.Gridviewbind(this.Myhistory_Gw, Selectcmd);
        }
    }
Example #4
0
    private void BindQuizable(string testid, string TSRelationshipID)
    {
        string  HtmlText  = "";
        string  SelectCmd = "Select TTRelationship.RelationshipID,Topic.TopicID,Topic.TopicContent,Topic.HaveContent,Topic.MoreContent From TTRelationship inner join Topic on TTRelationship.TopicID=Topic.TopicID where TTRelationship.TestID=" + testid;
        DataSet TDs       = new DataSet();

        using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
        {
            Sc.Open(); MySqlDataAdapter Da = new MySqlDataAdapter(SelectCmd, Sc);
            Da.Fill(TDs);
            Sc.Close();
        }
        int testcount;

        using (MySqlDataReader read = new Diya().RowReader("Select TestCount from TestInfo where TestID=" + testid))
        {
            read.Read();
            testcount = read.GetInt32(0);
            read.Close();
        }
        QuizCount = testcount;
        DataTable Tdt = TDs.Tables[0];

        for (int i = 0; i < testcount; i++)
        {
            string Topic = UpdateEnter(Tdt.Rows[i]["TopicContent"].ToString());
            if (TDs.Tables[0].Rows[i]["HaveContent"].ToString() == "1")
            {
                Topic += UpdateEnter("\n" + Tdt.Rows[i]["MoreContent"].ToString());
            }
            DataSet ODs = new DataSet();
            using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
            {
                Sc.Open(); MySqlDataAdapter da = new MySqlDataAdapter("Select Options.OptionID,Options.OptionContent,Options.IsTrue From Options inner join OTRelationship on OTRelationship.OptionID=Options.OptionID Where OTRelationship.TTRelationshipID=" + Tdt.Rows[i]["RelationshipID"].ToString(), Sc);
                da.Fill(ODs);
                Sc.Close();
            }
            DataTable Odt = ODs.Tables[0];
            HtmlText = "<tr class=\"item_Quiz\"> <td style=\"text-align:left\"><label>" + (i + 1) + " ." + Topic + "</label></td></tr>";
            int j = 0;
            foreach (DataRow dr in Odt.Rows)
            {
                HtmlText += "<tr style=\"height:2%\"><td>&nbsp;</td></tr>";
                string div = "<div class=\"item_Options\" title=\"\"  id=\"" + dr["OptionID"] + "n\" >";
                using (MySqlDataReader read = new Diya().RowReader("select * From HTRelationship where SelectedOptionID=" + dr["OptionID"] + " and TSRelationshipID=" + TSRelationshipID))
                {
                    if (read.Read())
                    {
                        div = "<div style=\"border:2px solid red\">";
                    }
                }
                string input = "<input type=\"checkbox\" runat=\"server\" id=\"" + dr["OptionID"] + "\" onserverchange=\"test_ServerChange\" disabled=\"disabled\" style=\"border:1px solid Black\"/>";
                if (dr["IsTrue"].ToString() == "1")
                {
                    input = " <input type=\"checkbox\" id=\"" + dr["OptionID"] + "\" checked=\"checked\" disabled=\"disabled\" style=\"border:1px solid Black\"/>";
                }
                HtmlText += "<tr><td>" + div + input + Convert.ToChar(65 + j) + " ." + UpdateEnter(dr["OptionContent"].ToString()) + "</div></td></tr>";
                if (j == Odt.Rows.Count - 1)
                {
                    HtmlText += "<tr style=\"height:5%\"><td>&nbsp</td></tr>";
                }
                j++;
            }
            Dst.Addstate(HtmlText);
        }
    }