• 大小: 3KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-29
  • 语言: 其他
  • 标签: Epicor10  Adapter  

资源简介

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 < dt.Rows.Count; r1++)
                {
                    DataRow dr = dt.Rows[r1];
                    bool bl1 = false;
                    if (colsName != null) {
                        Listject> obj = new Listject>();
                        for (int i = 0; i < colsName.Length; i++) obj.Add(dr[colsName[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  Adpbase.cs
     文件        2742  2018-11-13 11:48  AdpUDbase.cs

评论

共有 条评论