Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (MySqlConnection tsc = new MySqlConnection(Diya.ConectionString))
         {
             tsc.Open();
             MySqlCommand tcmd = new MySqlCommand();
             tcmd.Connection  = tsc;
             tcmd.CommandText = "update tsrelationship set Score=-1 where score=null";
         }
         string sqlcommand = "SELECT  name from sysobjects where xtype='U'";
         if (this.list != null)
         {
             this.list.ClearSelection();
             this.list.Items.Clear();
         }
         using (MySql.Data.MySqlClient.MySqlDataReader read = new Diya().RowReader(sqlcommand))
         {
             ListItem item = new ListItem("", "");
             item.Selected = true;
             this.list.Items.Add(item);
             while (read.Read())
             {
                 item = new ListItem(read["Name"].ToString(), read["Name"].ToString());
                 this.list.Items.Add(item);
             }
         }
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["UserInfo"] == null)
         {
             Response.Redirect("Consultion.aspx");
         }
         ViewState["UserID"] = Session["UserInfo"].ToString().Split(new char[] { '#' })[1];
         using (MySqlDataReader read = new Diya().RowReader("select * from Section"))
         {
             while (read.Read())
             {
                 this.SelectionBuf.Value += read["Section"] + "*" + read["SectionID"] + "$";
             }
             this.SelectionBuf.Value += "#";
         }
         using (MySqlDataReader read = new Diya().RowReader("Select * From Section"))
         {
             while (read.Read())
             {
                 using (MySqlDataReader Kread = new Diya().RowReader("select * From KnowledgePoint where SectionID=" + read["SectionID"]))
                 {
                     this.SelectionBuf.Value += read["SectionID"] + "$";
                     while (Kread.Read())
                     {
                         this.SelectionBuf.Value += Kread["KnowledgePointName"] + "*" + Kread["KnowledgePointID"] + "+";
                     }
                     this.SelectionBuf.Value += "%";
                 }
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (MySqlDataReader read = new Diya().RowReader("Select CourseName,CourseID from CourseInfo where CourseID!=0"))
         {
             while (read.Read())
             {
                 ListItem item = new ListItem(read["CourseName"].ToString(), read["CourseID"].ToString());
                 this.CouresInfo.Items.Add(item);
             }
             this.CouresInfo.Items[0].Selected = true;
         }
         using (MySqlDataReader read = new Diya().RowReader("Select ClassName ,Classid from classinfo where Courseid=" + this.CouresInfo.SelectedValue))
         {
             ListItem item = new ListItem("全部班级", "0");
             this.Classes.Items.Add(item);
             while (read.Read())
             {
                 item = new ListItem(read["ClassName"].ToString(), read["ClassID"].ToString());
                 this.Classes.Items.Add(item);
             }
         }
     }
 }
Beispiel #4
0
    protected void TestGw_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        System.Web.UI.HtmlControls.HtmlInputText TestStartTime = (System.Web.UI.HtmlControls.HtmlInputText) this.TestGw.Rows[e.RowIndex].FindControl("TestStartTime");
        System.Web.UI.HtmlControls.HtmlInputText TestEndTime   = (System.Web.UI.HtmlControls.HtmlInputText) this.TestGw.Rows[e.RowIndex].FindControl("TestEndTime");
        Label id = (Label)this.TestGw.Rows[e.RowIndex].FindControl("TestID");

        using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
        {
            Sc.Open();
            string       updatestring = "Update TestInfo Set TestStartTime='" + TestStartTime.Value + "',TestEndTime='" + TestEndTime.Value + "' where TestID=" + id.Text;
            MySqlCommand Scmd         = new MySqlCommand(updatestring, Sc);
            Scmd.ExecuteNonQuery();
        }
        using (MySqlDataReader read = new Diya().RowReader("select ContactID From TSRelationship where TestID=" + id.Text))
        {
            while (read.Read())
            {
                using (MySqlConnection Scin = new MySqlConnection(Diya.ConectionString))
                {
                    Scin.Open();
                    MySqlCommand Scmd = new MySqlCommand("insert into TSRelationship(TestID,ContactID,Score)Values(" + id.Text + "," + read["ContactID"] + "," + "null)", Scin);
                    Scmd.ExecuteNonQuery();
                }
            }
        }
    }
Beispiel #5
0
 protected void Cnfirm_Click(object sender, EventArgs e)
 {
     using (MySql.Data.MySqlClient.MySqlDataReader read = new Diya().RowReader("select * From ConsultingInfo where Contactid=" + this.UserID.Text))
     {
         if (read.Read())
         {
             Session["LandInfo"] = this.UserID.Text;
             Response.Redirect("ObjectTest.aspx");
         }
     }
 }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.KnowledgePointInfo.RepeatColumns = 10;
     this.SectionInfo.RepeatColumns        = 10;
     if (!IsPostBack)
     {
         if (Session["UserInfo"] == null)
         {
             Response.Redirect("Consultion.aspx");
         }
         ListItem Item;
         Item = new ListItem("全部章节", "0");
         //Item.Selected = true;
         this.SectionInfo.Items.Add(Item);
         using (MySqlDataReader read = new Diya().RowReader("Select * From Section"))
         {
             while (read.Read())
             {
                 Item          = new ListItem(read["Section"].ToString(), read["SectionID"].ToString());
                 Item.Selected = true;
                 this.SectionInfo.Items.Add(Item);
             }
         }
         Item = new ListItem("全部知识点", "0");
         this.KnowledgePointInfo.Items.Add(Item);
         using (MySqlDataReader read = new Diya().RowReader("Select KnowledgePointID,KnowledgePointName from KnowledgePoint"))
         {
             while (read.Read())
             {
                 Item = new ListItem(read["KnowledgePointName"].ToString(), read["KnowledgePointID"].ToString());
                 this.KnowledgePointInfo.Items.Add(Item);
             }
         }
         if (Request["Mode"] == "Up")
         {
             this.SectionInfo.Visible        = false;
             this.KnowledgePointInfo.Visible = false;
             this.TestCount.Enabled          = false;
             this.TextScore.Enabled          = false;
             this.TestName.Enabled           = false;
             ViewState["id"]      = Session["TestID_Up"];
             Session["TestID_Up"] = null;
             using (MySqlDataReader read = new Diya().RowReader("Select * From TestInfo where TestID=" + ViewState["id"]))
             {
                 read.Read();
                 this.TestName.Text       = read["TestName"].ToString();
                 this.TestStartDate.Value = read["TestStartTime"].ToString();
                 this.TestEndDate.Value   = read["TestEndTime"].ToString();
             }
         }
     }
 }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)//ÐèÒªSession[ClassInfo_id];ÐèÒªMode:Edit;Add ViewStat[Classid]
 {
     if (!IsPostBack)
     {
         if (Session["UserInfo"] == null)
         {
             if (Request.Cookies["UserConfig"] == null)
             {
                 Response.Redirect("Login.aspx");
             }
         }
         using (MySql.Data.MySqlClient.MySqlDataReader read = new Diya().RowReader("Select * from CourseInfo"))
         {
             while (read.Read())
             {
                 ListItem item = new ListItem(read["CourseName"].ToString(), read["Courseid"].ToString());
                 this.CourseInfo_Drop.Items.Add(item);
             }
         }
         if (Request["Mode"] == "Edit")
         {
             ViewState["Classid"]    = Session["ClassInfo_id"];
             Session["ClassInfo_id"] = null;
             string SelectCmd = "select * from classinfo Where Classid=" + ViewState["Classid"];
             using (MySql.Data.MySqlClient.MySqlDataReader read = new Diya().RowReader(SelectCmd))
             {
                 read.Read();
                 this.OpenAnAccount.Value   = read["OpenAnAccount"].ToString();
                 this.ClassName.Value       = read["ClassName"].ToString();
                 this.ClassTime.Value       = read["ClassTime"].ToString();
                 this.WEEK.Value            = read["Week"].ToString();
                 this.RemainingNumber.Value = read["RemainingNumber"].ToString();
                 foreach (ListItem item in this.CourseInfo_Drop.Items)
                 {
                     if (item.Value == read["Courseid"].ToString())
                     {
                         item.Selected = true;
                         break;
                     }
                 }
                 if (read["MF"].ToString() == "0")
                 {
                     this.MF_Dorp.SelectedIndex = 0;
                 }
                 else
                 {
                     this.MF_Dorp.SelectedIndex = 1;
                 }
             }
         }
     }
 }
Beispiel #8
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);
    }
Beispiel #9
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Select")
     {
         this.GridView1.Columns[0].Visible = false;
         if (ViewState["AddStudent"] != null)
         {
             ViewState["AddStudent"] = null;
             Session["ClassID_A"]    = e.CommandArgument;
             Response.Redirect("AllocationStudent.aspx");
         }
         else
         {
             Session["ClassInfo_id"] = e.CommandArgument;
             Response.Redirect("EditClassInfo.aspx?Mode=Edit");
         }
     }
     else if (e.CommandName == "Delete")
     {
         using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
         {
             Sc.Open();
             string       DelCmd = "Delete From CSrelationship where Classid=" + e.CommandArgument;
             MySqlCommand Scmd   = new MySqlCommand(DelCmd, Sc);
             Scmd.ExecuteNonQuery();
         }
         using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
         {
             Sc.Open();
             string       DelCmd = "Delete From classinfo where Classid=" + e.CommandArgument;
             MySqlCommand Scmd   = new MySqlCommand(DelCmd, Sc);
             Scmd.ExecuteNonQuery();
         }
         hidealluntil();
         this.ClassInfo_Div.Visible       = true;
         ViewState["ClassInfoDataScouce"] = new Diya().Gridviewbind(this.GridView1, "Select * From classinfo inner join CourseInfo on CourseInfo.Courseid=classinfo.Courseid where Classid!=" + 0);
         this.ClassInfo.ClearSelection();
         this.ClassInfo.Items.Clear();
         ListItem item = new ListItem("全部班级", "0");
         item.Selected = true;
         using (MySqlDataReader read = new Diya().RowReader("Select ClassID,ClassName From classinfo order by ClassID asc"))
         {
             while (read.Read())
             {
                 item = new ListItem(read["ClassName"].ToString(), read["ClassID"].ToString());
                 this.ClassInfo.Items.Add(item);
             }
         }
     }
 }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         hidealluntile();
         if (Session["UserInfo"] == null)
         {
             Response.Redirect("Consultion.aspx");
         }
         if (Session["DataScoure_TIA"] == null)
         {
             ViewState["PageIndex_Q"] = 0;
             TIAT tiat = new TIAT();
             tiat.Dst.Clear();
             Quiz_Table_B = tiat.Quizeloader(Session["TestID"].ToString(), 2, 0 + 1, Session["TSRelationshipID"].ToString());
             QuizabelDataBound(tiat);
             using (MySql.Data.MySqlClient.MySqlDataReader read = new Diya().RowReader("select * from TestInfo where TestID=" + Session["TestID"]))
             {
                 read.Read();
                 this.TestInfo_Titel.Text = read["TestName"].ToString();
                 this.Title = read["TestName"].ToString();
             }
             Session["TestID"] = null;
             if (Session["Contactid_S"] != null)
             {
                 ViewState["Contactid"] = Session["Contactid_S"];
                 Session["Contactid_S"] = null;
             }
             ViewState["TIAT"]      = tiat;
             this.TitaPager.Visible = true;
         }
         else
         {
             if (Session["Contactid_S"] != null)
             {
                 ViewState["Contactid"] = Session["Contactid_S"];
                 Session["Contactid_S"] = null;
             }
             ViewState["PageIndex_QW"] = 0;
             TIAT tiat = new TIAT();
             tiat.Dst.Clear();
             Quiz_Table_B = tiat.Quizeloader(20, 0 + 1, Session["DataScoure_TIA"].ToString());
             Quiz_WDataBound(tiat);
             ViewState["TIAT"]        = tiat;
             this.TitaPager_w.Visible = true;
             ViewState["DataCommand"] = Session["DataScoure_TIA"].ToString();
         }
     }
 }
 protected void CouresInfo_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.Classes.ClearSelection();
     this.Classes.Items.Clear();
     using (MySqlDataReader read = new Diya().RowReader("Select ClassName ,ClassID from classinfo where CourseID=" + this.CouresInfo.SelectedValue))
     {
         ListItem item = new ListItem("全部班级", "0");
         this.Classes.Items.Add(item);
         while (read.Read())
         {
             item = new ListItem(read["ClassName"].ToString(), read["ClassID"].ToString());
             this.Classes.Items.Add(item);
         }
     }
 }
Beispiel #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["UserInfo"] == null)
         {
             if (Request.Cookies["UserConfig"] == null)
             {
                 Response.Redirect("Consultion.aspx");
             }
             else
             {
                 HttpCookie cookie = Request.Cookies["UserConfig"];
                 Session["UserInfo"] = Server.HtmlEncode(new Diya().GetDESDecrypt(cookie.Value));
             }
         }
         string[] Info = Session["UserInfo"].ToString().Split(new char[] { '#' });
         Diya.GetUserInfo(Convert.ToInt32(Info[0]), Info[1], Info[2]);
         this.UserInfoTitel.Text  = Info[2];
         ViewState["ClassID"]     = Session["ClassID_A"];
         Session["ClassID_A"]     = null;
         ViewState["StudentInfo"] = new Diya().Gridviewbind(this.GW1, "Select * from ConsultingInfo");
         using (MySqlDataReader read = new Diya().RowReader("Select * From classinfo  where classinfo.Classid=" + ViewState["ClassID"]))
         {
             read.Read();
             this.ClassName_Label.Text = read["ClassName"].ToString();
         }
         DataTable Dt = new DataTable();
         for (int i = 0; i < this.GW1.Rows.Count; i++)
         {
             DataColumn Dc = new DataColumn(Convert.ToString(i) + "#");
             Dc.DefaultValue = "0";
             Dt.Columns.Add(Dc);
         }
         for (int i = 0; i < this.GW1.PageCount; i++)
         {
             Dt.Rows.Add(Dt.NewRow());
         }
         ViewState["Selection"] = Dt;
     }
 }
