From a1e90fd4455bb7c2cf6ff0623e19f3bcba5c5e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8F=8B=E6=9E=97?= <2440500528@qq.com> Date: Sun, 12 Jun 2022 13:45:28 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20220612=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../220612\344\275\234\344\270\232/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/.keep" diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/.keep" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 15b4366aa6ef38540c8e96b62cee95cf08e7d5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8F=8B=E6=9E=97?= <2440500528@qq.com> Date: Sun, 12 Jun 2022 13:46:44 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=20220612?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WebForm1.aspx.cs" | 66 ++++++++++++++ .../WebForm1.aspx.designer.cs" | 71 +++++++++++++++ .../WebForm2.aspx.cs" | 24 +++++ .../WebForm2.aspx.designer.cs" | 53 +++++++++++ .../WebForm3.aspx.cs" | 62 +++++++++++++ .../WebForm3.aspx.designer.cs" | 89 +++++++++++++++++++ 6 files changed, 365 insertions(+) create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.designer.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.designer.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.designer.cs" diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.cs" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.cs" new file mode 100644 index 0000000..62e5232 --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.cs" @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using System.Data.SqlClient; + +namespace Wang10药作业 +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; + if (!IsPostBack) + { + RequiredFieldValidator1.Enabled = false; + RequiredFieldValidator2.Enabled = false; + } + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = txt_name.Text.Trim(); + string pwd = txt_pwd.Text.Trim(); + + if (name==""||pwd=="") + { + Response.Write(""); + } + else + { + string sql = "select * from UserInfo where UserName=@UserName and Password=@Password"; + + string constr = "server=LAPTOP-4E35V3A9;database=OrderMedicineDB;uid=sa;pwd=@wyl24680"; + + SqlDataAdapter adapter = new SqlDataAdapter(sql, constr); + + adapter.SelectCommand.Parameters.AddWithValue("@UserName", name); + adapter.SelectCommand.Parameters.AddWithValue("@Password", pwd); + DataTable dt = new DataTable(); + + adapter.Fill(dt); + + if (dt.Rows.Count>0) + { + Session["uid"] = dt.Rows[0]["userid"]; + Session["UserName"] = name; + + Response.Redirect("~/WebForm2.aspx"); + } + else + { + + Response.Write(""); + } + } + + + + + } + } +} \ No newline at end of file diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.designer.cs" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.designer.cs" new file mode 100644 index 0000000..789f2e3 --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm1.aspx.designer.cs" @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace Wang10药作业 +{ + + + public partial class WebForm1 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// txt_name 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_name; + + /// + /// RequiredFieldValidator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + + /// + /// txt_pwd 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_pwd; + + /// + /// RequiredFieldValidator2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + } +} diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.cs" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.cs" new file mode 100644 index 0000000..78ea6ae --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.cs" @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Wang10药作业 +{ + public partial class WebForm2 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button1_Click(object sender, EventArgs e) + { + + Response.Redirect("~/WebForm3.aspx"); + + } + } +} \ No newline at end of file diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.designer.cs" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.designer.cs" new file mode 100644 index 0000000..c032372 --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm2.aspx.designer.cs" @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace Wang10药作业 +{ + + + public partial class WebForm2 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// GridView1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.GridView GridView1; + + /// + /// SqlDataSource1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDataSource1; + } +} diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.cs" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.cs" new file mode 100644 index 0000000..ed6bfb1 --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.cs" @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using System.Data.SqlClient; + +namespace Wang10药作业 +{ + public partial class WebForm3 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button1_Click(object sender, EventArgs e) + { + + + string medicineName = txt_MedicineName.Text.Trim(); + string realName = txt_RealName.Text.Trim(); + string mobile = txt_Mobile.Text.Trim(); + string address = txt_Address.Text.Trim(); + string radio = RadioButtonList1.SelectedValue; + string remark = txt_Remark.Text.Trim(); + + + string constr = "server=LAPTOP-4E35V3A9;database=OrderMedicineDB;uid=sa;pwd=@wyl24680"; + string sql1 = $"select * from UserInfo where UserName='{realName}'"; + SqlDataAdapter adapter = new SqlDataAdapter(sql1, constr); + DataTable dt = new DataTable(); + adapter.Fill(dt); + + string sql = $"insert into OrderInfo(MedicineName,UserId,AddTime,RealName,Mobile,Address,State,sendType,Remark)values('{medicineName}','{dt.Rows[0]["UserId"]}','{DateTime.Now.ToString()}','{realName}','{mobile}','{address}','{1}','{radio}','{remark}')"; + SqlConnection con = new SqlConnection(constr); + + SqlCommand command = new SqlCommand(sql,con); + + con.Open(); + + + + + + if (command.ExecuteNonQuery()> 0) + { + Response.Write(""); + } + else + { + Response.Write(""); + } + + con.Close(); + + + } + } +} \ No newline at end of file diff --git "a/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.designer.cs" "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.designer.cs" new file mode 100644 index 0000000..d5a525c --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220612\344\275\234\344\270\232/WebForm3.aspx.designer.cs" @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace Wang10药作业 +{ + + + public partial class WebForm3 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// txt_MedicineName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_MedicineName; + + /// + /// txt_RealName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_RealName; + + /// + /// txt_Mobile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_Mobile; + + /// + /// txt_Address 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_Address; + + /// + /// RadioButtonList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RadioButtonList RadioButtonList1; + + /// + /// txt_Remark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_Remark; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + } +} -- Gitee