using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreFS.CA06;
using System.Data;
using System.Collections;
namespace Core.StlMes.Client.LgCommon
{
public class CommonClientToServer : FrmBase
{
///
/// 查询
///
/// 服务名
/// 方法名
/// 参数SqlID
/// DataSet
public DataSet ExecuteQueryFunctions(string ServerName, string MethodName, string ServerParams, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { ServerParams };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
strErr = ccp.ReturnInfo;
return ds;
}
///
/// 查询
///
/// 服务名
/// 方法名
/// SQLID
/// 参数
/// DataSet
public DataSet ExecuteQueryFunctions(string ServerName, string MethodName, ArrayList altParams, out string strErr)
{
try
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { altParams };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
this.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
catch
{
strErr = MethodName + "方法查询数据异常!";
return null;
}
}
///
/// 查询
///
/// 服务名
/// 方法名
/// SQLID
/// 参数
/// DataSet
public DataSet ExecuteQueryFunctions(string ServerName, string MethodName, string strSqlID, ArrayList altParams)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, altParams };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
ccp.IfShowErrMsg = false;
ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
///
/// 调用服务端业务执行返回结果
///
/// 服务名
/// 方法名
/// SQLID
/// 参数
/// DataSet
public CoreClientParam ExecuteClietnToServer(string ServerName, string MethodName, ArrayList altParams, out string strErr)
{
try
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { altParams };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
ccp.IfShowErrMsg = false;
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp;
}
catch
{
strErr = MethodName + "方法查询数据异常!";
return null;
}
}
///
/// 调用服务端业务执行返回结果ArrayList
///
/// 服务名
/// 方法名
/// SQLID
/// 参数
/// DataSet
public CoreClientParam ExecuteQueryArrayList(string ServerName, string MethodName, ArrayList altParams, out string strErr)
{
try
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { altParams };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp;
}
catch
{
strErr = MethodName + "方法查询数据异常!";
return null;
}
}
///
/// 增加、删除、修改
///
/// 服务名
/// 方法名
/// 参数
///
public string NoQueryFunctions(string ServerName, string MethodName, ArrayList ServerParams,out string strErr)
{
CoreClientParam ccp_K = new CoreClientParam();
ccp_K.ServerName = ServerName;
ccp_K.MethodName = MethodName;
ccp_K.ServerParams = new Object[] { ServerParams };
ExecuteNonQuery(ccp_K, CoreInvokeType.Internal);
strErr = ccp_K.ReturnInfo.ToString();
return ccp_K.ReturnInfo.ToString();
}
///
/// 执行存储过程
///
/// 服务名
/// 方法名
/// SQLID
/// 存储过程输入输出参数
/// 错误信息
/// 返回执行代码
public string ExecuteProcedureFunctions(string ServerName, string MethodName, string strSqlID, Hashtable ht, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, ht };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp.ReturnCode.ToString();
}
///
/// 执行存储过程
///
/// 服务名
/// 方法名
/// SQLID
/// 存储过程输入输出参数
/// 错误信息
/// 返回执行代码
public CoreClientParam ExecuteProcedureFunctionsCCP(string ServerName, string MethodName, string strSqlID, Hashtable ht, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, ht };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp;
}
///
/// 执行传输数组存储过程
///
/// 服务名
/// 方法名
/// SQLID
/// 存储过程输入输出参数
/// 错误信息
/// 返回执行代码
public string ExecuteProcedureFunctions(string ServerName, string MethodName, string strSqlID, object[] sArgs, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, sArgs };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp.ReturnCode.ToString();
}
///
/// 通过SqlID从数据表读取SQL语句进行查询
///
/// 服务名
/// 方法名
/// SQLID
/// 模块编码 1:销售管理,2:计划管理,3:质量管理, 4:仓库和发货管理、5:炼钢MES、6:轧钢MES
/// 参数
/// DataSet
/// 2012-10-30 新增方法
public DataSet ExecuteQueryFunctionsSqlID(string ServerName, string MethodName, string strSqlID, int moduleCode, ArrayList altParams, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, moduleCode, altParams };
DataTable dt = new DataTable();
ccp.SourceDataTable = dt;
ccp.IfShowErrMsg = false;
ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
///
/// 通过SqlID从数据表读取SQL语句执行存储过程
///
/// 服务名
/// 方法名
/// SQLID
/// 存储过程输入输出参数
/// 错误信息
/// 返回执行代码
/// 2012-10-30 新增方法
public CoreClientParam ExecuteProcedureFunctionsSqlID(string ServerName, string MethodName, string strSqlID, int moduleCode, Hashtable ht, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, moduleCode, ht };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp;
}
///
/// 通过SqlID从数据表读取SQL语句执行存储过程(传入数组)
///
/// 服务名
/// 方法名
/// SQLID
/// 存储过程输入输出参数
/// 错误信息
/// 返回执行代码
/// 2013-08-21 新增方法
public CoreClientParam ExecuteProcedureFunctionsSqlID(string ServerName, string MethodName, string strSqlID, int moduleCode, object[] sArgs, out string strErr)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = ServerName;
ccp.MethodName = MethodName;
ccp.ServerParams = new Object[] { strSqlID, moduleCode, sArgs };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
strErr = ccp.ReturnInfo;
return ccp;
}
}
}