Beispiel #13
0
    protected void doBuf(string MouldId)
    {
        using (MySqlDataReader read = new Diya().RowReader("select * from Section"))
        {
            while (read.Read())
            {
                this.SelectionBuf.Value += read["Section"] + "*" + read["SectionID"] + "$";
            }
            this.SelectionBuf.Value += "#";
        }
        using (MySqlDataReader read = new Diya().RowReader("Select * From Section"))
        {
            while (read.Read())
            {
                using (MySqlDataReader Kread = new Diya().RowReader("select * From KnowledgePoint where SectionID=" + read["SectionID"]))
                {
                    this.SelectionBuf.Value += read["SectionID"] + "$";
                    while (Kread.Read())
                    {
                        this.SelectionBuf.Value += Kread["KnowledgePointName"] + "*" + Kread["KnowledgePointID"] + "+";
                    }
                    this.SelectionBuf.Value += "%";
                }
            }
        }
        DataTable MouldTb = new DataTable();

        using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
        {
            Sc.Open();
            MySqlDataAdapter da = new MySqlDataAdapter("Select * From TestMouldInfo inner join MKRelationship on MKRelationship.MouldID=TestMouldInfo.MouldID inner join KnowledgePoint on KnowledgePoint.KnowledgePointID=MKRelationship.KnowledgePointID inner join Section on Section.SectionID=KnowledgePoint.SectionID where TestMouldInfo.Userid='" + ViewState["UserID"] + "' and TestMouldInfo.MouldID=" + MouldId, Sc);
            da.Fill(MouldTb);
        }
        foreach (DataRow dr in MouldTb.Rows)
        {
            this.ReturnBuf.Value  += dr["KnowledgePointID"].ToString() + "#";
            this.SurfaceBuf.Value += dr["Section"].ToString() + "$" + dr["KnowledgePointName"].ToString() + "#";
        }
    }
Beispiel #14
0
 protected void TestMouldGV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "More")
     {
         ViewState["MouldID"]    = e.CommandArgument;
         this.SurfaceBuf.Value   = "";
         this.ReturnBuf.Value    = "";
         this.SelectionBuf.Value = "";
         doBuf(e.CommandArgument.ToString());
         this.Sigen.Value       = "1";
         this.MouldView.Visible = true;
         using (MySqlDataReader read = new Diya().RowReader("select * from TestMouldInfo where MouldID=" + e.CommandArgument.ToString()))
         {
             read.Read();
             this.TestName.Value = read["MouldName"] + "";
         }
         //Literal startScript = new Literal();
         //startScript.Text = "<script>document.onreadystatechange = function () {if (document.readyState ==\"complete\") { CreateRow() }}</script>";
         //this.Page.Controls.Add(startScript);
         ClientScript.RegisterStartupScript(ClientScript.GetType(), "StartScript", "<script>CreateRow();CreateNewRow();Finddivs();</script>");
     }
     else if (e.CommandName == "Delete")
     {
         using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
         {
             Sc.Open();
             MySqlCommand Scmd = new MySqlCommand("delete From MKRelationship where MouldID=" + e.CommandArgument, Sc);
             Scmd.ExecuteNonQuery();
             Scmd.CommandText = "Delete Form TestMouldInfo where MouldID=" + e.CommandArgument;
             Scmd.ExecuteNonQuery();
             ViewState["TestMouldInfo"] = new Diya().Gridviewbind(this.TestMouldGV, "select * from TestMouldInfo where Userid='" + ViewState["UserID"] + "'");
         }
     }
     else if (e.CommandName == "ToTest")
     {
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["UserInfo"] != null)
         {
             using (MySqlDataReader read = new Diya().RowReader("Select * From classinfo Where Classid!=0"))
             {
                 while (read.Read())
                 {
                     ListItem item = new ListItem(read["ClassName"].ToString(), read["Classid"].ToString());
                     this.ClassInfo_Dorp.Items.Add(item);
                 }
             }
             string[] Info = Session["UserInfo"].ToString().Split(new char[] { '#' });
             Diya.GetUserInfo(Convert.ToInt32(Info[0]), Info[1], Info[2]);
             this.landinfo.Text = Info[2];
             if (Request["Mode"] == "Add")
             {
                 ListItem[] items = new ListItem[2];
                 items[0] = new ListItem("男", "1");
                 items[1] = new ListItem("女", "0");
                 this.Sex.Items.AddRange(items);
                 using (MySqlDataReader read = new Diya().RowReader("Select Canalid,CanalName From CanalInfo"))
                 {
                     while (read.Read())
                     {
                         ListItem item = new ListItem(read["CanalName"].ToString(), read["Canalid"].ToString());
                         this.Cannel.Items.Add(item);
                     }
                 }
             }
             else
             {
                 this.ClassInfo_Dorp.Enabled = false;//目前还没有很好的方法去更新CSRelationship表,先禁用之
                 string _id = Request["Mode"];
                 string id  = Session["ConEditInfo"].ToString();
                 ViewState["UpdateID"]  = id;
                 Session["ConEditInfo"] = null;
                 using (MySqlDataReader read = new Diya().RowReader("Select * From ConsultingInfo where Contactid=" + id))
                 {
                     read.Read();
                     this.Children_Call.Value = read["ChildrenCall"].ToString();
                     this.Parent_Call.Value   = read["ParentsCall"].ToString();
                     this.Age.Value           = read["ChildrenAge"].ToString();
                     this.ClassLV.Value       = read["ClassLv"].ToString();
                     this.Sex.Items.Add(new ListItem("男", "男"));
                     this.Sex.Items.Add(new ListItem("女", "女"));
                     if (read["ChildrenSex"].ToString() == "男")
                     {
                         this.Sex.SelectedIndex = 0;
                     }
                     else
                     {
                         this.Sex.SelectedIndex = 1;
                     }
                     this.School.Value  = read["School"].ToString();
                     this.Contact.Value = read["Contact"].ToString();
                     this.arrive.Value  = read["ReceptionTime"] == DBNull.Value ? "" : read["ReceptionTime"].ToString();
                     string Canalid = read["Canalid"].ToString();
                     using (MySqlDataReader Cread = new Diya().RowReader("select * from CanalInfo"))
                     {
                         while (Cread.Read())
                         {
                             ListItem item = new ListItem(Cread["CanalName"].ToString(), Cread["Canalid"].ToString());
                             if (item.Value == Canalid)
                             {
                                 item.Selected = true;
                             }
                             this.Cannel.Items.Add(item);
                         }
                     }
                     this.remark.Text = read["Remarks"].ToString();
                 }
             }
         }
     }
 }
    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;
        }
    }
    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);
        }
    }
