//[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); }
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 { } } }
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); } } }