一厂MES,含注塑,喷涂,冲孔
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

69 lines
2.5 KiB

using MESClassLibrary.BLL.User;
using MESClassLibrary.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace MESWebSite
{
/// <summary>
/// 页面工具类
/// lx 2017-06-27
/// </summary>
public static class HelperTools
{
/// <summary>
/// 是否开启按钮权限控制
/// </summary>
public static string BtnControlEnabled = ConfigurationManager.AppSettings["IsBtnControlEnabled"].ToString().Trim();
/// <summary>
/// 获取用户有权限的按钮
/// </summary>
/// <param name="menuID"></param>
/// <param name="userID"></param>
/// <returns></returns>
public static List<Sys_Buttons> GetUserButtons(string menuID, string userID)
{
Sys_ButtonsService btnService = new Sys_ButtonsService();
List<Sys_Buttons> userBtns = new List<Sys_Buttons>();
userBtns = btnService.GetUserButtons(menuID, userID);
return userBtns;
}
public static void WriteStringResult(this HttpContext context, String result)
{
context.Response.Write(result);
}
public static void WriteJsonResult(this HttpContext context, object obj, bool isSuccess, string message)
{
message = message.Replace("\"", "").Replace("'", "");
string json = JsonConvert.SerializeObject(obj);
string result = "{\"success\":" + isSuccess.ToString().ToLower() + ",\"message\":\"" + message + "\",\"data\":" + json + "}";
context.Response.Write(result);
}
public static void WriteJsonResult(this HttpContext context, object obj, bool isSuccess, int errorcode, string message)
{
message = message.Replace("\"", "").Replace("'", "");
string json = JsonConvert.SerializeObject(obj);
string result = "{\"success\":" + isSuccess.ToString().ToLower() + ",\"errorcode\":\"" + errorcode.ToString() + "\",\"message\":\"" + message + "\",\"data\":" + json + "}";
context.Response.Write(result);
}
public static void WriteJsonResult(this HttpContext context, object obj)
{
string json = JsonConvert.SerializeObject(obj);
string result = "{\"success\":" + true.ToString().ToLower() + ",\"message\":\"\",\"data\":" + json + "}";
context.Response.Write(result);
}
}
}