Beispiel #18
0
    protected void Confirm_Click(object sender, EventArgs e)
    {
        //this.PlaseWait.Visible = true;
        if (Request["Mode"] != "Up")
        {
            string SelectT_idCmd = "Select TopicID From TKRelationship where 1>0";
            string Score         = this.TextScore.Text == "" ? "1" : this.TextScore.Text;
            string Err           = "";
            if (this.TestName.Text == "")
            {
                Err += "考试名称不能为空";
            }
            if (!new Diya().checktext("N", this.TextScore.Text))
            {
                Err += "<br>考试分值只能是数字";
                this.TextScore.ForeColor = System.Drawing.Color.Red;
            }
            if (!new Diya().checktext("N", this.TestCount.Text))
            {
                Err += "<br>考题数量只能是数字";
                this.TestCount.ForeColor = System.Drawing.Color.Red;
            }
            if (Err == "")
            {
                using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                {
                    Sc.Open();
                    MySqlCommand Scmd = new MySqlCommand("Insert Into TestInfo(TestName,TestCount,TopicScore,TestStartTime,TestEndTime) values('" + this.TestName.Text + "'," + this.TestCount.Text + "," + this.TextScore.Text + ",'" + this.TestStartDate.Value + "','" + this.TestEndDate.Value + "')", Sc);
                    Scmd.ExecuteNonQuery();
                }
                string TestID = "";
                using (MySqlDataReader read = new Diya().RowReader("select max(TestID) as a From TestInfo"))
                {
                    read.Read();
                    TestID = read["a"].ToString();
                }
                if (this.KnowledgePointInfo.Items[0].Selected)
                {
                    for (int i = 1; i < KnowledgePointInfo.Items.Count; i++)
                    {
                        SelectT_idCmd += " or KnowledgePointID=" + this.KnowledgePointInfo.Items[i].Value;
                        //using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                        //{
                        //    Sc.Open();
                        //    MySqlCommand Scmd = new MySqlCommand("insert into TTRelationship(TestID,KnowledgePointID) values("+TestID+","+this.KnowledgePointInfo.Items[i].Value+")", Sc);
                        //    Scmd.ExecuteNonQuery();
                        //}
                    }
                }
                else
                {
                    for (int i = 1; i < this.KnowledgePointInfo.Items.Count; i++)
                    {
                        if (this.KnowledgePointInfo.Items[i].Selected)
                        {
                            SelectT_idCmd += " or KnowledgePointID=" + this.KnowledgePointInfo.Items[i].Value;
                            //using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                            //{
                            //    Sc.Open();
                            //    MySqlCommand Scmd = new MySqlCommand("insert into TTRelationship(TestID,KnowledgePointID) values(" + TestID + "," + this.KnowledgePointInfo.Items[i].Value + ")", Sc);
                            //    Scmd.ExecuteNonQuery();
                            //}
                        }
                    }
                }
                using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                {
                    Sc.Open();
                    MySqlDataAdapter Da = new MySqlDataAdapter(SelectT_idCmd, Sc);
                    DataSet          Ds = new DataSet();
                    Da.Fill(Ds);
                    int TopicCount = Ds.Tables[0].Rows.Count;
                    int count      = Convert.ToInt32(this.TestCount.Text);
                    if (count > Ds.Tables[0].Rows.Count)
                    {
                        count = Ds.Tables[0].Rows.Count;
                        //
                        using (MySqlConnection Sc_Up = new MySqlConnection(Diya.ConectionString))
                        {
                            Sc_Up.Open();
                            MySqlCommand Scmd_Up = new MySqlCommand("Update TestInfo set TestCount=" + count + " where TestID=" + TestID, Sc_Up);
                            Scmd_Up.ExecuteNonQuery();
                        }
                    }
                    int[] randomindexes = new int[count];
                    new TIA().RandomArray(randomindexes, TopicCount);
                    for (int i = 0; i < count; i++)
                    {
                        using (MySqlConnection Scin = new MySqlConnection(Diya.ConectionString))
                        {
                            Scin.Open();
                            MySqlCommand Scmd = new MySqlCommand("insert into TTRelationship(TestID,TopicID)values(" + TestID + "," + Ds.Tables[0].Rows[randomindexes[i]]["TopicID"] + ")", Scin);
                            Scmd.ExecuteNonQuery();
                        }
                        string TTRelationship_id = "";
                        using (MySqlDataReader read = new Diya().RowReader("select max(RelationshipID) as id from TTRelationship"))//获取新生成的relationshipid
                        {
                            read.Read();
                            TTRelationship_id = read["id"].ToString();
                        }
                        DataSet ODS = new DataSet();
                        using (MySqlConnection Scin = new MySqlConnection(Diya.ConectionString))//获取相应的选项id
                        {
                            Scin.Open();
                            MySqlDataAdapter da = new MySqlDataAdapter("Select OptionID From Options where TopicID=" + Ds.Tables[0].Rows[randomindexes[i]]["TopicID"], Scin);

                            da.Fill(ODS);
                        }
                        int[] Optidsindex = new int[ODS.Tables[0].Rows.Count];
                        new TIA().RandomArray(Optidsindex, Optidsindex.Length);
                        for (int j = 0; j < Optidsindex.Length; j++)
                        {
                            using (MySqlConnection Scin = new MySqlConnection(Diya.ConectionString))
                            {
                                Scin.Open();
                                MySqlCommand Scmd = new MySqlCommand("insert into OTRelationship(TTRelationshipID,OptionID) values (" + TTRelationship_id + "," + ODS.Tables[0].Rows[Optidsindex[j]]["OptionID"] + ")", Scin);
                                Scmd.ExecuteNonQuery();
                            }
                        }
                    }
                }
            }
            else
            {
            }
        }
        else
        {
            using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
            {
                Sc.Open();
                string       updatestring = "Update TestInfo Set TestStartTime='" + this.TestStartDate.Value + "',TestEndTime='" + this.TestEndDate.Value + "' where TestID=" + ViewState["id"];
                MySqlCommand Scmd         = new MySqlCommand(updatestring, Sc);
                Scmd.ExecuteNonQuery();
            }
            using (MySqlDataReader read = new Diya().RowReader("select ContactID From TSRelationship where TestID=" + ViewState["id"]))
            {
                while (read.Read())
                {
                    using (MySqlConnection Scin = new MySqlConnection(Diya.ConectionString))
                    {
                        Scin.Open();
                        MySqlCommand Scmd = new MySqlCommand("insert into TSRelationship(TestID,ContactID,Score)Values(" + ViewState["id"] + "," + read["ContactID"] + "," + "1)", Scin);
                        Scmd.ExecuteNonQuery();
                    }
                }
            }
        }
        Session["TheScene"] = "6";
        Response.Redirect("Consultion.aspx");
    }
