?? codebuilders.cs
字號:
namespace LTP.CodeBuild
{
using LTP.BuilderWeb;
using LTP.CodeHelper;
using LTP.IDBO;
using LTP.Utility;
using System;
using System.Collections.Generic;
public class CodeBuilders
{
private string _bllname;
private string _bllpath;
private string _dalname;
private string _dalpath;
private string _dbconnectStr;
private string _dbhelperName;
private string _dbname;
private string _dbtype;
private string _factoryclass;
private List<ColumnInfo> _fieldlist;
private string _folder;
private string _idalpath;
private List<ColumnInfo> _keys;
private string _modelname;
private string _modelpath;
private string _namespace;
private string _procprefix;
private string _tablename;
private IDbObject dbobj;
public CodeBuilders(IDbObject idbobj)
{
string str;
this._namespace = "Maticsoft";
this._dbhelperName = "DbHelperSQL";
this.dbobj = idbobj;
this.DbType = idbobj.DbType;
if ((this._dbhelperName == "") && ((str = this.DbType) != null))
{
if (!(str == "SQL2000") && !(str == "SQL2005"))
{
if (!(str == "Oracle"))
{
if (!(str == "MySQL"))
{
if (str == "OleDb")
{
this._dbhelperName = "DbHelperOleDb";
}
return;
}
this._dbhelperName = "DbHelperMySQL";
return;
}
}
else
{
this._dbhelperName = "DbHelperSQL";
return;
}
this._dbhelperName = "DbHelperOra";
}
}
public string GetAddAspx()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.Folder = this.Folder;
return web.GetAddAspx();
}
public string GetAddAspxCs()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
string addAspxCs = web.GetAddAspxCs();
StringPlus plus = new StringPlus();
plus.AppendSpaceLine(2, "protected void Page_LoadComplete(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, "(Master.FindControl(\"lblTitle\") as Label).Text = \"信息添加\";");
plus.AppendSpaceLine(2, "}");
plus.AppendSpaceLine(2, "protected void btnAdd_Click(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, addAspxCs);
plus.AppendSpaceLine(2, "}");
return plus.ToString();
}
public string GetAddDesigner()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
return web.GetAddDesigner();
}
public string GetCodeFrameF3BLL(string AssemblyGuid, bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool GetModelByCache, bool List)
{
BuilderFrameF3 ef = new BuilderFrameF3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return ef.GetBLLCode(AssemblyGuid, Maxid, Exists, Add, Update, Delete, GetModel, GetModelByCache, List, List);
}
public string GetCodeFrameF3DAL(string AssemblyGuid, bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool List)
{
BuilderFrameF3 ef = new BuilderFrameF3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return ef.GetDALCode(AssemblyGuid, Maxid, Exists, Add, Update, Delete, GetModel, List, this.ProcPrefix);
}
public string GetCodeFrameF3DALFactory()
{
BuilderFrameF3 ef = new BuilderFrameF3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return ef.GetDALFactoryCode();
}
public string GetCodeFrameF3DALFactoryMethod()
{
BuilderFrameF3 ef = new BuilderFrameF3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return ef.GetDALFactoryMethodCode();
}
public string GetCodeFrameF3IDAL(bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool List, bool ListProc)
{
BuilderFrameF3 ef = new BuilderFrameF3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return ef.GetIDALCode(Maxid, Exists, Add, Update, Delete, GetModel, List, ListProc);
}
public string GetCodeFrameF3Model()
{
BuilderFrameF3 ef = new BuilderFrameF3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return ef.GetModelCode();
}
public string GetCodeFrameOne(string DALtype, bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool List)
{
BuilderFrameOne one = new BuilderFrameOne(this.dbobj, this.DbName, this.TableName, this.ModelName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return one.GetCode(DALtype, Maxid, Exists, Add, Update, Delete, GetModel, List, this.ProcPrefix);
}
public string GetCodeFrameS3BLL(string AssemblyGuid, bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool GetModelByCache, bool List)
{
BuilderFrameS3 es = new BuilderFrameS3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return es.GetBLLCode(AssemblyGuid, Maxid, Exists, Add, Update, Delete, GetModel, GetModelByCache, List);
}
public string GetCodeFrameS3DAL(string AssemblyGuid, bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool List)
{
BuilderFrameS3 es = new BuilderFrameS3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return es.GetDALCode(AssemblyGuid, Maxid, Exists, Add, Update, Delete, GetModel, List, this.ProcPrefix);
}
public string GetCodeFrameS3Model()
{
BuilderFrameS3 es = new BuilderFrameS3(this.dbobj, this.DbName, this.TableName, this.ModelName, this.BLLName, this.DALName, this.Fieldlist, this.Keys, this.NameSpace, this.Folder, this.DbHelperName);
return es.GetModelCode();
}
public string GetShowAspx()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
return web.GetShowAspx();
}
public string GetShowAspxCs()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
string showAspxCs = web.GetShowAspxCs();
StringPlus plus = new StringPlus();
plus.AppendSpaceLine(2, "protected void Page_LoadComplete(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, "(Master.FindControl(\"lblTitle\") as Label).Text = \"詳細信息\";");
plus.AppendSpaceLine(2, "}");
plus.AppendSpaceLine(2, "protected void Page_Load(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, "if (!Page.IsPostBack)");
plus.AppendSpaceLine(3, "{");
plus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")");
plus.AppendSpaceLine(4, "{");
plus.AppendSpaceLine(5, "string id = Request.Params[\"id\"];");
if (this._keys.Count > 0)
{
plus.AppendSpaceLine(5, "//ShowInfo(" + CodeCommon.GetFieldstrlist(this.Keys) + ");");
}
else
{
plus.AppendSpaceLine(5, "ShowInfo();");
}
plus.AppendSpaceLine(4, "}");
plus.AppendSpaceLine(3, "}");
plus.AppendSpaceLine(2, "}");
plus.AppendSpaceLine(2, showAspxCs);
return plus.ToString();
}
public string GetShowDesigner()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
return web.GetShowDesigner();
}
public string GetUpdateAspx()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
return web.GetUpdateAspx();
}
public string GetUpdateAspxCs()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
string updateAspxCs = web.GetUpdateAspxCs();
string updateShowAspxCs = web.GetUpdateShowAspxCs();
StringPlus plus = new StringPlus();
plus.AppendSpaceLine(2, "protected void Page_LoadComplete(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, "(Master.FindControl(\"lblTitle\") as Label).Text = \"信息修改\";");
plus.AppendSpaceLine(2, "}");
plus.AppendSpaceLine(2, "protected void Page_Load(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, "if (!Page.IsPostBack)");
plus.AppendSpaceLine(3, "{");
plus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")");
plus.AppendSpaceLine(4, "{");
plus.AppendSpaceLine(5, "string id = Request.Params[\"id\"];");
if (this._keys.Count > 0)
{
plus.AppendSpaceLine(5, "//ShowInfo(" + CodeCommon.GetFieldstrlist(this.Keys) + ");");
}
else
{
plus.AppendSpaceLine(5, "ShowInfo();");
}
plus.AppendSpaceLine(4, "}");
plus.AppendSpaceLine(3, "}");
plus.AppendSpaceLine(2, "}");
plus.AppendSpaceLine(3, updateShowAspxCs);
plus.AppendSpaceLine(2, "protected void btnAdd_Click(object sender, EventArgs e)");
plus.AppendSpaceLine(2, "{");
plus.AppendSpaceLine(3, updateAspxCs);
plus.AppendSpaceLine(2, "}");
return plus.ToString();
}
public string GetUpdateDesigner()
{
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = this.NameSpace;
web.Fieldlist = this.Fieldlist;
web.Keys = this.Keys;
web.ModelName = this.ModelName;
web.BLLName = this.BLLName;
web.Folder = this.Folder;
return web.GetUpdateDesigner();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -