⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 web8.aspx.cs

📁 主要功能: 1、 包括顾客信息、货品信息、定单信息的管理。 2、 按月统计销售业绩。 3、 报表设计。 4、 系统维护。
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

namespace jd
{
	/// <summary>
	/// Web8 的摘要说明。
	/// </summary>
	public class Web8 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.HyperLink HyperLink10;
		protected System.Web.UI.WebControls.HyperLink HyperLink9;
		protected System.Web.UI.WebControls.Label Label21;
		protected System.Web.UI.WebControls.Label Label22;
		protected System.Web.UI.WebControls.Button Button4;
		protected System.Web.UI.WebControls.Button Button3;
		protected System.Web.UI.WebControls.Label Label28;
		protected System.Web.UI.WebControls.Label Label27;
		protected System.Web.UI.WebControls.Label Label26;
		protected System.Web.UI.WebControls.TextBox TextBox5;
		protected System.Web.UI.WebControls.Label Label24;
		protected System.Web.UI.WebControls.TextBox TextBox4;
		protected System.Web.UI.WebControls.Label Label14;
		protected System.Web.UI.WebControls.TextBox TextBox3;
		protected System.Web.UI.WebControls.Label Label16;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.Label Label19;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.Label Label15;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.Label Label9;
		protected System.Web.UI.WebControls.Panel Panel2;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Image Image1;
		protected System.Web.UI.WebControls.Label L5;
		protected System.Web.UI.WebControls.Label Label10;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.Label Label11;
		protected System.Web.UI.WebControls.Label L7;
		protected System.Web.UI.WebControls.Label Label12;
		protected System.Web.UI.WebControls.Label Label13;
		protected System.Web.UI.WebControls.Label L3;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.Label L6;
		protected System.Web.UI.WebControls.Label Label8;
		protected System.Web.UI.WebControls.Label L2;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.Label L4;
		protected System.Web.UI.WebControls.Label Label7;
		protected System.Web.UI.WebControls.Label L1;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Image Image3;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Image Image23;
		protected System.Web.UI.WebControls.Panel Panel4;
		protected System.Web.UI.HtmlControls.HtmlTableCell TD1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(Request["产品名称"]==null)
			{
				Response.Redirect("cpinex.aspx");//如果为空显示经销页
			}
			else
			{
				string connstr=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(@".\databast.mdb");
				OleDbConnection conn=new OleDbConnection(connstr);
				conn.Open();
				string sql="select * from 嵌入式消毒柜 where 产品名称='"+Request["产品名称"]+"'";
				OleDbCommand comm=new OleDbCommand(sql,conn);
				OleDbDataReader mydata=comm.ExecuteReader();
				try
				{
					while(mydata.Read())
					{
						for(int i=0;i<mydata.FieldCount;i++)
						{
							if(mydata.GetName(i)=="产品名称")
							{
								this.L1.Text=mydata.GetValue(i).ToString();
							}
							if(mydata.GetName(i)=="产品售价")
							{
								this.L2.Text=mydata.GetValue(i).ToString();
							}
							if(mydata.GetName(i)=="产品备注")
							{
								this.L3.Text=mydata.GetValue(i).ToString();
							}
							if(mydata.GetName(i)=="产品规格")
							{
								this.L4.Text=mydata.GetValue(i).ToString();
							}
							if(mydata.GetName(i)=="产品信息")
							{
								this.L5.Text=mydata.GetValue(i).ToString();
							}
							if(mydata.GetName(i)=="产品类别")
							{
								this.L6.Text=mydata.GetValue(i).ToString();
							}
							if(mydata.GetName(i)=="数量")
							{
								this.L7.Text=mydata.GetValue(i).ToString();
							}
						}
					}
				}
				finally
				{
					mydata.Close();
					conn.Close();
				}
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button4.Click += new System.EventHandler(this.Button4_Click);
			this.Button3.Click += new System.EventHandler(this.Button3_Click);
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Button2.Click += new System.EventHandler(this.Button2_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{
			Response.Write("<script>close()</script>");
		}

		private void Button2_Click(object sender, System.EventArgs e)
		{
			this.Button2.Enabled=false;
			this.Panel2.Visible=true;
			this.Label27.Text=this.L1.Text;		
		}

		private void Button4_Click(object sender, System.EventArgs e)
		{
			this.Button2.Enabled=true;
			this.Panel2.Visible=false;
		}

		private void Button3_Click(object sender, System.EventArgs e)
		{
			if(this.TextBox1.Text=="")
			{
				Response.Write("<script>window.alert('请填写完信息');</script>");
			}
			else if(this.TextBox2.Text=="")
			{
				Response.Write("<script>window.alert('请填写完信息');</script>");
			}
			else if(this.TextBox3.Text=="")
			{
				Response.Write("<script>window.alert('请填写完信息');</script>");
			}
			else if(this.TextBox4.Text=="")
			{
				Response.Write("<script>window.alert('请填写完信息');</script>");
			}
			else if(this.TextBox5.Text=="")
			{
				Response.Write("<script>window.alert('请填写完信息');</script>");
			}
			else
			{
				bool ttt=true;
				string connstr=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(@".\databast.mdb");
				OleDbConnection conn=new OleDbConnection(connstr);
				conn.Open();
				OleDbCommand comm=new OleDbCommand();
				comm.Connection=conn;				
				string sql="select 姓名 from 顾客信息表";
				OleDbDataAdapter adapter=new OleDbDataAdapter(sql,conn);
				DataSet dataset=new DataSet();
				adapter.Fill(dataset,"顾客信息表");
				for(int i=0;i<dataset.Tables["顾客信息表"].Rows.Count;i++)
				{
					if(this.TextBox1.Text==dataset.Tables["顾客信息表"].Rows[i][0].ToString().Trim())
					{
						ttt=false;
						Response.Write("<script>window.alert('有客户跟你同名,请在姓名后加个符号!');</script>");
						this.TextBox1.Text="";
						break;
					}
				}
				if(ttt)
				{
					comm.CommandText="insert into 顾客信息表(姓名,性别,地址,联系电话,邮编,身份证,购买货物) values ('"+this.TextBox1.Text+"','"+this.DropDownList1.SelectedValue+"','"+this.TextBox3.Text+"','"+this.TextBox5.Text+"','"+this.TextBox4.Text+"','"+this.TextBox2.Text+"','"+this.Label27.Text+"')";
					comm.ExecuteNonQuery();
					conn.Close();
					if(this.L7.Text.ToString()=="缺货")
					{
						Response.Write("<script>window.alert('对不起!本产品缺货,我们会尽快补充,给您带来的不便敬请谅解!');</script>");
					}
					else
					{
						int i;//以下是减去库存函数
						i=Int32.Parse(this.L7.Text);
						i=i-1;
						this.L7.Text=i.ToString();
						string connstr1=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(@".\databast.mdb");
						OleDbConnection conn1=new OleDbConnection(connstr1);
						conn1.Open();
						if(Int32.Parse(this.L7.Text)==0)
						{
							this.L7.Text="缺货";
						}
						string sql1="update 嵌入式消毒柜 set 数量='"+this.L7.Text+"' where 产品名称='"+Request["产品名称"]+"'";
						OleDbCommand comm1=new OleDbCommand(sql1,conn1);
						comm1.ExecuteNonQuery();
						Response.Write("<script>window.alert('购买成功,您的货物我们尽快寄往,谢谢您的支持与信赖!');</script>");
						this.Panel2.Visible=false;
						conn1.Close();
					}

				}
			}		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -