using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreFS.CA06;
using System.Data;
using System.Collections;
namespace Core.Mes.Client.Common
{
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;
ExecuteQueryToDataTable(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.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
int code = ccp.ReturnCode;
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;
ExecuteQueryToDataTable(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();
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// CommonClientToServer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.ClientSize = new System.Drawing.Size(736, 479);
this.Name = "CommonClientToServer";
this.Load += new System.EventHandler(this.CommonClientToServer_Load);
this.ResumeLayout(false);
}
private void CommonClientToServer_Load(object sender, EventArgs e)
{
}
}
}