using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using JY.BLL;
using JY.Model;

public partial class Login : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    /// <summary>
    /// 登录事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void LoginButton_Click(object sender, ImageClickEventArgs e)
    {
        string strUserName = txtUserName.Text.Trim();
        string strPassword = txtPassword.Text.Trim();

        JY.BLL.UserInfo bll = new JY.BLL.UserInfo();
        string strSql = " UserName='" + strUserName + "' and Password='" + strPassword + "' and isdelete=0";

        DataTable dt = bll.GetList(strSql).Tables[0];
        if (dt.Rows.Count > 0)
        {
            Session["UserName"] = dt.Rows[0]["UserName"].ToString();
            Session["UserType"] = dt.Rows[0]["UserType"].ToString();

            Response.Redirect("Index.aspx");
        }
        else
        {
            publicHandle.ShowMessage(this.Page, "用户名或密码不正确，请重新输入！");
        }
    }
}
