CeramicProject/newyt/App_Code/getuser.cs

45 lines
1.1 KiB
C#
Raw Normal View History

2024-05-18 15:28:29 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
/// <summary>
///getuser 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
2024-05-20 08:33:51 +08:00
public class getuser : System.Web.Services.WebService
{
2024-05-18 15:28:29 +08:00
2024-05-20 08:33:51 +08:00
public getuser()
{
2024-05-18 15:28:29 +08:00
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod(EnableSession = true)]
2024-05-21 15:05:24 +08:00
public bool IsAdmin()
2024-05-18 15:28:29 +08:00
{
2024-05-21 15:05:24 +08:00
bool permission = false;
2024-05-18 15:28:29 +08:00
if (HttpContext.Current.Session != null)
{
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(HttpContext.Current.Session["user"]);
if (user.zhanghao == "admin" && user.id == 1)
{
2024-05-21 15:05:24 +08:00
permission = true;
2024-05-18 15:28:29 +08:00
}
}
else
{
2024-05-21 15:05:24 +08:00
permission = false;
2024-05-18 15:28:29 +08:00
}
2024-05-20 08:33:51 +08:00
2024-05-21 15:05:24 +08:00
return permission;
2024-05-18 15:28:29 +08:00
}
2024-05-20 08:33:51 +08:00
2024-05-18 15:28:29 +08:00
}