天津投入产出系统后端
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.

97 lines
2.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel.Activation;
using System.ServiceModel;
using System.Text;
using System.Reflection;
using QMFrameWork.ServiceInterface;
using QMFrameWork.ServiceLibrary;
using QMFrameWork.Common;
using QMFrameWork.Common.Serialization;
namespace QMFrameWork.WebServiceHost
{
/// <summary>
/// 通用服务
/// </summary>
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“GeneralService”。
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class GeneralService : IGeneralService
{
#region 统一接口
/// <summary>
/// 接收服务请求
/// </summary>
/// <param name="request">请求(不支持复杂类型)</param>
/// <returns>返回结果(不支持复杂类型)</returns>
public string RecevieRequest(string request)
{
ServiceRequest r = JsonConvertHelper.GetDeserialize<ServiceRequest>(request);
object result = null;
try
{
if (r.FunctionName == "ServiceInit")
return "success";
if (string.IsNullOrEmpty(request) == true)
throw new FaultException("请求头不能为空。");
//登录验证
//new AuthorizationManager().IsAuthorization(r);
result = new ServiceFactory().InvokeService(r);
return JsonConvertHelper.GetSerializes(result);
}
catch (Exception ex)
{
QMFrameWork.Log.LogManager.LogHelper.Error(
new QMFrameWork.Log.LogInfo { ClientIP = "localhost", UserName = "admin", Info = "执行服务异常", ErrorInfo = ex });
throw new FaultException(ex.Message);
}
}
#endregion
#region 获取服务列表
/// <summary>
/// 获取服务列表
/// </summary>
/// <returns>服务列表</returns>
public string[] GetServiceList()
{
try
{
return ServiceFactory.GetServiceList().ToArray();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 刷新数据锁定标志
/// <summary>
/// 刷新数据锁定标志
/// </summary>
public void RefreshDataLock()
{
bool isDataLock=new QMAPP.BLL.Sys.SystemLockBLL().IsHaveValidLock();
ServiceFactory.IsDataLock = isDataLock;
}
#endregion
}
}