• 魔兽登陆系统


    public  class LoginInfo
        {
          /// <summary>
          /// 用户信息类
          /// </summary>
            private string email;
    
            public string Email
            {
                get { return email; }
                set { email = value; }
            }
            private int id;
    
            public int Id
            {
                get { return id; }
                set { id = value; }
            }
            private string name;
    
            public string Name
            {
                get { return name; }
                set { name = value; }
            }
            private string password;
    
            public string Password
            {
                get { return password; }
                set { password = value; }
            }
        }

     1  /// <summary>
     2         /// 用户信息验证及登陆功能实现
     3         /// </summary>
     4         /// <param name="sender"></param>
     5         /// <param name="e"></param>
     6         private void btnLogin_Click(object sender, EventArgs e)
     7         {
     8             
     9             if (txtEmail.Text.Trim() == "" || txtPwd.Text.Trim() == "")
    10             {
    11                 MessageBox.Show("用户名和密码不允许为空!");
    12 
    13 
    14             }
    15             else
    16             {
    17                 string username = txtEmail.Text;
    18                 string pwd = txtPwd.Text;
    19                 bool isOk = false;
    20                 foreach (LoginInfo item in array)
    21                 {
    22                     if (item != null)
    23                     {
    24                         if (item.Email == username && item.Password == pwd)
    25                         {
    26                             isOk = true;
    27                             FrmMain frm = new FrmMain();
    28 
    29                             frm.lblNames.Text = "欢迎," + item.Name;
    30                             frm.Show();
    31                             break;
    32 
    33                         }
    34                     }
    35                 }
    36                 if (isOk == false)
    37                 {
    38                     txtPwd.Text = "";
    39                     txtEmail.Focus();
    40                 }
    41             }
    42             
    43         }
    44        
    45         private void label2_Click(object sender, EventArgs e)
    46         {
    47             //创建注册窗体对象
    48             FrmRegist frm = new FrmRegist();
    49             frm.fl = this;
    50             frm.Show();
    51             this.Hide();//登陆隐藏窗体
    52         }
    53 
    54         private void pictureBox2_Click(object sender, EventArgs e)
    55         {
    56             this.Close();
    57         }
    58         public LoginInfo[] array;//存储登录用户信息的对象数组
    59         private void FrmLogin_Load(object sender, EventArgs e)
    60         {
    61             //初始用户信息
    62             array = new LoginInfo[10];
    63 
    64             
    65         }

     1  /// <summary>
     2       /// 登陆窗体对象
     3       /// </summary>
     4       /// <param name="sender"></param>
     5       /// <param name="e"></param>
     6         private void btnMian_Click(object sender, EventArgs e)
     7         {
     8             LoginInfo info = new LoginInfo();
     9             info.Name = txtName.Text;
    10             info.Id = Convert.ToInt32(txtMa.Text);
    11             info.Email = txtEmail.Text;
    12             info.Email = txtEmails.Text;
    13             info.Password = txtPwd.Text;
    14             info.Password = txtPwds.Text;
    15             if (this.txtName.Text.Trim()=="")
    16             {
    17                 MessageBox.Show("信息不能为空!");
    18                 this.txtName.Focus();
    19 
    20             }
    21             else if (this.txtMa.Text.Trim() == "")
    22             {
    23                 MessageBox.Show("信息不能为空!");
    24                 this.txtMa.Focus();
    25 
    26             }
    27             else if (this.txtEmail.Text.Trim() == "")
    28             {
    29                 MessageBox.Show("信息不能为空!");
    30                 this.txtEmail.Focus();
    31 
    32             }
    33             else if (this.txtEmails.Text.Trim() == "")
    34             {
    35                 MessageBox.Show("信息不能为空!");
    36                 this.txtEmails.Focus();
    37 
    38             }
    39             else if (this.txtPwd.Text.Trim() == "")
    40             {
    41                 MessageBox.Show("信息不能为空!");
    42                 this.txtPwd.Focus();
    43 
    44             }
    45             else if (this.txtPwds.Text.Trim() == "")
    46             {
    47                 MessageBox.Show("信息不能为空!");
    48                 this.txtPwd.Focus();
    49 
    50             }
    51             else
    52             {   
    53                 MessageBox.Show("注册成功!");
    54                 for (int i = 0; i < fl.array.Length; i++)
    55                 {
    56                     if(fl.array[i]==null)
    57                     {
    58                         fl.array[i] = info;
    59                         break;
    60                     }
    61                 }
    62 
    63                 fl.Visible = true;
    64                 this.Close();
    65             }
    66            
    67 
    68         }

  • 相关阅读:
    Django--templates(模板层)
    基于 Hive 的文件格式:RCFile 简介及其应用
    Gobblin采集kafka数据
    Scala 中下划线的用途
    Gobblin编译支持CDH5.4.0
    Kafka到Hdfs的数据Pipeline整理
    Hadoop NameNode的ZKFC机制
    Windows下Eclipse提交MR程序到HadoopCluster
    Kettle实现MapReduce之WordCount
    hadoop中MapReduce多种join实现实例分析
  • 原文地址:https://www.cnblogs.com/aaaaliling/p/8903333.html
Copyright © 2020-2023  润新知