示例#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);
             }
         }
     }
 }
示例#2
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));
                }
            }
            string[] Info = Session["UserInfo"].ToString().Split(new char[] { '#' });
            Diya.GetUserInfo(Convert.ToInt32(Info[0]), Info[1], Info[2]);
            this.landinfo.Text         = Info[2];
            ViewState["UserID"]        = Info[1];
            ViewState["TestMouldInfo"] = new Diya().Gridviewbind(this.TestMouldGV, "select * from TestMouldInfo where Userid='" + ViewState["UserID"] + "' order by  MouldID desc");

            if (this.TestMouldGV.Rows.Count == 0)
            {
                this.TestMouldGV.Visible = false;
                this.NullData.Visible    = true;
            }
            else
            {
                this.TestMouldGV.Visible = true;
                this.NullData.Visible    = false;
            }
        }
    }
示例#3
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);
             }
         }
     }
 }
示例#5
0
 protected void My_Test_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
         {
             Sc.Open();
             string       DeleteCmd = "Delete From HTRelationship Where TSRelationshipID=" + e.CommandArgument;
             MySqlCommand Scmd      = new MySqlCommand(DeleteCmd, Sc);
             Scmd.ExecuteNonQuery();
         }
         using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
         {
             Sc.Open();
             string       DeleCmd = "Delete From TSRelationship Where RelationshipID=" + e.CommandArgument;
             MySqlCommand Scmd    = new MySqlCommand(DeleCmd, Sc);
             Scmd.ExecuteNonQuery();
         }
         string Selectcmd = "Select * from TSRelationship inner join TestInfo on TestInfo.Testid=TSRelationship.Testid where TSRelationship.Score is not null and TSRelationship.Contactid=" + ViewState["Contactid"].ToString();
         ViewState["DataSource"] = new Diya().Gridviewbind(this.Myhistory_Gw, Selectcmd);
     }
     else if (e.CommandName != "Page")
     {
         Session["TestID"]           = e.CommandArgument;
         Session["TSRelationshipID"] = e.CommandName;
         Session["Contactid_S"]      = ViewState["Contactid"];
         Response.Redirect("TestInfo_detailed.aspx");
     }
 }
示例#6
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();
                }
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string Selectcomd = "Select * from Topic";
         ViewState["TopicInfoData"] = new Diya().Gridviewbind(this.Topic_Gw, Selectcomd);
     }
 }
示例#8
0
        //[AjaxPro.AjaxMethod]
        public string GetCode()
        {
            Random r    = new Random(Convert.ToInt32(DateTime.Now.ToString("HHmmss")));
            Diya   diya = new Diya();

            Session["Time"] = Convert.ToInt32(DateTime.Now.ToString("mmss"));
            string Code = "";
            int    x    = r.Next(1, 10);

            Session["Code"] = diya.GetMD5Text(x.ToString());
            ///Random r = new Random(Convert.ToInt32(DateTime.Now.ToString("HHmmss")));
            int sign1 = r.Next(0, 3);
            int sign2 = r.Next(0, 2);
            int y     = 0;
            int t;

            switch (sign1)
            {
            case 0:
                t     = r.Next(1, 10);
                y     = x * t;
                Code += t + "#*#x";
                break;

            case 1:
                t     = r.Next(1, 10);
                y     = x + t;
                Code += "x#+#" + t;
                break;

            case 2:
                t     = r.Next(1, 10);
                y     = x - t;
                Code += "x#-#" + t;
                break;

            default:
                break;
            }
            switch (sign2)
            {
            case 0:
                t     = r.Next(1, 10);
                y    += t;
                Code += "#+" + t + "#" + y;
                break;

            case 1:
                t     = r.Next(1, 10);
                y    -= t;
                Code += "#-" + t + "#" + y;
                break;
            }

            return(Code);
        }
示例#9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (MySqlConnection sc = new MySqlConnection(Diya.ConectionString))
     {
         sc.Open();
         string       password = new Diya().GetMD5Text("tadeasdze");
         MySqlCommand Scmd     = new MySqlCommand("update ConsultingInfo set Password = '******'    where contactid = 14050002", sc);
         Scmd.ExecuteNonQuery();
     }
 }
示例#10
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");
         }
     }
 }
示例#11
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();
             }
         }
     }
 }
示例#12
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;
                 }
             }
         }
     }
 }
