📄 codemakerm.cs
字号:
}
private void CreatCsS3Model()
{
string text = this.txtProcPrefix.Text;
string nameSpace = this.txtNameSpace.Text.Trim();
string folder = this.txtNameSpace2.Text.Trim();
string tableNameParent = this.cmbox_PTab.Text;
string tableNameSon = this.cmbox_STab.Text;
string tabName = this.txtClassName.Text;
string modelClass = this.txtClassName2.Text;
tabName = this.namerule.GetModelClass(tabName);
modelClass = this.namerule.GetModelClass(modelClass);
string strContent = new BuilderFrameS3(this.dbobj, this.dbname, nameSpace, folder, this.setting.DbHelperName).GetModelCode(tableNameParent, tabName, this.GetFieldlistP(), tableNameSon, modelClass, this.GetFieldlistS());
this.SettxtContent("CS", strContent);
}
private void CreatDB()
{
if (this.radbtn_DB_Proc.Checked)
{
this.CreatDBProc();
}
else
{
this.CreatDBScript();
}
}
private void CreatDBProc()
{
string text = this.txtProjectName.Text;
string text1 = this.txtNameSpace.Text;
string text2 = this.txtNameSpace2.Text;
string text3 = this.txtClassName.Text;
string str2 = this.txtProcPrefix.Text;
string str3 = this.txtTabname.Text;
bool maxid = this.chk_DB_GetMaxID.Checked;
bool ishas = this.chk_DB_Exists.Checked;
bool add = this.chk_DB_Add.Checked;
bool update = this.chk_DB_Update.Checked;
bool delete = this.chk_DB_Delete.Checked;
bool getModel = this.chk_DB_GetModel.Checked;
bool list = this.chk_DB_GetList.Checked;
IDbScriptBuilder builder = ObjHelper.CreatDsb(this.servername);
builder.DbName = this.dbname;
builder.TableName = str3;
builder.ProjectName = text;
builder.ProcPrefix = str2;
builder.Keys = this.GetKeyFieldsP();
builder.Fieldlist = this.GetFieldlistP();
string strContent = builder.GetPROCCode(maxid, ishas, add, update, delete, getModel, list);
this.SettxtContent("SQL", strContent);
}
private void CreatDBScript()
{
this.Cursor = Cursors.WaitCursor;
IDbScriptBuilder builder = ObjHelper.CreatDsb(this.servername);
builder.Fieldlist = this.GetFieldlistP();
string strContent = builder.CreateTabScript(this.dbname, this.tablename);
this.SettxtContent("SQL", strContent);
this.Cursor = Cursors.Default;
}
private void CreatView()
{
this.listView1.Columns.Clear();
this.listView1.Items.Clear();
this.listView1.LargeImageList = this.imglistView;
this.listView1.SmallImageList = this.imglistView;
this.listView1.View = View.Details;
this.listView1.GridLines = true;
this.listView1.CheckBoxes = true;
this.listView1.FullRowSelect = true;
this.listView1.Columns.Add("选", 0x1c, HorizontalAlignment.Left);
this.listView1.Columns.Add("列名", 0x69, HorizontalAlignment.Left);
this.listView1.Columns.Add("数据类型", 80, HorizontalAlignment.Left);
this.listView2.Columns.Clear();
this.listView2.Items.Clear();
this.listView2.LargeImageList = this.imglistView;
this.listView2.SmallImageList = this.imglistView;
this.listView2.View = View.Details;
this.listView2.GridLines = true;
this.listView2.CheckBoxes = true;
this.listView2.FullRowSelect = true;
this.listView2.Columns.Add("选", 0x1c, HorizontalAlignment.Left);
this.listView2.Columns.Add("列名", 0x69, HorizontalAlignment.Left);
this.listView2.Columns.Add("数据类型", 80, HorizontalAlignment.Left);
}
private void CreatWeb()
{
string str = this.txtNameSpace.Text.Trim();
string str2 = this.txtNameSpace2.Text.Trim();
string text = this.txtClassName.Text;
if (text == "")
{
text = this.tablename;
}
LTP.BuilderWeb.BuilderWeb web = new LTP.BuilderWeb.BuilderWeb();
web.NameSpace = str;
web.Fieldlist = this.GetFieldlistP();
web.Keys = this.GetKeyFieldsP();
web.ModelName = text;
web.Folder = str2;
if (this.radbtn_Web_Aspx.Checked)
{
string strContent = web.GetWebHtmlCode(this.chk_Web_HasKey.Checked, this.chk_Web_Add.Checked, this.chk_Web_Update.Checked, this.chk_Web_Show.Checked, true);
this.SettxtContent("Aspx", strContent);
}
else
{
string str5 = web.GetWebCode(this.chk_Web_HasKey.Checked, this.chk_Web_Add.Checked, this.chk_Web_Update.Checked, this.chk_Web_Show.Checked, true);
this.SettxtContent("CS", str5);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private string GetBLLType()
{
string appGuid = "";
appGuid = this.cm_blltype.AppGuid;
if ((appGuid == "") && (appGuid == "System.Data.DataRowView"))
{
MessageBox.Show("选择的数据层类型有误,请关闭后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return "";
}
return appGuid;
}
private string GetDALType()
{
string appGuid = "";
appGuid = this.cm_daltype.AppGuid;
if (!(appGuid == "") && !(appGuid == "System.Data.DataRowView"))
{
return appGuid;
}
MessageBox.Show("选择的数据层类型有误,请关闭后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return "";
}
private List<LTP.CodeHelper.ColumnInfo> GetFieldlistP()
{
DataRow[] rowArray;
string text = this.cmbox_PTab.Text;
DataTable columnInfoDt = CodeCommon.GetColumnInfoDt(this.dbobj.GetColumnInfoList(this.dbname, text));
StringPlus plus = new StringPlus();
foreach (ListViewItem item in this.listView1.Items)
{
if (item.Checked)
{
plus.Append("'" + item.SubItems[1].Text + "',");
}
}
plus.DelLastComma();
if (columnInfoDt == null)
{
return null;
}
if (plus.Value.Length > 0)
{
rowArray = columnInfoDt.Select("ColumnName in (" + plus.Value + ")", "colorder asc");
}
else
{
rowArray = columnInfoDt.Select();
}
List<LTP.CodeHelper.ColumnInfo> list2 = new List<LTP.CodeHelper.ColumnInfo>();
foreach (DataRow row in rowArray)
{
string str2 = row["Colorder"].ToString();
string str3 = row["ColumnName"].ToString();
string str4 = row["TypeName"].ToString();
string str5 = row["IsIdentity"].ToString();
string str6 = row["IsPK"].ToString();
string str7 = row["Length"].ToString();
string str8 = row["Preci"].ToString();
string str9 = row["Scale"].ToString();
string str10 = row["cisNull"].ToString();
string str11 = row["DefaultVal"].ToString();
string str12 = row["DeText"].ToString();
LTP.CodeHelper.ColumnInfo info = new LTP.CodeHelper.ColumnInfo();
info.Colorder = str2;
info.ColumnName = str3;
info.TypeName = str4;
info.IsIdentity = str5 == "√";
info.IsPK = str6 == "√";
info.Length = str7;
info.Preci = str8;
info.Scale = str9;
info.cisNull = str10 == "√";
info.DefaultVal = str11;
info.DeText = str12;
list2.Add(info);
}
return list2;
}
private List<LTP.CodeHelper.ColumnInfo> GetFieldlistS()
{
DataRow[] rowArray;
string text = this.cmbox_STab.Text;
DataTable columnInfoDt = CodeCommon.GetColumnInfoDt(this.dbobj.GetColumnInfoList(this.dbname, text));
StringPlus plus = new StringPlus();
foreach (ListViewItem item in this.listView2.Items)
{
if (item.Checked)
{
plus.Append("'" + item.SubItems[1].Text + "',");
}
}
plus.DelLastComma();
if (columnInfoDt == null)
{
return null;
}
if (plus.Value.Length > 0)
{
rowArray = columnInfoDt.Select("ColumnName in (" + plus.Value + ")", "colorder asc");
}
else
{
rowArray = columnInfoDt.Select();
}
List<LTP.CodeHelper.ColumnInfo> list2 = new List<LTP.CodeHelper.ColumnInfo>();
foreach (DataRow row in rowArray)
{
string str2 = row["Colorder"].ToString();
string str3 = row["ColumnName"].ToString();
string str4 = row["TypeName"].ToString();
string str5 = row["IsIdentity"].ToString();
string str6 = row["IsPK"].ToString();
string str7 = row["Length"].ToString();
string str8 = row["Preci"].ToString();
string str9 = row["Scale"].ToString();
string str10 = row["cisNull"].ToString();
string str11 = row["DefaultVal"].ToString();
string str12 = row["DeText"].ToString();
LTP.CodeHelper.ColumnInfo info = new LTP.CodeHelper.ColumnInfo();
info.Colorder = str2;
info.ColumnName = str3;
info.TypeName = str4;
info.IsIdentity = str5 == "√";
info.IsPK = str6 == "√";
info.Length = str7;
info.Preci = str8;
info.Scale = str9;
info.cisNull = str10 == "√";
info.DefaultVal = str11;
info.DeText = str12;
list2.Add(info);
}
return list2;
}
private List<LTP.CodeHelper.ColumnInfo> GetKeyFieldsP()
{
DataRow[] rowArray;
string text = this.cmbox_PTab.Text;
List<LTP.CodeHelper.ColumnInfo> columnInfoList = this.dbobj.GetColumnInfoList(this.dbname, text);
DataTable columnInfoDt = CodeCommon.GetColumnInfoDt(columnInfoList);
StringPlus plus = new StringPlus();
plus.Append("'" + this.cmbox_PField.Text + "'");
if ((columnInfoList == null) || (columnInfoList.Count <= 0))
{
return null;
}
if (plus.Value.Length > 0)
{
rowArray = columnInfoDt.Select("ColumnName in (" + plus.Value + ")", "colorder asc");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -