zoukankan      html  css  js  c++  java
  • WINFORM权限系统开发系列教程(五)登录窗口

    登录窗口实现

    效果图

     代码

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using Xwy.WindowsFormsApp.DAL;
    using Xwy.WindowsFormsApp.Models;
    
    namespace Xwy.WindowsFormsApp
    {
        public partial class FrmLogin : Form
        {
            public FrmLogin()
            {
                InitializeComponent();
            }
    
            private void btnLogin_Click(object sender, EventArgs e)
            {
                //1.接收页面输入
                string userName = txtUName.Text.Trim();
                string userPwd = txtUPwd.Text.Trim();
    
                //2判断账号 密码 是否为空
                if(string.IsNullOrEmpty(userName))
                {
                    MsgBoxHelper.MsgErrorShow("账号不能为空!");
                    txtUName.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(userPwd))
                {
                    MsgBoxHelper.MsgErrorShow("密码不能为空!");
                    txtUPwd.Focus();
                    return;
                }
    
                UserInfoModel userInfo = new UserInfoModel
                {
                    UserName = userName,
                    UserPwd = userPwd
                };
    
                //3 到数据库里检查存在性 --成功 否则 --失败
                UserDAL userDAL = new UserDAL();
                int userId=userDAL.Login(userInfo);
                if (userId > 0)
                {
                    MsgBoxHelper.MsgBoxShow("登录提示","登录成功");
                    //显示到主页面
                    FrmMain frmMain = new FrmMain();
                    frmMain.Tag = userId;
                    frmMain.Show();
                    this.Hide();
                }
                else
                {
                    MsgBoxHelper.MsgErrorShow("账号或密码输入有误!");
                }
            }
    
            private void btnExit_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
        }
    }
    

      

  • 相关阅读:
    webrtc学习资源
    HTML5视音频标签参考
    ffmpeg 翻译文档
    音频编码器
    opensource mcu
    无法解析的外部符号 "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ)"
    AAC头部格式
    C++11系列-什么是C++11
    Neo4J空间数据存储
    Neo4j 3.0 存储过程
  • 原文地址:https://www.cnblogs.com/xiewenyu/p/13065456.html
Copyright © 2011-2022 走看看