📄 framebridge.cs
字号:
namespace FrameCountry
{
using System;
using System.Xml;
public class FrameBridge
{
private string ClassAlias;
private FrameCity frameCity;
private string mainSQL;
public FrameTransValue TransValue;
public FrameTransWhere TransWhere;
private XmlDocument TransXmlDoc;
public FrameBridge()
{
this.ClassAlias = "BD";
this.frameCity = new FrameCity();
this.TransXmlDoc = new XmlDocument();
string functionAlias = "01";
string errorInfo = "";
try
{
string xml = "<?xml version='1.0' encoding='gb2312'?><ParamList ServiceName='' ChapterName='' CommandName=''><MainSQL></MainSQL><ValueList></ValueList><WhereList></WhereList><OrderList></OrderList></ParamList>";
this.TransXmlDoc.LoadXml(xml);
if (!this.Analyze(ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
}
catch (Exception exception)
{
throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "FrameBridge类加载错误!\n\r错误信息如下:\n\r" + exception.Message));
}
}
public FrameBridge(string strTransXML)
{
this.ClassAlias = "BD";
this.frameCity = new FrameCity();
this.TransXmlDoc = new XmlDocument();
string functionAlias = "00";
string errorInfo = "";
try
{
this.TransXmlDoc.LoadXml(strTransXML);
if (!this.Analyze(ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
}
catch (Exception exception)
{
throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "FrameBridge类加载错误!\n\r错误信息如下:\n\r" + exception.Message));
}
}
private bool Analyze(ref string ErrorInfo)
{
string functionAlias = "04";
try
{
this.mainSQL = this.TransXmlDoc.SelectNodes("./ParamList/MainSQL")[0].InnerText;
this.TransValue = new FrameTransValue(this.TransXmlDoc.SelectNodes("./ParamList/ValueList")[0].InnerXml);
this.TransWhere = new FrameTransWhere(this.TransXmlDoc.SelectNodes("./ParamList/WhereList")[0].InnerXml);
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
return false;
}
return true;
}
private bool Assembled(ref string ErrorInfo)
{
string functionAlias = "05";
string errorInfo = "";
try
{
string nodeInnerXML = "";
string str4 = "";
if (!this.TransValue.GetValueXmlNode(ref nodeInnerXML, ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
if (!this.TransWhere.GetWhereXmlNode(ref str4, ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
this.TransXmlDoc.SelectNodes("./ParamList")[0].InnerXml = "<MainSQL>" + this.mainSQL + "</MainSQL><ValueList>" + nodeInnerXML + "</ValueList><WhereList>" + str4 + "</WhereList>";
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
return false;
}
return true;
}
public bool GetTransXML(ref string strTransXML, ref string ErrorInfo)
{
string functionAlias = "03";
string errorInfo = "";
try
{
if (!this.Assembled(ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
strTransXML = this.TransXmlDoc.InnerXml;
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "组合字符串错误!\n\r错误信息如下:\n\r" + exception.Message);
return false;
}
return true;
}
public bool SetTransXML(string strTransXML, ref string ErrorInfo)
{
string functionAlias = "02";
string errorInfo = "";
try
{
this.TransXmlDoc.LoadXml(strTransXML);
if (!this.Analyze(ref errorInfo))
{
throw new Exception("◇" + errorInfo);
}
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, "加载字符串错误!\n\r错误信息如下:\n\r" + exception.Message);
return false;
}
return true;
}
public string ChapterName
{
get
{
return this.TransXmlDoc.SelectNodes("./ParamList")[0].Attributes["ChapterName"].Value.ToString();
}
set
{
this.TransXmlDoc.SelectNodes("./ParamList")[0].Attributes["ChapterName"].Value = value;
}
}
public string CommandName
{
get
{
return this.TransXmlDoc.SelectNodes("./ParamList")[0].Attributes["CommandName"].Value.ToString();
}
set
{
this.TransXmlDoc.SelectNodes("./ParamList")[0].Attributes["CommandName"].Value = value;
}
}
public string MainSQL
{
get
{
string str = this.mainSQL.Replace(">", ">").Replace("<", "<");
return this.mainSQL;
}
set
{
string str = value.Replace(">", ">").Replace("<", "<");
this.mainSQL = str;
}
}
public string ServiceName
{
get
{
return this.TransXmlDoc.SelectNodes("./ParamList")[0].Attributes["ServiceName"].Value.ToString();
}
set
{
this.TransXmlDoc.SelectNodes("./ParamList")[0].Attributes["ServiceName"].Value = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -