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

📄 form4.cs

📁 超市运行模拟软件源程序源代码,是一个用c#语言编写的C/S软件,开发环境是VS.NET 2003 登陆时可以看数据库中的姓名和密码,不然无法登陆,具体操作见里面的说明!
💻 CS
📖 第 1 页 / 共 2 页
字号:
				"CT name, password, unit FROM goodpass WHERE (name = @name)";
			this.sqlInsertCommand1.Connection = this.sqlConnection1;
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar, 50, "name"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.VarChar, 50, "password"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@unit", System.Data.SqlDbType.Int, 4, "unit"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT name, password, unit FROM goodpass";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE goodpass SET name = @name, password = @password, unit = @unit WHERE (name = @Original_name) AND (password = @Original_password OR @Original_password IS NULL AND password IS NULL) AND (unit = @Original_unit OR @Original_unit IS NULL AND unit IS NULL); SELECT name, password, unit FROM goodpass WHERE (name = @name)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection1;
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar, 50, "name"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.VarChar, 50, "password"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@unit", System.Data.SqlDbType.Int, 4, "unit"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_name", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_password", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "password", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_unit", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "unit", System.Data.DataRowVersion.Original, null));
			// 
			// dataSet21
			// 
			this.dataSet21.DataSetName = "DataSet2";
			this.dataSet21.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// linkLabel2
			// 
			this.linkLabel2.Cursor = System.Windows.Forms.Cursors.Hand;
			this.linkLabel2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.linkLabel2.ForeColor = System.Drawing.Color.Blue;
			this.linkLabel2.LinkColor = System.Drawing.Color.Red;
			this.linkLabel2.Location = new System.Drawing.Point(40, 240);
			this.linkLabel2.Name = "linkLabel2";
			this.linkLabel2.Size = new System.Drawing.Size(96, 23);
			this.linkLabel2.TabIndex = 2;
			this.linkLabel2.TabStop = true;
			this.linkLabel2.Text = "查看登陆说明";
			this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.ForeColor = System.Drawing.Color.Red;
			this.label3.Location = new System.Drawing.Point(40, 8);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(216, 23);
			this.label3.TabIndex = 3;
			this.label3.Text = "超市登陆管理";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.Location = new System.Drawing.Point(64, 32);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(88, 23);
			this.label4.TabIndex = 5;
			this.label4.Text = "登陆管理";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// Form4
			// 
			this.AcceptButton = this.btnok;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.Azure;
			this.ClientSize = new System.Drawing.Size(304, 282);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.linkLabel2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.groupBox1);
			this.MaximizeBox = false;
			this.Name = "Form4";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "操作员登陆";
			this.Load += new System.EventHandler(this.Form4_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		static void Main() 
		{
			try
			{
				Application.Run(new Form4());
			}
			catch(Exception err)
			{
				MessageBox.Show(err.Message);
			}
		}

		private void Form4_Load(object sender, System.EventArgs e)
		{
		try{
			 this.sqlDataAdapter1.Fill(dataSet21, "goodpass");
		   }
			catch(Exception err)
			{
				MessageBox.Show(err.Message);
			    this.Close();
			}
		}

		private void btnok_Click(object sender, System.EventArgs e)
		{
			try
			{
				
				Form1 frm1 = new Form1(this);
				Form2 frm2 = new Form2(this);
				Form3 frm3 = new Form3(this);
				Form5 frm5 = new Form5(this);
				Form6 frm6 = new Form6(this);
				
				int flagggg=0;
				for (int i=0; i < this.dataSet21.goodpass.Rows.Count; i++)
				{
					if(txtname.Text==this.dataSet21.goodpass.Rows[i]["name"].ToString())
					{	
						
						if(txtpassword.Text==this.dataSet21.goodpass.Rows[i]["password"].ToString())
						{
							if(Convert.ToInt32(this.dataSet21.goodpass.Rows[i]["unit"])==1)
							{
								frm1.ShowDialog();
								txtpassword.Clear();
							}
							if(Convert.ToInt32(this.dataSet21.goodpass.Rows[i]["unit"])==2)
							{
								frm2.ShowDialog();
								txtpassword.Clear();
							}
							if(Convert.ToInt32(this.dataSet21.goodpass.Rows[i]["unit"])==3)
							{
								frm3.ShowDialog();
								txtpassword.Clear();
							}
							if(Convert.ToInt32(this.dataSet21.goodpass.Rows[i]["unit"])==5)
							{
								frm5.ShowDialog();
								txtpassword.Clear();
							}
							if(Convert.ToInt32(this.dataSet21.goodpass.Rows[i]["unit"])==6)
							{
								frm6.ShowDialog();
								txtpassword.Clear();
							}

						}
						else
							MessageBox.Show("   密码错误!"+"\n\n"+"密码忘记可向管理员索取");
						flagggg=1;
						
					}
				}
				if(flagggg==0)
				{
					if(txtname.Text=="")
					{
						MessageBox.Show("用户名不能为空");
					}
					else
					{
						MessageBox.Show("用户名不存在");
					}
				}								
                txtpassword.Clear();
			}
			catch(Exception err)
			{
				MessageBox.Show(err.Message);
			}
		}

		private void btncansle_Click(object sender, System.EventArgs e)
		{
			txtname.Clear();
			txtpassword.Clear();
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
		{
			try
			{
				MessageBox.Show("操作员安照不同的权限登陆到不同的界面:\n\n1.库存界面\n2.销售界面\n3.进货界面\n5.控制台界面\n6.-----\n7.-----\n8.-----");
			}
			catch(Exception err)
			{
			}
		}

		
	}
}

⌨️ 快捷键说明

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