Login.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class AdminManager_Login : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!string.IsNullOrEmpty(CookieInclude.CookieId))
  17.         {
  18.             Response.Redirect("Index.aspx");
  19.         }
  20.     }
  21.     protected void TxtUserName_ServerChange(object sender, EventArgs e)
  22.     {
  23.         
  24.     }
  25.     protected void TxtPassword_ServerChange(object sender, EventArgs e)
  26.     {
  27.     }
  28.     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  29.     {
  30.         SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
  31.         int matchi = WoYingCommon.LoginSet(this.TextBox_UserId.Value, this.TextBox_Password.Value, "Users", "UserId", "Password", conn, new SqlParameter("@UserId", SqlDbType.VarChar, 40));
  32.         if (matchi == 0)
  33.         {
  34.             MessageBox.Show("无此用户");
  35.         }
  36.         if (matchi == 1)
  37.         {
  38.             MessageBox.Show("密码错误");
  39.         }
  40.         if (matchi == 2)
  41.         {
  42.             Model.Users MU = new BLL.Users().GetPageList(1, 1, "ID", false, "UserId='" + this.TextBox_UserId.Value + "' and Password='" + this.TextBox_Password.Value + "'")[0];
  43.             SessionInclude.Id = MU.Id.ToString();
  44.             SessionInclude.SessionId = this.TextBox_UserId.Value;
  45.             if (DropDownList1.SelectedIndex == 0)
  46.             {
  47.                 CookieInclude.CookieId = this.TextBox_UserId.Value;
  48.                 CookieInclude.Id = MU.Id.ToString();
  49.             }
  50.             Response.Redirect("index.aspx");
  51.         }
  52.   
  53.     }
  54.    
  55. }