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
{
///
/// 通用服务
///
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“GeneralService”。
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class GeneralService : IGeneralService
{
#region 统一接口
///
/// 接收服务请求
///
/// 请求(不支持复杂类型)
/// 返回结果(不支持复杂类型)
public string RecevieRequest(string request)
{
ServiceRequest r = JsonConvertHelper.GetDeserialize(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 获取服务列表
///
/// 获取服务列表
///
/// 服务列表
public string[] GetServiceList()
{
try
{
return ServiceFactory.GetServiceList().ToArray();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 刷新数据锁定标志
///
/// 刷新数据锁定标志
///
public void RefreshDataLock()
{
bool isDataLock=new QMAPP.BLL.Sys.SystemLockBLL().IsHaveValidLock();
ServiceFactory.IsDataLock = isDataLock;
}
#endregion
}
}