using System;
using System.Data;
using System.Data.SqlClient;
using CRM.DBUtility;
using CRM.Common;
public partial class Users_duanhuy_Default : System.Web.UI.Page
{
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (txtValidator.Text.Trim().ToLower() == CRM.Common.Validator.Validator.GetSessionValidator(Request.QueryString["sessionid"].ToString()).ToLower())
        {
            string temp = CRM.Common.Login.CheckLogin(txtUsername.Text.Trim(), txtPassword.Text.Trim());
            if (temp == "")
            {
                Panel1.Visible = false;
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Login", "<script>alert('" + temp + "');</script>");
            }
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "errorvalidator", "<script>alert('验证码错误');window.location.href='Default.aspx'</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Panel1.Visible = false;
            string checkCode = CRM.Common.Validator.Validator.GetStringInt(4);
            CRM.Common.Validator.Validator.SessionValidator(Session.SessionID.ToString(),checkCode);
           Session["CheckCode"] = checkCode;        
           HyperLink1.NavigateUrl = "Default.aspx";
           Image1.Attributes.Add("Src", "userValidator.aspx?code=" + CRM.Common.Validator.Validator.GetSessionValidator(Session.SessionID.ToString()));
           Button1.PostBackUrl = "Default.aspx?sessionid=" + Session.SessionID.ToString();
        }
    }
}
