using System;
2using System.Data;
3using System.Data.SqlClient;
4using System.Configuration;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.WebControls;
9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11
12/// <summary>
13/// CheckLogin 的摘要说明
14/// </summary>
15public class CheckLogin
16{
17 public CheckLogin()
18 {
19 //
20 // TODO: 在此处添加构造函数逻辑
21 //
22 }
23 public int GiveID(string UserName, string PassWord)
24 {
25 SqlDataBase ThisB = new SqlDataBase();
26 string CheckSql = "select count(*) from UserList where UserName = '" + UserName + "' and PassWord = '" + PassWord + "'";
27 int ThisNum = Convert.ToInt32(ThisB.ReturnSQL(CheckSql));
28 if (ThisNum > 0)
29 {
30 string SqlType = "select * from UserList where UserName = '" + UserName + "' and PassWord = '" + PassWord + "'";
31 SqlDataReader ThRead = ThisB.GRead(SqlType);
32 while (ThRead.Read())
33 {
34 return Convert.ToInt32(ThRead["ID"]);
35 }
36 }
37 return 0;
38 }
39 public static bool CheckAdmin(int UserID)
40 {
41 SqlDataBase MyDb = new SqlDataBase();
42 string Log = Convert.ToString(MyDb.ReturnSQL("select UserType from UserList Where ID = '" + UserID + "'"));
43 if (Log == "1")
44 {
45 return true;
46 }
47 else
48 {
49 return false;
50 }
51 }
52 public static int GiveCheckAd(int UserID)
53 {
54 SqlDataBase MyDb = new SqlDataBase();
55 int Log = Convert.ToInt32(MyDb.ReturnSQL("select GoodsType from UserList Where ID = '" + UserID + "'"));
56 return Log;
57 }
58 public static DataTable GiveMsgGod(int UserID) //返回对应仓库的数量超限产品
59 {
60 SqlDataBase MyDb = new SqlDataBase();
61 int Log = Convert.ToInt32(MyDb.ReturnSQL("select Controls from UserList Where ID = '" + UserID + "'"));
62 string SqlString = "";
63 if (Log == 0)
64 {
65 SqlString = "select * from View_GoodMsg";
66 }
67 else
68 {
69 SqlString = "select * from View_GoodMsg where ID = '"+Log+"'";
70 }
71 return MyDb.DT(SqlString);
72 }
73 public static bool CheckKeepAdmin(int UserID)
74 {
75 SqlDataBase MyDb = new SqlDataBase();
76 string Log = Convert.ToString(MyDb.ReturnSQL("select GoodsType from UserList Where ID = '" + UserID + "'"));
77 if (Log == "0")
78 {
79 return true;
80 }
81 else
82 {
83 return false;
84 }
85 }
86}
CheckLogin.cs
最新推荐文章于 2022-09-28 20:53:01 发布