zoukankan      html  css  js  c++  java
  • 简单的登陆页面

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using 人事考勤系统;
    using System.Collections;
    using AnbySQL;

    namespace 人事考勤系统
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    private string logintype = "";
    public string Logintype
    {
    get { return combRole.Text; }
    }
    public string LoginID
    {
    get { return txtUserid.Text.Trim(); }
    }

    private void Form1_Load(object sender, EventArgs e)
    {
    DataTable dt = new DataTable();
    List<string> role=new List<string>();
    string sql = "select * from UserInfo";
    dt= AnbySQL.DbHelperSQL.DataQuery(sql).Tables[0];
    for(int i=0;i<dt.Rows.Count;i++)
    {
    role.Add(dt.Rows[i]["username"].ToString());
    }
    combRole.DataSource = role;
    }

    private void btnLogin_Click(object sender, EventArgs e)
    {
    ChkContol();
    logintype = combRole.Text;
    DataTable dt =GoLogin();

    if (dt.Rows.Count > 0)
    {
    this.DialogResult= DialogResult.OK;
    }
    else
    MessageBox.Show("登录失败");
    }


    private DataTable GoLogin()
    {
    DataTable dt = new DataTable();
    string sql = "select count(*) from userinfo where username='" + txtUserid.Text.Trim() + "' and Password='" + txtPwd.Text.Trim() + "'";
    return dt = AnbySQL.DbHelperSQL.DataQuery(sql).Tables[0];
    }


    private void btnCancel_Click(object sender, EventArgs e)
    {
    Application.Exit();
    }

    public void ChkContol()
    {
    if (txtUserid.Text == "" || txtPwd.Text == "" || combRole.Text == "")
    {
    MessageBox.Show("用户名,密码,角色不能为空");
    }

    }
    }
    }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;

    namespace 人事考勤系统
    {
    static class Program
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main()
    {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    Form1 frmLogin = new Form1();
    Form frmMain = null;
    if (frmLogin.ShowDialog() == DialogResult.OK)
    {
    frmMain = new 主界面();
    UserHelper.LoginID = frmLogin.LoginID;
    UserHelper.LoginType = frmLogin.Logintype;
    }
    Application.Run(frmMain);


    }
    }
    }

  • 相关阅读:
    工厂模式
    日历控件激发的事件(在呈现日时激发)
    在HTML页面里调用CS页面里的全局变量.
    DbDataAdapter填充(Fill)DataSet的情况
    IDataAdapter 接口
    一些HTML的知识!
    HTML页面里给DataGrid控件添加项!
    如何在网页中每小时更新一次数据?
    在windows下编译objectc语言
    Android牟利之道(四)如何推广你的产品,即你的APP
  • 原文地址:https://www.cnblogs.com/anbylau2130/p/2732160.html
Copyright © 2011-2022 走看看