Beispiel #19
0
    protected void Done_Click(object sender, EventArgs e)
    {
        string userid = this.Userid.Value;

        if (this.Userid.Value != "" && this.OldPassword.Value != "")
        {
            string selectcmd = "";
            if (new Diya().checktext("N", this.Userid.Value))
            {
                selectcmd = "Select * from ConsultingInfo where Contactid=" + this.Userid.Value + " and Password='******'";
                using (MySqlDataReader read = new Diya().RowReader(selectcmd))
                {
                    if (read.Read())
                    {
                        if (this.NewPasssword.Value != "")
                        {
                            if (this.NewPasssword.Value == this.CNewPssword.Value)
                            {
                                using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                                {
                                    Sc.Open();
                                    MySqlCommand Scmd = new MySqlCommand("Update ConsultingInfo set Password='******' where Contactid=" + userid, Sc);
                                    Scmd.ExecuteNonQuery();
                                    Response.Redirect("Login.aspx");
                                }
                            }
                            else
                            {
                                this.ConPassordError.Text    = "Your new Password is not confirmation";
                                this.ConPassordError.Visible = true;
                            }
                        }
                        else
                        {
                            this.ConPassordError.Text    = "Please enter your new passworld";
                            this.ConPassordError.Visible = true;
                        }
                    }
                    else
                    {
                        this.errorOldPasss.Text    = "Worng Passworld or UserID";
                        this.errorOldPasss.Visible = true;
                    }
                }
            }
            else
            {
                selectcmd = "select UserID ,UserName, UserType from UserInfo0 where Userid='" + this.Userid.Value + "'and Password='******'";
                using (MySqlDataReader read = new Diya().RowReader(selectcmd))
                {
                    if (read.Read())
                    {
                        if (this.NewPasssword.Value != "")
                        {
                            if (this.NewPasssword.Value == this.CNewPssword.Value)
                            {
                                using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                                {
                                    Sc.Open();
                                    MySqlCommand Scmd = new MySqlCommand("Update UserInfo0 set Password='******' where UserID='" + userid + "'", Sc);
                                    Scmd.ExecuteNonQuery();
                                    Response.Redirect("Login.aspx");
                                }
                            }
                            else
                            {
                                this.ConPassordError.Text    = "Your new Password is not confirmation";
                                this.ConPassordError.Visible = true;
                            }
                        }
                        else
                        {
                            this.ConPassordError.Text    = "Please enter your new passworld";
                            this.ConPassordError.Visible = true;
                        }
                    }
                    else
                    {
                        this.errorOldPasss.Text    = "Worng Passworld or UserID";
                        this.errorOldPasss.Visible = true;
                    }
                }
            }
        }
    }
