ParmValue);
}
if (BIR.Request())
{
SrvResponse r = new SrvResponse(BIR.Response());
if (r.return_value == "1")
{
DataTable dt = r.GetResultTable();
dgv.DataSource = dt;
}
else
{
MessageBox.Show(BIR.Response());
}
}
else
{
MessageBox.Show(BIR.Response());
}
}
///
/// 把从数据库查询到的数据填充到一个DataTable对象中
///
/// 存储过程名称
/// 查询参数
///
public static DataTable FillDataTable(string act, System.Collections.ArrayList Parms)
{
BIRequest BIR = new BIRequest();
BIR.url = JCFXBL.API.Helper.ServerUrl + "Execute.ashx Serlet=GetDBStore&ACT=" + act;
if (Parms != null)
for (int i = 0; i < Parms.Count; i++)
{
PostParm p = (PostParm)Parms[i];
BIR.AddFormParam(p.ParmName, p.ParmValue);
}
if (BIR.Request())
{
SrvResponse r = new SrvResponse(BIR.Response());
if (r.return_value == "1")
{
DataTable dt = r.GetResultTable();
return dt;
}
else
{
MessageBox.Show(BIR.Response());
}
}
else
{
MessageBox.Show(BIR.Response());
}
return null;
}
}
}
using JCFXBL.SrvInterface;
using JCFXBL.SrvInterface.Core.ProtocolLayer;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace JCFXBL.API
{
public class Helper
{
public static string ServerUrl;
///
/// 把DIC字典数据自动填充进combox控件
///
/// 字典名称
/// combox控件对象
public static void FillComboxByDic(string dic, ComboBox cmb)
{
BIRequest BIR = new BIRequest();
BIR.url = Helper.ServerUrl + "Execute.ashx Serlet=GetDICStore&ACT=GET&dic=" + dic;
if (BIR.Request())
{
try
{
SrvResponse r = new SrvResponse(BIR.Response());
DataTable dt = r.GetResultTable();
cmb.DataSource = dt;
cmb.DisplayMember = "value";
cmb.ValueMember = "key";
}
catch (Exception ex)
{
// MessageBox.Show(ex.Message);
}
}
}
///
/// 把数据表中对应的数据字段填充进combox控件
///
/// combox控件对象
/// 查询参数
/// 存储过程名称
/// combox显示字段
/// combox值字段
public static void FillComboBoxByTable(ComboBox cmb, System.Collections.ArrayList Parms, string act, string DisplayMember, string ValueMember)
{
BIRequest BIR = new BIRequest();
BIR.url = Helper.ServerUrl + "Execute.ashx Serlet=GetDBStore&ACT=" + act;