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

📄 zhucheframe.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
📖 第 1 页 / 共 4 页
字号:
					this.btnModifyUser.Enabled=false;
					this.btnDelete.Enabled=false;
					return;
				}
				else
				{
					
					MessageBox.Show(this,"号码可以使用啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					
                    Readuser();
				}
			}
		}
		#endregion
		#region 添加按钮事件...
		private void btnAddUser_Click(object sender, System.EventArgs e)
		{
			if(this.textUserHao.Text.Equals("101"))
			{
				MessageBox.Show(this,"错误,此号码不能使用啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				this.textUserHao.Focus();
				this.textUserHao.Text="";
				return;
			}
			else
			{
				MessageBox.Show(this,"号码可以使用啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				this.textUserHao.Text=selecMaxCount().ToString();
				AddUser();
			}
		}
		#endregion
		#region 修改按钮事件...
		private void btnModifyUser_Click(object sender, System.EventArgs e)
		{
			if(!(this.textUserPassword.Text.Equals(this.textUserRepassword.Text)))
			{
				MessageBox.Show(this,"密码错误!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
                return; 
			}
		    ModifyUser();
		}
		#endregion
		#region 删除按钮事件...
		private void btnDelete_Click(object sender, System.EventArgs e)
		{
		    DeleteUser();
		}
		#endregion
		#region 取消按钮...
		private void btnCancel_Click(object sender, System.EventArgs e)
		{
		    DialogResult result=MessageBox.Show(this,"是退入到登录窗体,否是未退出注册窗体,取消是关闭系统!!!","提示信息",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information);
			if(result.Equals(DialogResult.Yes))
			{
				//MessageBox.Show(this,"退入到登录窗体!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				this.Dispose();
				landFrame log=new landFrame();
				log.ShowDialog();
			}
			else if(result.Equals(DialogResult.No))
			{
				//MessageBox.Show(this,"未退出注册窗体!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
			else if(result.Equals(DialogResult.Cancel))
			{
				//MessageBox.Show(this,"关闭系统!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				Application.Exit();
			}
		}
		#endregion
		#region 光标移动变化...
		private void textUserName_TextChanged(object sender, System.EventArgs e)
		{
			this.userLabel.Text="用户名:"+this.textUserName.Text;
		}

		private void QuanXianHaoCombo_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void textUserRepassword_TextChanged(object sender, System.EventArgs e)
		{
			this.PasswordLabel.Text="密码:"+this.textUserRepassword.Text.ToString();
		}

		private void textUserPassword_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void btnRead_MouseLeave(object sender, System.EventArgs e)
		{
		    Button button=(Button)sender;
			button.FlatStyle=FlatStyle.Flat;
		}

		private void btnRead_MouseEnter(object sender, System.EventArgs e)
		{
			Button button=(Button)sender;
			button.FlatStyle=FlatStyle.Standard;
		}
		#endregion
		#region 标题移动变化..
		private void titleLabel_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
		      blMove=false;
		}

		private void titleLabel_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if(blMove.Equals(true))
			{
				this.Top+=e.Y-this.MouseY;
				this.Left+=e.X-this.MouseX;
			}
		}

		private void titleLabel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			blMove=true;
			this.MouseX=e.X;
			this.MouseY=e.Y;
		}
		#endregion
		#region 添加注册历史的函数...
		private void zhecheHistory(string strSql)
		{
			try
			{
				if(strSql.Equals("添加成功"))
				{
					this.sqlConnection.Open();
					this.sqlInsertCommand1.Parameters["@用户名"].Value=this.textUserName.Text.ToString();
					this.sqlInsertCommand1.Parameters["@密码"].Value=this.textUserRepassword.Text.ToString();
					this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
					this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
					this.sqlInsertCommand1.Parameters["@添加"].Value=strSql;
					this.sqlInsertCommand1.Parameters["@修改"].Value="null";
					this.sqlInsertCommand1.Parameters["@删除"].Value="null";
					int k=this.sqlInsertCommand1.ExecuteNonQuery();
					if(k>0)
					{}
					else
					{
						MessageBox.Show(this,"记录失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}
				else if(strSql.Equals("添加失败"))
				{
					this.sqlConnection.Open();
					this.sqlInsertCommand1.Parameters["@用户名"].Value=this.textUserName.Text.ToString();
					this.sqlInsertCommand1.Parameters["@密码"].Value=this.textUserRepassword.Text.ToString();
					this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
					this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
					this.sqlInsertCommand1.Parameters["@添加"].Value=strSql;
					this.sqlInsertCommand1.Parameters["@修改"].Value="null";
					this.sqlInsertCommand1.Parameters["@删除"].Value="null";
					int k=this.sqlInsertCommand1.ExecuteNonQuery();
					if(k>0)
					{}
					else
					{
						MessageBox.Show(this,"记录失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}
				else if(strSql.Equals("修改失败"))
				{
					this.sqlConnection.Open();
					this.sqlInsertCommand1.Parameters["@用户名"].Value=this.textUserName.Text.ToString();
					this.sqlInsertCommand1.Parameters["@密码"].Value=this.textUserRepassword.Text.ToString();
					this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
					this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
					this.sqlInsertCommand1.Parameters["@添加"].Value="null";
					this.sqlInsertCommand1.Parameters["@修改"].Value=strSql;
					this.sqlInsertCommand1.Parameters["@删除"].Value="null";
					int k=this.sqlInsertCommand1.ExecuteNonQuery();
					if(k>0)
					{}
					else
					{
						MessageBox.Show(this,"记录失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}
				else if(strSql.Equals("修改成功"))
				{
					this.sqlConnection.Open();
					this.sqlInsertCommand1.Parameters["@用户名"].Value=this.textUserName.Text.ToString();
					this.sqlInsertCommand1.Parameters["@密码"].Value=this.textUserRepassword.Text.ToString();
					this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
					this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
					this.sqlInsertCommand1.Parameters["@添加"].Value="null";
					this.sqlInsertCommand1.Parameters["@修改"].Value=strSql;
					this.sqlInsertCommand1.Parameters["@删除"].Value="null";
					int k=this.sqlInsertCommand1.ExecuteNonQuery();
					if(k>0)
					{}
					else
					{
						MessageBox.Show(this,"记录失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}
				else if(strSql.Equals("删除失败"))
				{
					this.sqlConnection.Open();
					this.sqlInsertCommand1.Parameters["@用户名"].Value=this.textUserName.Text.ToString();
					this.sqlInsertCommand1.Parameters["@密码"].Value=this.textUserRepassword.Text.ToString();
					this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
					this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
					this.sqlInsertCommand1.Parameters["@添加"].Value="null";
					this.sqlInsertCommand1.Parameters["@修改"].Value="null";
					this.sqlInsertCommand1.Parameters["@删除"].Value=strSql;
					int k=this.sqlInsertCommand1.ExecuteNonQuery();
					if(k>0)
					{}
					else
					{
						MessageBox.Show(this,"记录失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}
				else if(strSql.Equals("删除成功"))
				{
					this.sqlConnection.Open();
					this.sqlInsertCommand1.Parameters["@用户名"].Value=this.textUserName.Text.ToString();
					this.sqlInsertCommand1.Parameters["@密码"].Value=this.textUserRepassword.Text.ToString();
					this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
					this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
					this.sqlInsertCommand1.Parameters["@添加"].Value="null";
					this.sqlInsertCommand1.Parameters["@修改"].Value="null";
					this.sqlInsertCommand1.Parameters["@删除"].Value=strSql;
					int k=this.sqlInsertCommand1.ExecuteNonQuery();
					if(k>0)
					{}
					else
					{
						MessageBox.Show(this,"记录失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					}
				}
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			finally
			{
				if(this.sqlConnection.State.Equals(ConnectionState.Open))
				{
					this.sqlConnection.Close();
				}
			}
		}
		#endregion
		#region 查询最大号...
		private int  selecMaxCount()
		{
			int strMax=0;
			DataTable temp=new DataTable();
			string strSsql="select max(用户号) from System_UserTable";
			ConnectionData conn=new ConnectionData();
			temp=ExcuteSql(strSsql,"System_UserTable");
			for(int i=0;i<temp.Rows.Count;i++)
			{
				strMax=Int32.Parse(temp.Rows[i][0].ToString())+1;
			}
			return strMax;
		}
		#endregion
	}
}

⌨️ 快捷键说明

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