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 HRManagerSystem.Bll;
//www.51aspx.com
namespace HRManagerSystem
{
    public partial class loginForm : Form
    {
        public loginForm()
        {
            InitializeComponent();
        }        
        public  string loginName;//用于用户名的存储
        DataDataContext ddc = new DataDataContext();
        public  bool mark = false;
     
        /// <summary>
        /// 确定提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
       private void btn_ok_Click(object sender, EventArgs e)
        {
            User user = new User();            
            if (ddc.T_Users.Select(se => se.User_Name == txt_username.Text && se.User_pwd == txt_pwd.Text).Count() > 0)
            {
                loginName = txt_username.Text;
                mark = true;             
                this.Close();
             }
            else
            {
                MessageBox.Show("用户名或密码错误！");
            }
  
        }

       private void btn_cancle_Click(object sender, EventArgs e)
       {
           this.Close();
           Environment.Exit(0);
       }

       private void chb_web_CheckedChanged(object sender, EventArgs e)
       {
           Program.check = chb_web .Checked; //选中 传到新页面          
       }

       private void loginForm_FormClosed(object sender, FormClosedEventArgs e)
       {
           this.Close();
           MainForm mf = new MainForm();
           if (!mark)
           {
               mf.Close();
               Environment.Exit(0);
           }
       }
    }
}
