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

📄 frametown.cs

📁 结构很好的三层数据访问组件。开放源码。是微软企业库数据访问的替代产品之一。
💻 CS
📖 第 1 页 / 共 2 页
字号:
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
                this.WriteLog("ExeQueryExtend", TransXML, ErrorInfo, now, ref ErrorInfo);
                return false;
            }
            this.WriteLog("ExeQueryExtend", TransXML, "", now, ref ErrorInfo);
            return true;
        }

        public bool ExeSingleNonQuery(FrameBridge frameBridge, ref string ErrorInfo)
        {
            string functionAlias = "17";
            string strTransXML = "";
            string errorInfo = "";
            try
            {
                if (!frameBridge.GetTransXML(ref strTransXML, ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.ExeSingleNonQuery(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 ExeSingleNonQuery(string TransXML, ref string ErrorInfo)
        {
            string functionAlias = "16";
            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.TransactionStart(ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.frameTrace.ExeNonQuery(ref errorInfo))
                {
                    throw new Exception("◇" + errorInfo);
                }
                if (!this.frameTrace.TransactionFinish(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;
        }

        private bool Finally(ref string ErrorInfo)
        {
            string functionAlias = "09";
            string errorInfo = "";
            if (this.frameTrace.CloseConn(ref errorInfo))
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                return false;
            }
            return true;
        }

        private bool GetDebugType(ref string ErrorInfo)
        {
            string functionAlias = "11";
            string innerText = "";
            string errorInfo = "";
            try
            {
                FrameNode node = new FrameNode();
                if (!node.GetNodeInnerText("frameconnect", "./ConfigList/Debug/DebugType", ref innerText, ref errorInfo))
                {
                    throw new Exception(errorInfo);
                }
                this.DebugType = int.Parse(innerText);
            }
            catch (Exception exception)
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "读取 Debug 信息错误!\n\r错误信息如下:\n\r" + exception.Message);
                return false;
            }
            return true;
        }

        public bool TransactionFinish(ref string ErrorInfo)
        {
            string functionAlias = "08";
            string errorInfo = "";
            if (!this.frameTrace.TransactionFinish(ref errorInfo))
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                return false;
            }
            return true;
        }

        public bool TransactionStart(ref string ErrorInfo)
        {
            string functionAlias = "07";
            string errorInfo = "";
            if (!this.frameTrace.TransactionStart(ref errorInfo))
            {
                ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                return false;
            }
            this.transactionID = this.frameMath.GenerateCheckCode(20);
            return true;
        }

        private bool WriteLog(string FunctionStr, string TransXML, string ErrStr, DateTime StartTime, ref string ErrorInfo)
        {
            string str2;
            string functionAlias = "10";
            string errorInfo = "";
            FrameCity city = new FrameCity();
            int num = 0x3e8 + StartTime.Millisecond;
            string str4 = StartTime.ToString() + "." + num.ToString().Substring(1, 3);
            num = 0x3e8 + DateTime.Now.Millisecond;
            string str5 = DateTime.Now.ToString() + "." + num.ToString().Substring(1, 3);
            switch (this.DebugType)
            {
                case 1:
                    if (!(ErrStr != ""))
                    {
                        break;
                    }
                    str2 = "┏━━━━━━━━━━ FrameCountry Debug ━━━━━━━━━━┓\n";
                    str2 = ((((((str2 + "┣StartTime: " + str4 + "\n") + "┣EndTime: " + str5 + "\n") + "┣Function: " + FunctionStr + "\n") + "┣TransactionID:" + this.TransactionID + "\n") + "┣━━━━━━┫Information\n" + TransXML + "\n") + "┣━━━━━━┫Error\n" + ErrStr + "\n") + "┗━━━━━━━━━━━━━ End ━━━━━━━━━━━━━━┛";
                    if (city.WriteFrameTownLog(this.conFile, str2, ref errorInfo))
                    {
                        break;
                    }
                    ErrorInfo = city.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                    return false;

                case 2:
                    if (!(ErrStr != ""))
                    {
                        break;
                    }
                    str2 = "┏━━━━━━━━━━ FrameCountry Debug ━━━━━━━━━━┓\n";
                    str2 = (((((str2 + "┣StartTime: " + str4 + "\n") + "┣EndTime: " + str5 + "\n") + "┣Function: " + FunctionStr + "\n") + "┣TransactionID:" + this.TransactionID + "\n") + "┣━━━━━━┫Information\n" + TransXML + "\n") + "┣━━━━━━┫Error┣━━━━━━┫\n" + ErrStr + "\n";
                    if (this.frameTrace.TransactionContent != "")
                    {
                        str2 = str2 + "┣━━━━━━┫Transaction\n" + this.frameTrace.TransactionContent + "\n";
                    }
                    str2 = str2 + "┗━━━━━━━━━━━━━ End ━━━━━━━━━━━━━━┛";
                    if (city.WriteFrameTownLog(this.conFile, str2, ref errorInfo))
                    {
                        break;
                    }
                    ErrorInfo = city.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                    return false;

                case 3:
                    str2 = "┏━━━━━━━━━━ FrameCountry Debug ━━━━━━━━━━┓\n";
                    str2 = (((str2 + "┣StartTime: " + str4 + "\n") + "┣EndTime: " + str5 + "\n") + "┣Function: " + FunctionStr + "\n") + "┣TransactionID:" + this.TransactionID + "\n";
                    if (TransXML != "")
                    {
                        str2 = str2 + "┣━━━━━━┫Information\n" + TransXML + "\n";
                    }
                    if (ErrStr != "")
                    {
                        str2 = str2 + "┣━━━━━━┫Error\n" + ErrStr + "\n";
                    }
                    if ((this.frameTrace.TransactionContent != "") && (ErrStr != ""))
                    {
                        str2 = str2 + "┣━━━━━━┫Transaction\n" + this.frameTrace.TransactionContent + "\n";
                    }
                    str2 = str2 + "┗━━━━━━━━━━━━━ End ━━━━━━━━━━━━━━┛";
                    if (city.WriteFrameTownLog(this.conFile, str2, ref errorInfo))
                    {
                        break;
                    }
                    ErrorInfo = city.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                    return false;

                case 4:
                    str2 = "┏━━━━━━━━━━ FrameCountry Debug ━━━━━━━━━━┓\n";
                    str2 = (((str2 + "┣StartTime: " + str4 + "\n") + "┣EndTime: " + str5 + "\n") + "┣Function: " + FunctionStr + "\n") + "┣TransactionID:" + this.TransactionID + "\n";
                    if (TransXML != "")
                    {
                        str2 = (str2 + "┣━━━━━━┫Information\n" + TransXML + "\n") + "┣━━━━━━┫CurrentSQLLanguage\n" + this.frameTrace.CurrentSQLL + "\n";
                    }
                    if (ErrStr != "")
                    {
                        str2 = str2 + "┣━━━━━━┫Error\n" + ErrStr + "\n";
                    }
                    if ((this.frameTrace.TransactionContent != "") && (ErrStr != ""))
                    {
                        str2 = str2 + "┣━━━━━━┫Transaction\n" + this.frameTrace.TransactionContent + "\n";
                    }
                    str2 = str2 + "┗━━━━━━━━━━━━━ End ━━━━━━━━━━━━━━┛";
                    if (!city.WriteFrameTownLog(this.conFile, str2, ref errorInfo))
                    {
                        ErrorInfo = city.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
                        return false;
                    }
                    break;
            }
            return true;
        }

        public int ConnTimeout
        {
            get
            {
                return this.frameTrace.ConnTimeout;
            }
            set
            {
                this.frameTrace.ConnTimeout = value;
            }
        }

        public int DebugType
        {
            get
            {
                return this.debugType;
            }
            set
            {
                if (((value == 0) || (value == 1)) || (((value == 2) || (value == 3)) || (value == 4)))
                {
                    this.debugType = value;
                }
                else
                {
                    this.debugType = 0;
                }
            }
        }

        private string TransactionID
        {
            get
            {
                return this.transactionID;
            }
        }
    }
}

⌨️ 快捷键说明

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