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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..62e5232df02c29c86183b9a7a2d90bfce4468b70 --- /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 0000000000000000000000000000000000000000..789f2e3fb4130b0eb63f33443c34d18f7fd3cbd7 --- /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 0000000000000000000000000000000000000000..78ea6aeb6b63b031487f1d025fb4ac045eabd003 --- /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 0000000000000000000000000000000000000000..c032372720f69adf28464e81c90e6897e178aa7f --- /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 0000000000000000000000000000000000000000..ed6bfb17335785ac6bfb4b5e377df8cab12ca710 --- /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 0000000000000000000000000000000000000000..d5a525cbe3e230cd57220d4f96fd36e622a4f5a3 --- /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; + } +}