📄 frametrace.cs
字号:
namespace FrameCountry
{
using System;
using System.Data;
using System.Xml;
internal class FrameTrace
{
private string chapterName;
private string ClassAlias = "TR";
private string commandName;
private FrameConn Conn = new FrameConn();
private string depiction = "";
private FrameCity frameCity = new FrameCity();
private FrameNode frameNode = new FrameNode();
private bool isTableCommand = false;
private string mainInfo = "";
private string mainSQL = "";
private string serviceName;
private string tailInfo = "";
public FrameValue Value;
public FrameWhere Where;
public FrameTrace(string configInfo)
{
string functionAlias = "02";
string errorInfo = "";
this.Conn.ConfigInfo = configInfo;
if (!this.Conn.StartConn(ref errorInfo))
{
throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo));
}
this.Where = new FrameWhere(this.Conn.DBType);
this.Value = new FrameValue(this.Conn.DBType);
}
public bool CloseConn(ref string ErrorInfo)
{
string functionAlias = "03";
string errorInfo = "";
if (!this.Conn.CloseConn(ref errorInfo))
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
return false;
}
return true;
}
public bool CreatNewState(string ServiceName, string ChapterName, string CommandName, ref string ErrorInfo)
{
string functionAlias = "04";
if (((this.serviceName == ServiceName) && (this.chapterName == ChapterName)) && (this.commandName == CommandName))
{
this.Value.Clear();
this.Where.Clear();
}
else
{
this.serviceName = ServiceName;
this.chapterName = ChapterName;
this.commandName = CommandName;
string errorInfo = "";
if (!this.Getanalyse(ref errorInfo))
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "◇" + errorInfo);
return false;
}
}
return true;
}
private string DealTableMainInfo()
{
if (this.isTableCommand)
{
switch (this.commandName.ToLower())
{
case "select":
return ("select * from " + this.mainInfo + " where 1=1");
case "insert":
return ("insert into " + this.mainInfo + "");
case "update":
return ("update " + this.mainInfo + "");
case "delete":
return ("delete from " + this.mainInfo + "");
}
}
else
{
if (this.commandName.ToLower() == "insert")
{
return ("insert into " + this.mainInfo);
}
if (this.commandName.ToLower() == "update")
{
return ("update " + this.mainInfo);
}
if (this.commandName.ToLower() == "delete")
{
return ("delete from " + this.mainInfo);
}
if ((this.commandName.ToLower() == "procedure") || (this.commandName.ToLower() == "procedurequery"))
{
return ("{ call " + this.mainInfo);
}
}
return this.mainInfo;
}
private string DealTableTailInfo()
{
if ((this.commandName.ToLower() == "procedure") || (this.commandName.ToLower() == "procedurequery"))
{
return "}";
}
return this.tailInfo;
}
public bool ExeNonQuery(ref string ErrorInfo)
{
string functionAlias = "07";
string errorInfo = "";
string returnFabricate = "";
try
{
switch (this.commandName.ToLower())
{
case "select":
case "procedurequery":
throw new Exception("操作类型 " + this.commandName + " 不能在 ExeNonQuery 函数中被执行!");
}
if (!this.Fabricate(ref returnFabricate, ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
if (!this.Conn.ExeNonQuery(returnFabricate, 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(ref DataSet ds, ref string ErrorInfo)
{
string functionAlias = "08";
string returnFabricate = "";
string errorInfo = "";
try
{
string str4 = this.commandName.ToLower().Trim();
if ((!(str4 == "select") && !(str4 == "procedurequery")) && (!(str4 == "other") && !(str4 == "single")))
{
throw new Exception("操作类型 " + this.commandName + " 不能在 ExeQuery 函数中被执行!");
}
if (!this.Fabricate(ref returnFabricate, ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
if (!this.Conn.ExeQuery(returnFabricate, ref ds, 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(ref DataSet ds, string TableName, ref string ErrorInfo)
{
string functionAlias = "09";
string errorInfo = "";
string returnFabricate = "";
try
{
string str4 = this.commandName.ToLower();
if ((str4 == "select") || (str4 == "procedurequery"))
{
if (!this.Fabricate(ref returnFabricate, ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
if (!this.Conn.ExeQueryExtend(returnFabricate, ref ds, TableName, ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
}
else
{
errorInfo = "操作类型 " + this.commandName + " 不能在 ExeQueryExtend 函数中被执行!";
throw new Exception();
}
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
return false;
}
return true;
}
private bool Fabricate(ref string returnFabricate, ref string ErrorInfo)
{
string functionAlias = "06";
string returnSQL = "";
string errorInfo = "";
if (this.commandName.ToLower().Trim() == "single")
{
returnFabricate = this.mainSQL;
}
else
{
if (!this.Value.ReplaceValue(ref returnSQL, this.commandName, ref errorInfo))
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -