|
|
@ -1,226 +0,0 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Web; |
|
|
|
using System.Web.UI.WebControls; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///ManagePage 的摘要说明
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
namespace Basic |
|
|
|
{ |
|
|
|
public class ManagePage : System.Web.UI.Page |
|
|
|
{ |
|
|
|
protected internal Model.siteconfig siteConfig; |
|
|
|
|
|
|
|
public ManagePage() |
|
|
|
{ |
|
|
|
this.Load += new EventHandler(ManagePage_Load); |
|
|
|
siteConfig = new BLL.siteconfig().loadConfig(Basic.Tools.Utils.GetXmlMapPath("Configpath")); |
|
|
|
} |
|
|
|
|
|
|
|
private void ManagePage_Load(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
//判断管理员是否登录
|
|
|
|
if (!IsAdminLogin()) |
|
|
|
{ |
|
|
|
Response.Write("<script>parent.location.href='" + siteConfig.webpath + siteConfig.webmanagepath + "/login.aspx'</script>"); |
|
|
|
Response.End(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#region 管理员============================================
|
|
|
|
/// <summary>
|
|
|
|
/// 判断管理员是否已经登录(解决Session超时问题)
|
|
|
|
/// </summary>
|
|
|
|
public bool IsAdminLogin() |
|
|
|
{ |
|
|
|
//如果Session为Null
|
|
|
|
if (Session[Keys.SESSION_ADMIN_INFO] != null) |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//检查Cookies
|
|
|
|
string adminname = Basic.Tools.Utils.GetCookie("AdminName", "str_key"); //解密用户名
|
|
|
|
string adminpwd = Basic.Tools.Utils.GetCookie("AdminPwd", "str_key"); |
|
|
|
if (adminname != "" && adminpwd != "") |
|
|
|
{ |
|
|
|
|
|
|
|
DAL.manager dal = new DAL.manager(); |
|
|
|
Model.manager model = dal.GetModel(adminname, adminpwd); |
|
|
|
if (model != null) |
|
|
|
{ |
|
|
|
Session[Keys.SESSION_ADMIN_INFO] = model; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取得管理员信息
|
|
|
|
/// </summary>
|
|
|
|
public Model.manager GetAdminInfo() |
|
|
|
{ |
|
|
|
if (IsAdminLogin()) |
|
|
|
{ |
|
|
|
Model.manager model = Session[Keys.SESSION_ADMIN_INFO] as Model.manager; |
|
|
|
if (model != null) |
|
|
|
{ |
|
|
|
return model; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查管理员权限
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="channel_id">频道ID</param>
|
|
|
|
/// <param name="action_type">操作类型</param>
|
|
|
|
public void ChkAdminLevel(int channel_id, string action_type) |
|
|
|
{ |
|
|
|
Model.manager model = GetAdminInfo(); |
|
|
|
BLL.manager_role bll = new BLL.manager_role(); |
|
|
|
bool result = bll.Exists(model.role_id, channel_id, action_type); |
|
|
|
if (!result) |
|
|
|
{ |
|
|
|
string msbox = "parent.f_errorTab(\"错误提示\", \"您没有管理该页面的权限,请勿尝试非法进入!\")"; |
|
|
|
//ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox.ToString(), true); //修正BUG
|
|
|
|
Response.Write("<script type=\"text/javascript\">" + msbox + "</script>"); |
|
|
|
Response.End(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查管理员权限
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="channel_name">栏目名称</param>
|
|
|
|
/// <param name="action_type">操作类型</param>
|
|
|
|
public void ChkAdminLevel(string channel_name, string action_type) |
|
|
|
{ |
|
|
|
Model.manager model = GetAdminInfo(); |
|
|
|
BLL.manager_role bll = new BLL.manager_role(); |
|
|
|
bool result = bll.Exists(model.role_id, channel_name, action_type); |
|
|
|
if (!result) |
|
|
|
{ |
|
|
|
if (Basic.Tools.WebInfo.LoginResult != model.user_pwd) |
|
|
|
{ |
|
|
|
string msbox = "parent.f_errorTab(\"错误提示\", \"您没有管理该页面的权限,请勿尝试非法进入!\")"; |
|
|
|
//ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox.ToString(), true); //修正BUG
|
|
|
|
Response.Write("<script type=\"text/javascript\">" + msbox + "</script>"); |
|
|
|
Response.End(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查是否有该专营店的操作权限
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ShopId">ShopId</param>
|
|
|
|
/// <param name="ShopId2">ShopId2</param>
|
|
|
|
public void ChkShopId(int ShopId, int ShopId2) |
|
|
|
{ |
|
|
|
if (ShopId != ShopId2) |
|
|
|
{ |
|
|
|
string msbox = "parent.f_errorTab(\"错误提示\", \"您没有管理该页面的权限,请勿尝试非法进入!\")"; |
|
|
|
//ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox.ToString(), true); //修正BUG
|
|
|
|
Response.Write("<script type=\"text/javascript\">" + msbox + "</script>"); |
|
|
|
Response.End(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 操作成功
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="result">结果</param>
|
|
|
|
/// <param name="msgtitle">标题</param>
|
|
|
|
/// <param name="msgcss">内容</param>
|
|
|
|
protected void JsShowMsg(string result, string msgtitle, string msgcss) |
|
|
|
{ |
|
|
|
string msbox = "parent.f_errorTab(\"" + msgtitle + "\", \"" + msgcss + "\")"; |
|
|
|
if (result == "success") |
|
|
|
msbox = "parent.f_successTab(\"" + msgtitle + "\", \"" + msgcss + "\")"; |
|
|
|
Response.Write("<script type=\"text/javascript\">" + msbox + "</script>"); |
|
|
|
Response.End(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 添加编辑删除提示
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="msgtitle">提示文字</param>
|
|
|
|
/// <param name="url">返回地址</param>
|
|
|
|
/// <param name="msgcss">CSS样式</param>
|
|
|
|
protected void JscriptMsg(string msgtitle, string url, string msgcss) |
|
|
|
{ |
|
|
|
string msbox = "parent.jsprint(\"" + msgtitle + "\", \"" + url + "\", \"" + msgcss + "\")"; |
|
|
|
ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox, true); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 带回传函数的添加编辑删除提示
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="msgtitle">提示文字</param>
|
|
|
|
/// <param name="url">返回地址</param>
|
|
|
|
/// <param name="msgcss">CSS样式</param>
|
|
|
|
/// <param name="callback">JS回调函数</param>
|
|
|
|
protected void JscriptMsg(string msgtitle, string url, string msgcss, string callback) |
|
|
|
{ |
|
|
|
string msbox = "parent.jsprint(\"" + msgtitle + "\", \"" + url + "\", \"" + msgcss + "\", " + callback + ")"; |
|
|
|
ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox, true); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查字段权限
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="field">字段名称</param>
|
|
|
|
/// <param name="action_type">操作类型</param>
|
|
|
|
public bool ChkField(string field, string action_type) |
|
|
|
{ |
|
|
|
Model.manager model = GetAdminInfo(); |
|
|
|
DAL.manager dal = new DAL.manager(); |
|
|
|
Model.manager model1 = dal.GetModel(model.user_name); |
|
|
|
if (model1.role_type == 1) |
|
|
|
return false; |
|
|
|
BLL.manager_role bll = new BLL.manager_role(); |
|
|
|
bool result = bll.Exists(model.role_id, field, action_type); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查字段权限
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="field">字段名称</param>
|
|
|
|
/// <param name="action_type">操作类型</param>
|
|
|
|
public bool ChkFieldStatistics(string field, string action_type) |
|
|
|
{ |
|
|
|
Model.manager model = GetAdminInfo(); |
|
|
|
DAL.manager dal = new DAL.manager(); |
|
|
|
Model.manager model1 = dal.GetModel(model.user_name); |
|
|
|
if (model1.role_type == 1) |
|
|
|
return true; |
|
|
|
BLL.manager_role bll = new BLL.manager_role(); |
|
|
|
bool result = bll.Exists(model.role_id, field, action_type); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查管理员统计分析权限
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="channel_name">栏目名称</param>
|
|
|
|
/// <param name="action_type">操作类型</param>
|
|
|
|
public bool ChkStatistics(string channel_name, string action_type) |
|
|
|
{ |
|
|
|
Model.manager model = GetAdminInfo(); |
|
|
|
BLL.manager_role bll = new BLL.manager_role(); |
|
|
|
bool result = bll.Exists(model.role_id, channel_name, action_type); |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |