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

📄 landframe.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
📖 第 1 页 / 共 4 页
字号:
				dsUsers=ds.Tables[0];
				for(int k=0;k<dsUsers.Rows.Count;k++)
				{
					for(int i=0;i<this.textUserName.Items.Count;i++)
					{
						if(dsUsers.Rows[k][1].ToString().Equals(this.textUserName.Items[i].ToString()) && ((dsUsers.Rows[k][2].ToString())).Equals((MD4.EncryptString(this.textUserPassword.Text.ToString()))))
						{
							userTypeStr=dsUsers.Rows[k][3].ToString();
							//此处加入一个方法....
							if(IsUserType(userTypeStr).Equals(false))
							{
								MessageBox.Show(this,"请你选择用户类型!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
								return;
							}
							else
							{
								blTure=true;//是否登陆成功
								blM=true;//是否出现导航条
								landFrame.strPassword=ds.Tables["System_UserTable"].Rows[i][2].ToString();
								landFrame.strUserName=ds.Tables["System_UserTable"].Rows[i][1].ToString();
								this.userHashTable.Add(new user(landFrame.strUserName,landFrame.strPassword,landFrame.strUserType),1);
								strName=ds.Tables["System_UserTable"].Rows[i][3].ToString().Trim();
								//MessageBox.Show(this,"当前用户为:"+strName,"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
								this.Close();
								dengluHistory();
								return;
							}
						}
					}																							
				}
				if(landFrame.blTure.Equals(true))
				{
					writeLogin();
				}
				MessageBox.Show(this,"当前用户不存在或密码有误!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				this.textUserPassword.Text="";
				 if(landFrame.blTure.Equals(false))
				 {
					 dengluHistory();
                     blDeLu++;
				 }
				if(blDeLu==3)
				{
					MessageBox.Show(this,"连续登陆了"+blDeLu.ToString()+"次","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					this.Dispose();
				}
			}
			catch(IOException ele)
			{
				ele.ToString();
			}
			catch(Exception exe)
			{
				exe.ToString();
			}
		}
		//取消
		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			DialogResult dialog=MessageBox.Show(this,"是否要退出系统吗???","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
			if(dialog.Equals(DialogResult.Yes))
			{
				dengluHistory();
				Application.Exit();
			}
			else
			{
				return;
			}
		}
		//权限类型...
		private void radioAdmin_CheckedChanged(object sender, System.EventArgs e)
		{
		    strAdmin=this.radioAdmin.Text;
		}
		private void radioUser_CheckedChanged(object sender, System.EventArgs e)
		{
			strUser=this.radioUser.Text;
		}
		#endregion
		#region 判断用户类型
		private bool IsUserType(string UserTypeStr)
		{
			if(UserTypeStr.Equals(strAdmin))
			{
				this.radioAdmin.Checked=true;
				return true;
			}
			else if(UserTypeStr.Equals(strUser))
			{
				this.radioUser.Checked=true;
				return true;
			}
            return false;
		}
		#endregion
		#region  是否为空函数
		private bool CheckNull()
		{
			if(this.textUserName.Text=="")
			{
                MessageBox.Show(this,"用户名不能为空!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				textUserName.Focus();
				return false;
			}
			if(this.textUserPassword.Text=="")
			{
				MessageBox.Show(this,"密码不能为空!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				textUserPassword.Focus();
				return false;
			}
			return true;
		}
		#endregion
		#region 退出图标....
		private void ExitImage_Click(object sender, System.EventArgs e)
		{
			DialogResult Result=MessageBox.Show(this,"是否退出系统呢???","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
			if(Result.Equals(DialogResult.Yes))
			{
				Application.Exit();
			}
			else
			{
				return;
			}
		}
		#endregion
        #region 当前鼠标位置改变...按下,移动,停止....
		private void TitleLabel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			//记录当前鼠标位置...
			this.blMove=true;
			this.MouseX=e.X;
			this.MouseY=e.Y;
		}

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

		private void TitleLabel_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
		    this.blMove=false;
		}
		private void TitleLabel_Click(object sender, System.EventArgs e)
		{
		
		}
		#endregion
		#region 当输入正确用户名和密码后,回车键时的事件....
		private void textUserPassword_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(landFrame.blTure.Equals(true))
			{
				if(e.KeyValue.Equals(13))
				{
					this.btnLogin_Click(null,null);
				}
			}
		}
		#endregion
		#region 鼠标移到控件与离开控件事件....
		private void ExitImage_MouseEnter(object sender, System.EventArgs e)
		{
//		    this.ExitImage.BorderStyle=BorderStyle.Fixed3D;
			this.TitleLabel.Text="关闭系统";
			this.Focus();
		}

		private void ExitImage_MouseLeave(object sender, System.EventArgs e)
		{
//			this.ExitImage.BorderStyle=BorderStyle.None;
			this.TitleLabel.Text="登录窗体";
		}

		private void btnLogin_MouseEnter(object sender, System.EventArgs e)
		{
		    this.btnLogin.FlatStyle=FlatStyle.Standard;
			this.btnLogin.Font=new Font("宋体",10F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((System.Byte)(134)));
		}

		private void btnLogin_MouseLeave(object sender, System.EventArgs e)
		{
			this.btnLogin.FlatStyle=FlatStyle.Flat;
			this.btnLogin.Font=new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
		}

		private void btnCancel_MouseEnter(object sender, System.EventArgs e)
		{
			this.btnCancel.FlatStyle=FlatStyle.Standard;
			this.btnCancel.Font=new Font("宋体",10F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((System.Byte)(134)));
		}

		private void btnCancel_MouseLeave(object sender, System.EventArgs e)
		{
			this.btnCancel.FlatStyle=FlatStyle.Flat;
			this.btnCancel.Font=new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
		}
		private void btnZhuChe_MouseEnter(object sender,System.EventArgs e)
		{
			this.btnZhuChe.FlatStyle=FlatStyle.Standard;
			this.btnZhuChe.Font=new Font("宋体",10F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((System.Byte)(134)));
		}
		private void btnZhuChe_MouseLeave(object sender,System.EventArgs e)
		{
			this.btnZhuChe.FlatStyle=FlatStyle.Flat;
			this.btnZhuChe.Font=new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
		}

		private void textUserPassword_MouseEnter(object sender, System.EventArgs e)
		{
		    this.textUserPassword.BackColor=SystemColors.Window;
		}

		private void textUserPassword_MouseLeave(object sender, System.EventArgs e)
		{
		    this.textUserPassword.BackColor=SystemColors.Window;
		}

		private void textUserName_MouseEnter(object sender, System.EventArgs e)
		{
		    this.textUserName.BackColor=SystemColors.Window;
		}

		private void textUserName_MouseLeave(object sender, System.EventArgs e)
		{
		   this.textUserName.BackColor=SystemColors.Info;
		}

		private void TitleLabel_MouseEnter(object sender, System.EventArgs e)
		{
		    this.TitleLabel.ForeColor=Color.Black;
			this.TitleLabel.Text="移动窗口";
		}

		private void TitleLabel_MouseLeave(object sender, System.EventArgs e)
		{
			this.TitleLabel.ForeColor=Color.White;
			this.TitleLabel.Text="登录窗体";
		}
		//普通用户...
		private void radioUser_MouseEnter(object sender, System.EventArgs e)
		{
		
		}

		private void radioUser_MouseLeave(object sender, System.EventArgs e)
		{
		
		}
		//管理员...
		private void radioAdmin_MouseEnter(object sender, System.EventArgs e)
		{
		
		}

		private void radioAdmin_MouseLeave(object sender, System.EventArgs e)
		{
		
		}
		private void textUserName_MouseLeave_1(object sender, System.EventArgs e)
		{
			ComboBox com=(ComboBox)sender;
			com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.Simple;
		}

		private void textUserName_MouseEnter_1(object sender, System.EventArgs e)
		{
			ComboBox com=(ComboBox)sender;
			com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDownList;
		}
		private void textUserDate_MouseLeave(object sender, System.EventArgs e)
		{
			ComboBox com=(ComboBox)sender;
			com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.Simple;
		}

		private void textUserDate_MouseEnter(object sender, System.EventArgs e)
		{
			ComboBox com=(ComboBox)sender;
			com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDownList;
		}
		#endregion
		#region 注册事件....
		private void btnZhuChe_Click(object sender, System.EventArgs e)
		{
			DialogResult result=MessageBox.Show(this,"是进入注册窗体,否是进入登录窗体!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
			if(result.Equals(DialogResult.Yes))
			{
				//MessageBox.Show(this,"进入注册窗体!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				AllDispose();
				ZhuCheFrame log=new ZhuCheFrame();
				log.ShowDialog();
			}
			else
			{
                MessageBox.Show(this,"进入登录窗体!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
		}
		#endregion
		#region 登录窗体的所有控件都释放掉了.....函数...
		private void AllDispose()
		{
            this.TitleLabel.Dispose();
			this.label2.Dispose();
			this.label3.Dispose();
			this.textUserName.Dispose();
			this.textUserPassword.Dispose();

⌨️ 快捷键说明

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