/// <summary> /// 释放接口实例 /// </summary> public void DestoryInterface() { if (this.P_inter != null) { InterfaceHNDll.destoryinterface(this.P_inter); } }
/// <summary> /// 设置接口的运行模式 /// </summary> public int SetDebug(string filePath) { StringBuilder sb = new StringBuilder(); sb.Append(filePath); return(InterfaceHNDll.setdebug(this.P_inter, 1, sb)); }
/// <summary> /// 取结果或设置入参 /// </summary> /// <param name="result_Name"></param> /// <returns></returns> public void SetResultset(string result_Name) { long value = InterfaceHNDll.setresultset(this.P_inter, result_Name); if (-1 == value) { throw new Exception("取结果或设置入参错误,错误原因:" + GetMessage()); } }
/// <summary> /// 创建并初始化接口 /// </summary> public void NewInterfaceWithInit() { this.P_inter = InterfaceHNDll.newinterfacewithinit(this.Addr, this.Port, this.Servlet); if (null == this.P_inter || 0 > (int)this.P_inter) { throw new Exception("创建并初始化接口失败!!!"); } }
/// <summary> /// 设置IC卡设备的串口号 /// </summary> /// <param name="port">串口号</param> /// <returns></returns> public long SetICCommPort(int port) { long value = InterfaceHNDll.set_ic_commport(this.P_inter, port); if (0 > value) { throw new Exception("执行函数set_ic_commport错误,错误原因:" + GetMessage()); } return(value); }
/// <summary> /// 记录集的记录行数 /// </summary> /// <returns></returns> public long GetRowCount() { long value = InterfaceHNDll.getrowcount(this.P_inter); if (0 > value) { throw new Exception("执行函数getrowcount错误,错误原因:" + GetMessage()); } return(value); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="value"></param> public long PutCol(string name, string value) { long temp = InterfaceHNDll.putcol(this.P_inter, name, value); if (temp == -1) { throw new Exception("执行函数putcol错误,错误原因:" + GetMessage()); } return(temp); }
/// <summary> /// 获取异常信息 /// </summary> /// <returns></returns> public string GetException() { StringBuilder sbException = new StringBuilder(1024 * 1024); long value = InterfaceHNDll.getexception(this.P_inter, sbException); if (0 > value) { throw new Exception("执行函数getexception错误!!!"); } return(sbException.ToString()); }
/// <summary> /// 获取错误消息 /// </summary> /// <returns></returns> public string GetMessage() { StringBuilder sbError = new StringBuilder(1024 * 1024); long value = InterfaceHNDll.getmessage(this.P_inter, sbError); if (0 > value) { throw new Exception("执行函数getmessage出错!!!"); } return(sbError.ToString()); }
/// <summary> /// 从接口取得返回的参数值 /// </summary> /// <param name="name">要取得参数名称</param> /// <param name="value">获取的值</param> /// <param name="length">返回值的最大长度</param> /// <returns>返回值小于零, 表示没有Get成功,返回大于零表示为参数值的长度。用getmessage可以取得最近一次出错的错误信息</returns> public void GetByName(string name, ref string value, int length) { StringBuilder sbValue = new StringBuilder(length); int returnValue = InterfaceHNDll.getbyname(this.P_inter, name, sbValue); value = sbValue.ToString(); if (0 > returnValue) { throw new Exception("执行函数getbyname发生错误,错误原因:" + GetMessage()); } sbValue = null; }
/// <summary> /// 开始 /// </summary> /// <returns></returns> public void Start() { this.ParameterList.Add(new Parameter("oper_centerid", this.Oper_centerid)); this.ParameterList.Add(new Parameter("oper_hospitalid", this.Oper_hospitalid)); this.ParameterList.Add(new Parameter("oper_staffid", this.Oper_staffid)); long value = InterfaceHNDll.start(this.P_inter, this.Func_ID); if (-1 == value) { throw new Exception("接口调用开始失败,错误原因:" + GetMessage()); } PutCols(); }
/// <summary> /// 创建接口之后初始化 /// </summary> public void NewInterfaceAfterInit() { this.P_inter = InterfaceHNDll.newinterface(); if (null == this.P_inter || 0 > (int)this.P_inter) { throw new Exception("创建接口失败!!!"); } long value = InterfaceHNDll.init(this.P_inter, this.Addr, this.Port, this.Servlet); if (0 > value) { throw new Exception("初始化接口失败!!!"); } }
/// <summary> /// /// </summary> /// <param name="index"></param> /// <param name="name"></param> /// <param name="value"></param> public int GetByIndex(int index, ref string name, ref string value) { StringBuilder sbName = new StringBuilder(1024); StringBuilder sbValue = new StringBuilder(1024); int temp = InterfaceHNDll.getbyindex(this.P_inter, index, sbName, sbValue); name = sbName.ToString(); value = sbValue.ToString(); if (temp < 0) { throw new Exception("执行函数getbyindex发生错误,错误原因:" + GetMessage()); } return(temp); }
/// <summary> /// 跳到结果集后一行记录 /// </summary> public int NextRow() { return(InterfaceHNDll.nextrow(this.P_inter)); }
/// <summary> /// 运行 /// </summary> /// <returns></returns> public long Run() { return(InterfaceHNDll.run(this.P_inter)); }
/// <summary> /// 放置参数 /// </summary> /// <param name="row"></param> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> public long Put(long row, string name, string value) { return(InterfaceHNDll.put(this.P_inter, (int)row, name, value)); }