Beispiel #20
0
    protected void SectionInfo_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.KnowledgePointInfo != null)
        {
            this.KnowledgePointInfo.ClearSelection();
            this.KnowledgePointInfo.Items.Clear();
        }
        if (this.SectionInfo.Items[0].Selected)
        {
            for (int i = 1; i < this.SectionInfo.Items.Count; i++)
            {
                this.SectionInfo.Items[i].Enabled = false;
            }

            ListItem Item = new ListItem("全部知识点", "0");
            this.KnowledgePointInfo.Items.Add(Item);
            using (MySqlDataReader read = new Diya().RowReader("Select KnowledgePointID,KnowledgePointName from KnowledgePoint"))
            {
                while (read.Read())
                {
                    Item = new ListItem(read["KnowledgePointName"].ToString(), read["KnowledgePointID"].ToString());
                    this.KnowledgePointInfo.Items.Add(Item);
                }
            }
        }
        else
        {
            ListItem Item = new ListItem("全部知识点", "0");
            this.KnowledgePointInfo.Items.Add(Item);
            int i = 0;
            for (int j = 1; j < this.SectionInfo.Items.Count; j++)
            {
                this.SectionInfo.Items[j].Enabled = true;
            }
            for (i = 1; i < SectionInfo.Items.Count; i++)
            {
                if (SectionInfo.Items[i].Selected)
                {
                    string cmd = "Select KnowledgePointID,KnowledgePointName from KnowledgePoint where SectionID=" + SectionInfo.Items[i].Value;
                    using (MySqlDataReader read = new Diya().RowReader(cmd))
                    {
                        while (read.Read())
                        {
                            ListItem item = new ListItem(read["KnowledgePointName"].ToString(), read["KnowledgePointID"].ToString());
                            this.KnowledgePointInfo.Items.Add(item);
                        }
                    }
                }
            }


            //using (MySqlDataReader read = Diya.RowReader(Kcomd))
            //{
            //    while (read.Read())
            //    {
            //        Item = new ListItem(read["KnowledgePointName"].ToString(), read["KnowledgePointID"].ToString());
            //        this.KnowledgePointInfo.Items.Add(Item);
            //    }
            //}
        }
    }
