📄 builderframe.cs
字号:
namespace LTP.CodeBuild
{
using LTP.CodeHelper;
using LTP.IDBO;
using LTP.Utility;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
public class BuilderFrame
{
private string _bllname;
private string _bllpath;
private string _dalname;
private string _dalpath;
private string _dbhelperName;
private string _dbname;
protected string _dbtype;
private List<ColumnInfo> _fieldlist;
private string _folder;
private string _idalpath;
protected string _key = "ID";
private List<ColumnInfo> _keys;
protected string _keyType = "int";
private string _modelname;
private string _modelpath;
private string _namespace = "Maticsoft";
private string _tablename;
protected IDbObject dbobj;
public string GetFieldslist(DataTable dt)
{
StringPlus plus = new StringPlus();
foreach (DataRow row in dt.Rows)
{
plus.Append("[" + row["ColumnName"].ToString() + "],");
}
plus.DelLastComma();
return plus.Value;
}
public string GetkeyParalist(Hashtable Keys)
{
StringPlus plus = new StringPlus();
foreach (DictionaryEntry entry in Keys)
{
plus.Append(CodeCommon.DbTypeToCS(entry.Value.ToString()) + " " + entry.Key.ToString() + ",");
}
if (plus.Value.IndexOf(",") > 0)
{
plus.DelLastComma();
}
return plus.Value;
}
public string GetkeyWherelist(Hashtable Keys)
{
StringPlus plus = new StringPlus();
int num = 0;
foreach (DictionaryEntry entry in Keys)
{
num++;
if (CodeCommon.IsAddMark(entry.Value.ToString()))
{
plus.Append(entry.Key.ToString() + "='\"+" + entry.Key.ToString() + "+\"'\"");
}
else
{
plus.Append(entry.Key.ToString() + "=\"+" + entry.Key.ToString() + "+\"");
if (num == Keys.Count)
{
plus.Append("\"");
}
}
plus.Append(" and ");
}
if (plus.Value.IndexOf("and") > 0)
{
plus.DelLastChar("and");
}
return plus.Value;
}
public string GetkeyWherelistProc(Hashtable Keys)
{
StringPlus plus = new StringPlus();
foreach (DictionaryEntry entry in Keys)
{
plus.Append(entry.Key.ToString() + "=@" + entry.Key.ToString());
plus.Append(" and ");
}
if (plus.Value.IndexOf("and") > 0)
{
plus.DelLastChar("and");
}
return plus.Value;
}
public string Space(int num)
{
StringBuilder builder = new StringBuilder();
for (int i = 0; i < num; i++)
{
builder.Append("\t");
}
return builder.ToString();
}
public string BLLName
{
get
{
return this._bllname;
}
set
{
this._bllname = value;
}
}
public string BLLpath
{
get
{
string str = this._namespace + ".BLL";
if (this._folder.Trim() != "")
{
str = str + "." + this._folder;
}
return str;
}
set
{
this._bllpath = value;
}
}
public string BLLSpace
{
get
{
return (this.BLLpath + "." + this.BLLName);
}
}
public string DALName
{
get
{
return this._dalname;
}
set
{
this._dalname = value;
}
}
public string DALpath
{
get
{
string str = this._dbtype;
if ((this._dbtype == "SQL2000") || (this._dbtype == "SQL2005"))
{
str = "SQLServer";
}
this._dalpath = this._namespace + "." + str + "DAL";
if (this._folder.Trim() != "")
{
this._dalpath = this._dalpath + "." + this._folder;
}
return this._dalpath;
}
set
{
this._dalpath = value;
}
}
public string DALSpace
{
get
{
return (this.DALpath + "." + this.DALName);
}
}
public string DbHelperName
{
get
{
return this._dbhelperName;
}
set
{
this._dbhelperName = value;
}
}
public string DbName
{
get
{
return this._dbname;
}
set
{
this._dbname = value;
}
}
public string DbParaDbType
{
get
{
switch (this.dbobj.DbType)
{
case "SQL2000":
case "SQL2005":
return "SqlDbType";
case "Oracle":
return "OracleType";
case "MySQL":
return "MySqlDbType";
case "OleDb":
return "OleDbType";
}
return "SqlDbType";
}
}
public string DbParaHead
{
get
{
switch (this.dbobj.DbType)
{
case "SQL2000":
case "SQL2005":
return "Sql";
case "Oracle":
return "Oracle";
case "MySQL":
return "MySql";
case "OleDb":
return "OleDb";
}
return "Sql";
}
}
public string Factorypath
{
get
{
return (this._namespace + ".DALFactory");
}
}
public List<ColumnInfo> Fieldlist
{
get
{
return this._fieldlist;
}
set
{
this._fieldlist = value;
}
}
public string Fields
{
get
{
StringPlus plus = new StringPlus();
foreach (object obj2 in this.Fieldlist)
{
plus.Append("'" + obj2.ToString() + "',");
}
plus.DelLastComma();
return plus.Value;
}
}
public string Fieldstrlist
{
get
{
StringPlus plus = new StringPlus();
foreach (ColumnInfo info in this.Fieldlist)
{
plus.Append(info.ColumnName + ",");
}
plus.DelLastComma();
return plus.Value;
}
}
public string Folder
{
get
{
return this._folder;
}
set
{
this._folder = value;
}
}
public string IClass
{
get
{
return ("I" + this.DALName);
}
}
public string IDALpath
{
get
{
this._idalpath = this._namespace + ".IDAL";
if (this._folder.Trim() != "")
{
this._idalpath = this._idalpath + "." + this._folder;
}
return this._idalpath;
}
}
public bool IsHasIdentity
{
get
{
bool flag = false;
if (this.Keys.Count > 0)
{
foreach (ColumnInfo info in this.Keys)
{
if (info.IsIdentity)
{
flag = true;
}
}
}
return flag;
}
}
public string Key
{
get
{
foreach (ColumnInfo info in this._keys)
{
this._key = info.ColumnName;
this._keyType = info.TypeName;
if (info.IsIdentity)
{
this._key = info.ColumnName;
this._keyType = CodeCommon.DbTypeToCS(info.TypeName);
break;
}
}
return this._key;
}
}
public List<ColumnInfo> Keys
{
get
{
return this._keys;
}
set
{
this._keys = value;
}
}
public string ModelName
{
get
{
return this._modelname;
}
set
{
this._modelname = value;
}
}
public string Modelpath
{
get
{
this._modelpath = this._namespace + ".Model";
if (this._folder.Trim() != "")
{
this._modelpath = this._modelpath + "." + this._folder;
}
return this._modelpath;
}
set
{
this._modelpath = value;
}
}
public string ModelSpace
{
get
{
return (this.Modelpath + "." + this.ModelName);
}
}
public string NameSpace
{
get
{
return this._namespace;
}
set
{
this._namespace = value;
}
}
public string TableName
{
get
{
return this._tablename;
}
set
{
this._tablename = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -