資源簡介
Epicor10二次開發代碼,對Adapter使用封裝,以及UD表使用加強封裝.
采用反射方式調用對應Adapter中的方法.

代碼片段和文件信息
using?Ice.Lib.framework;
using?Ice.Lib.Searches;
using?System;
using?System.Collections.Generic;
using?System.Data;
using?System.IO;
using?System.Reflection;
using?System.Windows.Forms;
namespace?Epicor.SynergyIT
{
????public?class?Adpbase
????{
????????public?EpiTransaction?oTrans?=?null;
????????private?Type?Type?=?null;
????????private?object?Adp?=?null;
????????public?string?AdpName?=?““;
????????public?Adpbase()
????????{
????????}
????????public?Adpbase(object?otransstring?adpName?string?className1?=?null)
????????{
????????????InitAdp(otrans?adpName?className1);
????????}
????????///?初始化Adapter
????????public?void?InitAdp(object?otrans?string?adpName?string?className1?=?null)
????????{
????????????oTrans?=?(EpiTransaction)otrans;
????????????AdpName?=?adpName;
????????????string?dllfile?=?“Erp.Adapters.“?+?AdpName?+?“.dll“;
????????????string?className?=?“Erp.Adapters.“?+?AdpName?+?“Adapter“;
????????????if?(!File.Exists(Application.StartupPath?+?@“\“?+?dllfile))
????????????{
????????????????dllfile?=?“Ice.Adapters.“?+?AdpName?+?“.dll“;
????????????????className?=?“Ice.Adapters.“?+?AdpName?+?“Adapter“;
????????????}
????????????if?(!File.Exists(Application.StartupPath?+?@“\“?+?dllfile))
????????????{
????????????????dllfile?=?AdpName;
????????????????className?=?className1;
????????????}
????????????Assembly?assembly?=?Assembly.LoadFrom(Application.StartupPath?+?@“\“?+?dllfile);
????????????Type?=?assembly.GetType(className);
????????????Adp?=?Activator.CreateInstance(Type?new?object[]?{?otrans?});
????????????BOConnect();
????????}
????????///?析構函數?
????????~Adpbase()
????????{
????????????Dispose();
????????}
????????///批量新增數據
????????public?int?InsertData(string?newFunName?DataTable?dt?List?excludeCols?=?nullstring[]?colsName=nullType[]?type=null)
????????{
????????????int?result?=?0;
????????????try
????????????{
????????????????for?(int?r1?=?0;?r1?????????????????{
????????????????????DataRow?dr?=?dt.Rows[r1];
????????????????????bool?bl1?=?false;
????????????????????if?(colsName?!=?null)?{
????????????????????????Listject>?obj?=?new?Listject>();
????????????????????????for?(int?i?=?0;?i?????????????????????????bl1?=?(bool)InvokeFun(newFunName?obj.ToArray()type);
????????????????????}
????????????????????else?bl1?=?(bool)InvokeFun(newFunName);
????????????????????if?(bl1)
????????????????????{
????????????????????????DataSet?ds1?=?GetCurrentDataSet();
????????????????????????string?tableName?=?dt.TableName;
????????????????????????if?(!ds1.Tables.Contains(tableName))
????????????????????????{
????????????????????????????throw?new?Exception(“This?DataSet?does?not?contain?‘“?+?tableName?+?“‘?table.“);
????????????????????????}
????????????????????????int?r?=?ds1.Tables[tableName].Rows.Count?-?1;
????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????9930??2018-11-13?11:48??Adpba
?????文件????????2742??2018-11-13?11:48??AdpUDba
- 上一篇:基于waveIn API的錄音器
- 下一篇:TSNE 降維方法
評論
共有 條評論