示例#13
0
    protected void BindWorngPageInfo()
    {
        DataTable DataBase = new DataTable();

        DataBase.Columns.Add("KnowledgePointName");
        DataBase.Columns.Add("WorngCount");
        DataBase.Columns.Add("KnowledgePointID");
        string SelectCmd = "Select  KnowledgePoint.KnowledgePointID,KnowledgePoint.KnowledgePointName from TSRelationship inner join TestInfo on TestInfo.TestID=TSRelationship.TestID inner join HTRelationship on HTRelationship.TSRelationshipID=TSRelationship.RelationshipID inner join Options on Options.OptionID=HTRelationship.SelectedOptionID inner join TKRelationship on TKRelationship.TopicID=HTRelationship.TopicID inner join KnowledgePoint on KnowledgePoint.KnowledgePointID=TKRelationship.KnowledgePointID where TSRelationship.Contactid=" + ViewState["Contactid"].ToString() + " and Options.IsTrue=0 and TestInfo.TestStartTime between '" + this.MinTime.Value + "' and '" + this.MaxTime.Value + "' order by KnowledgePoint.KnowledgePointID";

        using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
        {
            Sc.Open();
            MySqlCommand     Scmd = new MySqlCommand(SelectCmd, Sc);
            DataTable        Dbuf = new DataTable();
            MySqlDataAdapter da   = new MySqlDataAdapter();
            da.SelectCommand = Scmd;
            da.Fill(Dbuf);
            for (int i = 0; i < Dbuf.Rows.Count - 1; i++)
            {
                if (Dbuf.Rows[i]["KnowledgePointID"].ToString() != Dbuf.Rows[i + 1]["KnowledgePointID"].ToString())
                {
                    DataRow dr = DataBase.NewRow();
                    dr["KnowledgePointName"] = Dbuf.Rows[i]["KnowledgePointName"].ToString();
                    dr["KnowledgePointID"]   = Dbuf.Rows[i]["KnowledgePointID"].ToString();
                    DataBase.Rows.Add(dr);
                }
                else if (i + 1 == Dbuf.Rows.Count - 1)
                {
                    if (Dbuf.Rows[i + 1]["KnowledgePointID"].ToString() != DataBase.Rows[DataBase.Rows.Count - 1]["KnowledgePointID"].ToString())
                    {
                        DataRow dr = DataBase.NewRow();
                        dr["KnowledgePointName"] = Dbuf.Rows[i + 1]["KnowledgePointName"].ToString();
                        dr["KnowledgePointID"]   = Dbuf.Rows[i + 1]["KnowledgePointID"].ToString();
                        DataBase.Rows.Add(dr);
                    }
                }
            }
            foreach (DataRow Dr in DataBase.Rows)
            {
                SelectCmd = "Select Count(*) as a from TSRelationship inner join TestInfo on TestInfo.TestID=TSRelationship.TestID inner join HTRelationship on HTRelationship.TSRelationshipID=TSRelationship.RelationshipID inner join Options on Options.OptionID=HTRelationship.SelectedOptionID inner join TKRelationship on TKRelationship.TopicID=HTRelationship.TopicID where TKRelationship.KnowledgePointID=" + Dr["KnowledgePointID"] + " and Options.IsTrue=0 and TestInfo.TestStartTime between '" + this.MinTime.Value + "' and '" + this.MaxTime.Value + "' and TSRelationship.Contactid=" + ViewState["Contactid"].ToString();
                Diya diya = new Diya();
                using (MySqlDataReader read = diya.RowReader(SelectCmd))
                {
                    read.Read();
                    Dr["WorngCount"] = read["a"].ToString();
                }
            }
            this.Worng_Q_T.DataSource       = DataBase;
            ViewState["WrongKnowLedgeData"] = DataBase;
            this.Worng_Q_T.DataBind();
        }
    }
示例#14
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);
    }
示例#15
0
    protected void BindScene7()
    {
        this.TestSartTime.Value = System.DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd 00:00:00");
        this.TestEndTime.Value  = System.DateTime.Now.AddDays(7).ToString("yyyy-MM-dd 23:59:59");
        hidealluntil();
        this.TestInfo.Visible = true;
        string selectComd = "select * from TestInfo where TestStartTime between '" + System.DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd 00:00:00") + "' and '" + System.DateTime.Now.AddDays(7).ToString("yyyy-MM-dd 23:59:59") + "' Order By TestID DESC";

        ViewState["TestInfoDataScoure"] = new Diya().Gridviewbind(this.TestGw, selectComd);
        if (this.TestGw.PageCount == 0)
        {
            this.Title = "没有考试信息";
        }
    }
示例#16
0
    protected void Search_Click(object sender, EventArgs e)
    {
        //this.TestSartTime.Value = System.DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
        //this.TestEndTime.Value = System.DateTime.Now.AddDays(7).ToString("yyyy-MM-dd 23:59:59");
        hidealluntil();
        this.TestInfo.Visible = true;
        string selectComd = "select * from TestInfo where TestStartTime between '" + this.TestSartTime.Value + "' and '" + TestEndTime.Value + "' Order By TestID DESC";

        ViewState["TestInfoDataScoure"] = new Diya().Gridviewbind(this.TestGw, selectComd);
        if (this.TestGw.PageCount == 0)
        {
            this.Title = "没有考试信息";
        }
    }
示例#17
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);
             }
         }
     }
 }
示例#18
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);
         }
     }
 }
示例#20
0
    protected void Consultion_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName != "Page")
        {
            if (e.CommandName == "More")
            {
                LinkButton lb = this.Consultion.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("Lb1") as LinkButton;
                lb.Text = lb.Text == "+" ? "-" : "+";

                this.Consultion.Rows[Convert.ToInt32(e.CommandArgument.ToString())].FindControl("test1").Visible = lb.Text == "+" ? false : true;
            }
            else if (e.CommandName == "select")
            {
            }
            else if (e.CommandName == "HistoryTest")
            {
                Session["Contactid_S"] = e.CommandArgument;
                Response.Redirect("History_Test.aspx");
            }
            else if (e.CommandName == "RemoveClass")
            {
                this.Consultion.Columns[1].Visible = false;
                string DeleteCommand = "Delete From CSrelationship where Contactid=" + e.CommandArgument.ToString() + " and Classid=" + ClassInfo.SelectedValue;
                using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
                {
                    Sc.Open();
                    MySqlTransaction Stransaction = Sc.BeginTransaction();
                    MySqlCommand     Scmd         = new MySqlCommand();
                    Scmd.Transaction = Stransaction;
                    Scmd.Connection  = Sc;
                    try
                    {
                        Scmd.CommandText = DeleteCommand;
                        Scmd.ExecuteNonQuery();
                        Stransaction.Commit();
                    }
                    catch (Exception)
                    {
                        Stransaction.Rollback();
                    }
                    string SelectCmd = "Select * From ConsultingInfo ";
                    SelectCmd += " inner join CSrelationship on CSrelationship.Contactid=ConsultingInfo.Contactid where CSrelationship.Classid!=0 and CSrelationship.Classid=" + this.ClassInfo.SelectedValue;
                    ViewState["Consultion_Info"] = new Diya().Gridviewbind(this.Consultion, SelectCmd);
                }
            }
        }
    }
示例#21
0
    protected void ClassInfo_SelectedIndexChanged(object sender, EventArgs e)
    {
        string SelectCmd = "Select * From ConsultingInfo ";

        if (this.ClassInfo.SelectedIndex == 0)
        {
            ViewState["Consultion_Info"]       = new Diya().Gridviewbind(this.Consultion, SelectCmd);
            this.Consultion.Columns[1].Visible = false;
        }
        else
        {
            SelectCmd += " inner join CSrelationship on CSrelationship.Contactid=ConsultingInfo.Contactid where CSrelationship.Classid!=0 and CSrelationship.Classid=" + this.ClassInfo.SelectedValue;
            ViewState["Consultion_Info"]       = new Diya().Gridviewbind(this.Consultion, SelectCmd);
            this.Consultion.Columns[1].Visible = true;
        }
        hidealluntil();
        this.Consultion_Gw.Visible = true;
    }
示例#22
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;
     }
 }
示例#23
0
 protected void linkbutton_Click(object sender, EventArgs e)
 {
     if (ViewState["EditInfo"].ToString() == "edit")
     {
         LinkButton linb = sender as LinkButton;
         string     url  = "EditConsluting.aspx?Mode=Edit";
         Session["ConEditInfo"] = linb.CommandArgument.ToString();
         Response.Redirect(url);
     }
     else if (ViewState["EditInfo"].ToString() == "Delete")
     {
         LinkButton linb = sender as LinkButton;
         using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
         {
             Sc.Open();
             MySqlCommand Scmd = new MySqlCommand("delete From ConsultingInfo where Contactid=" + linb.CommandArgument, Sc);
             Scmd.ExecuteNonQuery();
             ViewState["Consultion_Info"]       = new Diya().Gridviewbind(this.Consultion, "Select ChildrenCall,ParentsCall,Contact,Contactid from ConsultingInfo ");
             this.Consultion.Columns[0].Visible = false;
         }
     }
 }
示例#24
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() + "#";
        }
    }
示例#25
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")
     {
     }
 }
示例#26
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;
                    }
                }
            }
        }
    }
示例#27
0
 protected void Confirm_Click(object sender, EventArgs e)
 {
     using (MySqlConnection Sc = new MySqlConnection(Diya.ConectionString))
     {
         Sc.Open();
         bool Error = false;
         if (this.Parent_Call.Value == "")
         {
             Error = true;
         }
         if (ClassLV.Value == "")
         {
             Error = true;
         }
         if (this.School.Value == "")
         {
             Error = true;
         }
         if (this.Contact.Value == "" || !new Diya().checktext("Phonenumber", this.Contact.Value))
         {
             Error = true;
         }
         if (!Error)
         {
             if (Request["Mode"] == "Add")
             {
                 MySqlCommand    Scmd = new MySqlCommand("Select Max(Contactid) as id from ConsultingInfo", Sc);
                 MySqlDataReader read = Scmd.ExecuteReader();
                 read.Read();
                 int    previd = Convert.ToInt32(read["id"].ToString());
                 int    now    = Convert.ToInt32(DateTime.Now.ToString("yyMM") + "0000");
                 string id;
                 if (previd < now)
                 {
                     id = Convert.ToString(now + 1);
                 }
                 else
                 {
                     id = Convert.ToString(previd + 1);
                 }
                 using (MySqlConnection InSc = new MySqlConnection(Diya.ConectionString))
                 {
                     InSc.Open();
                     if (Session["UserInfo"] == null)
                     {
                         Session["TheScene"] = "4";
                         Response.Redirect("Consultion.aspx");
                     }
                     Diya         diya   = new Diya();
                     MySqlCommand InScmd = new MySqlCommand("Insert Into ConsultingInfo(Contactid,Userid,ConsultingTime,ChildrenCall,ParentsCall,Contact,ChildrenAge,ChildrenSex,School,Remarks,SignUp,ClassLv,Canalid,Password) values(" + id + ",'" + Session["UserInfo"].ToString().Split(new char[] { '#' })[1] + "','" + System.DateTime.Now.ToShortDateString() + "','" + this.Children_Call.Value + "','" + this.Parent_Call.Value + "','" + Contact.Value + "'," + this.Age.Value + ",'" + this.Sex.SelectedValue + "','" + this.School.Value + "','" + this.remark.Text + "',0,'" + ClassLV.Value + "'," + this.Cannel.SelectedValue + ",'" + diya.GetMD5Text("11111111") + "')", InSc);
                     InScmd.ExecuteNonQuery();
                 }
                 using (MySqlConnection InSc = new MySqlConnection(Diya.ConectionString))
                 {
                     InSc.Open();
                     MySqlCommand InScmd = new MySqlCommand("insert into CSrelationship(Classid,Contactid,Payment,Registrarion,InReading) values(" + this.ClassInfo_Dorp.SelectedValue + "," + id + "," + "0" + ",0" + ",1" + ")", InSc);
                     InScmd.ExecuteNonQuery();
                 }
                 Session["TheScene"] = "4";
                 Response.Redirect("Consultion.aspx");
             }
             else
             {
                 MySqlCommand Scmd = new MySqlCommand("Update ConsultingInfo set ChildrenCall='" + this.Children_Call.Value + "',ParentsCall='" + this.Parent_Call.Value + "',ChildrenAge=" + this.Age.Value + ",ClassLv='" + this.ClassLV.Value + "',ChildrenSex='" + this.Sex.SelectedValue + "',School='" + this.School.Value + "',Contact='" + this.Contact.Value + "',ReceptionTime='" + this.arrive.Value + "',Canalid=" + this.Cannel.SelectedValue + ",Remarks='" + this.remark.Text + "' where Contactid=" + ViewState["UpdateID"], Sc);
                 Scmd.ExecuteNonQuery();
                 Session["TheScene"] = "4";
                 Response.Redirect("Consultion.aspx");
             }
         }
         else
         {
         }
     }
 }
示例#28
0
 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();
                 }
             }
         }
     }
 }
示例#29
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;
        }
    }
示例#30
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);
        }
    }