⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frametown.cs

📁 结构很好的三层数据访问组件。开放源码。是微软企业库数据访问的替代产品之一。
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace FrameCountry
{
    using FrameCountry.FrameBuild;
    using System;
    using System.Data;

    public class FrameTown
    {
        private string ClassAlias;
        private string conFile;
        public FrameDataSet Data;
        private int debugType;
        private FrameBridge frameBridge;
        private FrameCity frameCity;
        private FrameMath frameMath;
        private FramePolice framePolice;
        private FrameTrace frameTrace;
        private string transactionID;

        public FrameTown()
        {
            this.ClassAlias = "TN";
            this.frameCity = new FrameCity();
            this.conFile = "";
            this.debugType = 0;
            this.frameBridge = new FrameBridge();
            this.framePolice = new FramePolice();
            this.frameMath = new FrameMath();
            this.transactionID = "";
            this.Data = new FrameDataSet();
            string functionAlias = "02";
            string errorInfo = "";
            this.frameTrace = new FrameTrace("FrameConnect");
            this.conFile = "FrameConnect";
            if (!this.GetDebugType(ref errorInfo))
            {
                throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo));
            }
        }

        public FrameTown(string configInfo)
        {
            this.ClassAlias = "TN";
            this.frameCity = new FrameCity();
            this.conFile = "";
            this.debugType = 0;
            this.frameBridge = new FrameBridge();
            this.framePolice = new FramePolice();
            this.frameMath = new FrameMath();
            this.transactionID = "";
            this.Data = new FrameDataSet();
            string functionAlias = "03";
            string errorInfo = "";
            if ("" == configInfo)
            {
                configInfo = "FrameConnect";
            }
            this.frameTrace = new FrameTrace(configInfo);
            this.conFile = configInfo;
            if (!this.GetDebugType(ref errorInfo))
            {
                throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo));
            }
        }

        public bool ExeNonQuery(FrameBridge frameBridge, ref string ErrorInfo)
        {
            string functionAlias = "13";
            string strTransXML = "";
            string errorInfo = "";
            try
            {
                if (!frameBridge.GetTransXML(ref strTransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.ExeNonQuery(strTransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
                return false;
            }
            return true;
        }

        public bool ExeNonQuery(string TransXML, ref string ErrorInfo)
        {
            string functionAlias = "04";
            string errorInfo = "";
            string theName = "";
            string operater = "";
            DateTime now = DateTime.Now;
            try
            {
                if (!this.frameBridge.SetTransXML(TransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (this.frameBridge.ServiceName == "")
                {
                    this.frameBridge.ServiceName = "FrameConfig";
                }
                if (!this.frameTrace.CreatNewState(this.frameBridge.ServiceName, this.frameBridge.ChapterName, this.frameBridge.CommandName, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                this.frameTrace.MainSQL = this.frameBridge.MainSQL;
                for (int i = 0; i < this.frameBridge.TransValue.Count; i++)
                {
                    if (!this.frameBridge.TransValue.GetName(i, ref theName, ref errorInfo))
                    {
                        throw new Exception("◇" + errorInfo);
                    }
                    this.frameTrace.Value[theName] = this.frameBridge.TransValue[theName];
                }
                for (int j = 0; j < this.frameBridge.TransWhere.Count; j++)
                {
                    if (!this.frameBridge.TransWhere.GetName(j, ref theName, ref operater, ref errorInfo))
                    {
                        throw new Exception("◇" + errorInfo);
                    }
                    this.frameTrace.Where[theName, operater] = this.frameBridge.TransWhere[theName, operater];
                }
                if (!this.frameTrace.ExeNonQuery(ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
                this.WriteLog("ExeNonQuery", TransXML, ErrorInfo, now, ref ErrorInfo);
                this.frameTrace.TransactionContent = "";
                return false;
            }
            this.WriteLog("ExeNonQuery", TransXML, "", now, ref ErrorInfo);
            return true;
        }

        public bool ExeQuery(FrameBridge frameBridge, ref DataSet returnDS, ref string ErrorInfo)
        {
            string functionAlias = "14";
            string strTransXML = "";
            string errorInfo = "";
            try
            {
                if (!frameBridge.GetTransXML(ref strTransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.ExeQuery(strTransXML, ref returnDS, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
                return false;
            }
            return true;
        }

        public bool ExeQuery(string TransXML, ref DataSet returnDS, ref string ErrorInfo)
        {
            string functionAlias = "05";
            string errorInfo = "";
            string theName = "";
            string operater = "";
            DateTime now = DateTime.Now;
            try
            {
                returnDS.Clear();
                if (!this.frameBridge.SetTransXML(TransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (this.frameBridge.ServiceName == "")
                {
                    this.frameBridge.ServiceName = "FrameConfig";
                }
                if (!this.frameTrace.CreatNewState(this.frameBridge.ServiceName, this.frameBridge.ChapterName, this.frameBridge.CommandName, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                this.frameTrace.MainSQL = this.frameBridge.MainSQL;
                for (int i = 0; i < this.frameBridge.TransValue.Count; i++)
                {
                    if (!this.frameBridge.TransValue.GetName(i, ref theName, ref errorInfo))
                    {
                        throw new Exception("◇" + errorInfo);
                    }
                    this.frameTrace.Value[theName] = this.frameBridge.TransValue[theName];
                }
                for (int j = 0; j < this.frameBridge.TransWhere.Count; j++)
                {
                    if (!this.frameBridge.TransWhere.GetName(j, ref theName, ref operater, ref errorInfo))
                    {
                        throw new Exception("◇" + errorInfo);
                    }
                    this.frameTrace.Where[theName, operater] = this.frameBridge.TransWhere[theName, operater];
                }
                if (!this.frameTrace.ExeQuery(ref returnDS, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.Data.SetDataSet(returnDS, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
                this.WriteLog("ExeQuery", TransXML, ErrorInfo, now, ref ErrorInfo);
                ErrorInfo = ErrorInfo;
                return false;
            }
            this.WriteLog("ExeQuery", TransXML, "", now, ref ErrorInfo);
            return true;
        }

        public bool ExeQueryExtend(FrameBridge frameBridge, ref DataSet returnDS, string TableName, ref string ErrorInfo)
        {
            string functionAlias = "15";
            string strTransXML = "";
            string errorInfo = "";
            try
            {
                if (!frameBridge.GetTransXML(ref strTransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.ExeQueryExtend(strTransXML, ref returnDS, TableName, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
                return false;
            }
            return true;
        }

        public bool ExeQueryExtend(string TransXML, ref DataSet returnDS, string TableName, ref string ErrorInfo)
        {
            string functionAlias = "06";
            string errorInfo = "";
            string theName = "";
            string operater = "";
            DateTime now = DateTime.Now;
            try
            {
                if (!this.frameBridge.SetTransXML(TransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (this.frameBridge.ServiceName == "")
                {
                    this.frameBridge.ServiceName = "FrameConfig";
                }
                if (!this.frameTrace.CreatNewState(this.frameBridge.ServiceName, this.frameBridge.ChapterName, this.frameBridge.CommandName, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                this.frameTrace.MainSQL = this.frameBridge.MainSQL;
                for (int i = 0; i < this.frameBridge.TransValue.Count; i++)
                {
                    if (!this.frameBridge.TransValue.GetName(i, ref theName, ref errorInfo))
                    {
                        throw new Exception("◇" + errorInfo);
                    }
                    this.frameTrace.Value[theName] = this.frameBridge.TransValue[theName];
                }
                for (int j = 0; j < this.frameBridge.TransWhere.Count; j++)
                {
                    if (!this.frameBridge.TransWhere.GetName(j, ref theName, ref operater, ref errorInfo))
                    {
                        throw new Exception("◇" + errorInfo);
                    }
                    this.frameTrace.Where[theName, operater] = this.frameBridge.TransWhere[theName, operater];
                }
                if (!this.frameTrace.ExeQueryExtend(ref returnDS, TableName, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -