www.pudn.com > FORU(SMS).rar > SMS_Login.cs


using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using System.Data.SqlClient; 
namespace FORU_SMS_ 
{ 
    public partial class SMS_Login : Form 
    { 
        BaseClass.DataConn Dconn = new FORU_SMS_.BaseClass.DataConn(); 
        BaseClass.DataClass Dclass = new FORU_SMS_.BaseClass.DataClass(); 
        public SqlCommand sqlcom; 
        private string testValue; 
        public static SMS_Login login; 
        public SMS_Login() 
        { 
            InitializeComponent(); 
            login = this; 
        } 
 
        public string TestValue 
        { 
            get 
            { 
                return testValue; 
            } 
            set 
            { 
                this.testValue = value; 
            } 
        } 
 
        private void bt_ok_Click(object sender, EventArgs e) 
        { 
            string txtName = com_User.Text.Trim(); 
            string txtPass = txt_Pass.Text.Trim(); 
            bool strEnter = Dclass.ChkLogin(txtName, txtPass); 
            if (strEnter != true) 
            { 
                MessageBox.Show("登陆名或密码错误!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); 
            } 
            else 
            { 
                this.TestValue = txtName; 
                SMS_Main main = new SMS_Main(); 
                main.Show(); 
                this.Visible = false; 
                MessageBox.Show("成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Error); 
            } 
        } 
 
        private void SMS_Login_Load(object sender, EventArgs e) 
        { 
           Dclass.BindComboBox("select UserName from SMS_User", "SMS_User", "UserName", com_User); 
           //MessageBox.Show(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); 时间表示 
        } 
 
        private void bt_canel_Click(object sender, EventArgs e) 
        { 
            this.Close(); 
        } 
 
        private void txt_Pass_KeyUp(object sender, KeyEventArgs e) 
        { 
            if (e.KeyCode == Keys.Enter) 
            { 
                this.bt_ok.Focus(); 
            } 
        } 
    } 
}