Beispiel #21
0
        protected void buuton1_Click(object sender, EventArgs e)
        {
            if (!new Diya().checktext("N", this.UserId_text.Value))
            {
                try
                {
                    Diya diay = new Diya();
                    using (MySqlDataReader read = new Diya().RowReader("select UserID ,UserName, UserType from UserInfo0 where Userid='" + this.UserId_text.Value + "'and Password='******'"))
                    {
                        bool login = read.Read();
                        if (login && diay.GetMD5Text(this.VerificationCode.Value) == Session["Code"].ToString())
                        {
                            //this.AuthCode1.ClearSession();
                            //this.AuthCode1.NextImgText = "Next picture";
                            Session["UserInfo"] = read["UserType"].ToString() + '#' + read["UserID"].ToString() + '#' + read["UserName"].ToString();

                            Response.Redirect("Consultion.aspx");
                        }
                        else
                        {
                            // this.AuthCode1.ClearSession();
                            if (!login)
                            {
                                Literal MeGTex = new Literal();
                                MeGTex.Text = "<script>alert('Óû§Ãû»òÃÜÂë´íÎó'); </script>";
                                Page.Controls.Add(MeGTex);
                            }
                            else
                            {
                                Literal MeGTex = new Literal();
                                MeGTex.Text = "<script>alert('ÑéÖ¤Âë´íÎó');GreatCaptcha();</script>";
                                Page.Controls.Add(MeGTex);
                            }
                        }
                    }
                }
                catch (Exception err)
                {
                    Literal MeGTex = new Literal();
                    MeGTex.Text = "<script>alert('" + err.Message + "');</script>";
                    Page.Controls.Add(MeGTex);
                }
            }
            else if (new Diya().checktext("N", this.UserId_text.Value))
            {
                try
                {
                    Diya diya = new Diya();
                    using (MySqlDataReader read = new Diya().RowReader("select * From ConsultingInfo where Contactid=" + this.UserId_text.Value + " and Password='******'"))
                    {
                        bool Connect = read.Read();
                        if (Connect && diya.GetMD5Text(this.VerificationCode.Value) == Session["Code"].ToString())
                        {
                            // this.AuthCode1.ClearSession();
                            // this.AuthCode1.NextImgText="Next picture";
                            Session["LandInfo"] = this.UserId_text.Value;
                            if (Session["Disabled"] == null)
                            {
                                Response.Redirect("ObjectTest50.aspx");
                            }
                            else
                            {
                                Literal MegText = new Literal();
                                MegText.Text = "<script>alert('ÍøÕ¾ÕýÔÚά»¤');GreatCaptcha(); </script>";
                                Page.Controls.Add(MegText);
                                Response.Write(MegText);
                                //Page.Controls.AddAt(Page.Controls.Count - 1, MegText);
                            }
                        }
                        else
                        {
                            // this.AuthCode1.ClearSession();
                            //this.AuthCode1.NextImgText = "Next picture";
                            if (!Connect)
                            {
                                Literal MeGTex = new Literal();
                                MeGTex.Text = "<script>alert('Óû§Ãû»òÃÜÂë´íÎó'); </script>";
                                Page.Controls.Add(MeGTex);
                            }
                            else
                            {
                                Literal MeGTex = new Literal();
                                MeGTex.Text = "<script>alert('ÑéÖ¤Âë´íÎó');GreatCaptcha(); </script>";
                                Page.Controls.Add(MeGTex);
                            }
                        }
                    }
                }
                catch (Exception err)
                {
                    Literal MegTex = new Literal();
                    MegTex.Text = "<script> alert('" + err.Message + "');</script>";
                    Page.Controls.Add(MegTex);
                }
            }
        }
Beispiel #22
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);
        }
    }
Beispiel #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //ViewState=Consultion_Info
        if (!IsPostBack)
        {
            if (Session["UserInfo"] == null)
            {
                if (Request.Cookies["UserConfig"] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    HttpCookie cookie = Request.Cookies["UserConfig"];
                    Diya       diya   = new Diya();
                    Session["UserInfo"] = Server.HtmlEncode(diya.GetDESDecrypt(cookie.Value));
                }
            }
            if (Session["TheScene"] != null)
            {
                switch (Convert.ToInt32(Session["TheScene"].ToString()))
                {
                case 1: BindScene1();
                    break;

                case 2: BindScene2();
                    break;

                case 3: BindScene3();
                    break;

                case 4: BindScene4();
                    break;

                case 5: BindScene5();
                    break;

                case 6: BindScene6();
                    break;

                case 7: BindScene7();
                    break;

                default:
                    break;
                }
                Session["TheScene"] = null;
            }
            string[] Info = Session["UserInfo"].ToString().Split(new char[] { '#' });
            Diya.GetUserInfo(Convert.ToInt32(Info[0]), Info[1], Info[2]);
            this.landinfo.Text           = Info[2];
            ViewState["Consultion_Info"] = new Diya().Gridviewbind(this.Consultion, "Select ChildrenCall,ParentsCall,Contact,Contactid from ConsultingInfo ");
            if (this.ClassInfo != null)
            {
                ClassInfo.ClearSelection();
                ClassInfo.Items.Clear();
            }
            ListItem item = new ListItem("全部班级", "0");
            item.Selected = true;
            MySqlDataReader read = new Diya().RowReader("Select ClassID,ClassName From classinfo order by ClassID asc");
            while (read.Read())
            {
                item = new ListItem(read["ClassName"].ToString(), read["ClassID"].ToString());
                this.ClassInfo.Items.Add(item);
            }
        }
    }