public string CreatBLLDelete() { StringPlus stringPlus = new StringPlus(); stringPlus.AppendSpaceLine(2, "/// <summary>"); stringPlus.AppendSpaceLine(2, "/// " + this.Languagelist["summaryDelete"].ToString()); stringPlus.AppendSpaceLine(2, "/// </summary>"); stringPlus.AppendSpaceLine(2, "public bool Delete(" + CodeCommon.GetInParameter(this.Keys, true) + ")"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, this.KeysNullTip); stringPlus.AppendSpaceLine(3, "return dal.Delete(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); stringPlus.AppendSpaceLine(2, "}"); if (CodeCommon.HasNoIdentityKey(this.Keys) && CodeCommon.GetIdentityKey(this.Keys) != null) { stringPlus.AppendSpaceLine(2, "/// <summary>"); stringPlus.AppendSpaceLine(2, "/// " + this.Languagelist["summaryDelete"].ToString()); stringPlus.AppendSpaceLine(2, "/// </summary>"); stringPlus.AppendSpaceLine(2, "public bool Delete(" + CodeCommon.GetInParameter(this.Keys, false) + ")"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, this.KeysNullTip); stringPlus.AppendSpaceLine(3, "return dal.Delete(" + CodeCommon.GetFieldstrlist(this.Keys, false) + ");"); stringPlus.AppendSpaceLine(2, "}"); } string text = ""; if (this.Keys.Count == 1) { text = this.Keys[0].ColumnName; } else { foreach (ColumnInfo current in this.Keys) { if (current.IsIdentity) { text = current.ColumnName; break; } } } if (text.Trim().Length > 0) { stringPlus.AppendSpaceLine(2, "/// <summary>"); stringPlus.AppendSpaceLine(2, "/// " + this.Languagelist["summaryDelete"].ToString()); stringPlus.AppendSpaceLine(2, "/// </summary>"); stringPlus.AppendSpaceLine(2, "public bool DeleteList(string " + text + "list )"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, "return dal.DeleteList(Maticsoft.Common.PageValidate.SafeLongFilter(" + text + "list,0) );"); stringPlus.AppendSpaceLine(2, "}"); } return(stringPlus.ToString()); }
/// <summary> /// 得到表示层显示窗体的代码 /// </summary> public string GetShowAspxCs() { StringPlus strclass = new StringPlus(); strclass.AppendLine(); string key = Key; strclass.AppendSpaceLine(1, "private void ShowInfo(" + CodeCommon.GetInParameter(Keys, true) + ")"); strclass.AppendSpaceLine(1, "{"); strclass.AppendSpaceLine(2, BLLSpace + " bll=new " + BLLSpace + "();"); strclass.AppendSpaceLine(2, ModelSpace + " model=bll.GetModel(" + CodeCommon.GetFieldstrlist(Keys, true) + ");"); foreach (ColumnInfo field in Fieldlist) { string columnName = field.ColumnName; string columnType = field.TypeName; string deText = field.Description; bool ispk = field.IsPrimaryKey; bool IsIdentity = field.IsIdentity; if ((ispk) || (IsIdentity)) { continue; } switch (CodeCommon.DbTypeToCS(columnType.Trim().ToLower()).ToLower()) { case "int": case "smallint": case "float": case "numeric": case "decimal": case "datetime": case "smalldatetime": strclass.AppendSpaceLine(2, "this.lbl" + columnName + ".Text=model." + columnName + ".ToString();"); break; case "bool": strclass.AppendSpaceLine(2, "this.chk" + columnName + ".Checked=model." + columnName + ";"); break; case "byte[]": strclass.AppendSpaceLine(2, "this.lbl" + columnName + ".Text=model." + columnName + ".ToString();"); break; default: strclass.AppendSpaceLine(2, "this.lbl" + columnName + ".Text=model." + columnName + ";"); break; } } strclass.AppendLine(); strclass.AppendSpaceLine(1, "}"); return(strclass.ToString()); }
public string CreatBLLGetModelByCache(string ModelName) { StringPlus stringPlus = new StringPlus(); stringPlus.AppendSpaceLine(2, "/// <summary>"); stringPlus.AppendSpaceLine(2, "/// " + this.Languagelist["summaryGetModelByCache"].ToString()); stringPlus.AppendSpaceLine(2, "/// </summary>"); stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "public ", this.ModelSpace, " GetModelByCache(", CodeCommon.GetInParameter(this.Keys, true), ")" })); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, this.KeysNullTip); string text = ""; if (this.Keys.Count > 0) { text = "+ " + CodeCommon.GetFieldstrlistAdd(this.Keys, true); } stringPlus.AppendSpaceLine(3, string.Concat(new string[] { "string CacheKey = \"", ModelName, "Model-\" ", text, ";" })); stringPlus.AppendSpaceLine(3, "object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);"); stringPlus.AppendSpaceLine(3, "if (objModel == null)"); stringPlus.AppendSpaceLine(3, "{"); stringPlus.AppendSpaceLine(4, "try"); stringPlus.AppendSpaceLine(4, "{"); stringPlus.AppendSpaceLine(5, "objModel = dal.GetModel(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); stringPlus.AppendSpaceLine(5, "if (objModel != null)"); stringPlus.AppendSpaceLine(5, "{"); stringPlus.AppendSpaceLine(6, "int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt(\"ModelCache\");"); stringPlus.AppendSpaceLine(6, "Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);"); stringPlus.AppendSpaceLine(5, "}"); stringPlus.AppendSpaceLine(4, "}"); stringPlus.AppendSpaceLine(4, "catch{}"); stringPlus.AppendSpaceLine(3, "}"); stringPlus.AppendSpaceLine(3, "return (" + this.ModelSpace + ")objModel;"); stringPlus.AppendSpaceLine(2, "}"); return(stringPlus.Value); }
public string CreatBLLExists() { StringPlus stringPlus = new StringPlus(); if (this._keys.Count > 0) { string inParameter = CodeCommon.GetInParameter(this.Keys, false); if (!string.IsNullOrEmpty(inParameter)) { stringPlus.AppendSpaceLine(2, "/// <summary>"); stringPlus.AppendSpaceLine(2, "/// " + this.Languagelist["summaryExists"].ToString()); stringPlus.AppendSpaceLine(2, "/// </summary>"); stringPlus.AppendSpaceLine(2, "public bool Exists(" + inParameter + ")"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, "return dal.Exists(" + CodeCommon.GetFieldstrlist(this.Keys, false) + ");"); stringPlus.AppendSpaceLine(2, "}"); } } return(stringPlus.ToString()); }
public string CreatBLLGetModel() { StringPlus stringPlus = new StringPlus(); stringPlus.AppendSpaceLine(2, "/// <summary>"); stringPlus.AppendSpaceLine(2, "/// " + this.Languagelist["summaryGetModel"].ToString()); stringPlus.AppendSpaceLine(2, "/// </summary>"); stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "public ", this.ModelSpace, " GetModel(", CodeCommon.GetInParameter(this.Keys, true), ")" })); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, this.KeysNullTip); stringPlus.AppendSpaceLine(3, "return dal.GetModel(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); stringPlus.AppendSpaceLine(2, "}"); return(stringPlus.ToString()); }
public string GetUpdateShowAspxCs() { StringPlus stringPlus = new StringPlus(); stringPlus.AppendLine(); string arg_13_0 = this.Key; stringPlus.AppendSpaceLine(1, "private void ShowInfo(" + CodeCommon.GetInParameter(this.Keys, true) + ")"); stringPlus.AppendSpaceLine(1, "{"); stringPlus.AppendSpaceLine(2, this.BLLSpace + " bll=new " + this.BLLSpace + "();"); stringPlus.AppendSpaceLine(2, this.ModelSpace + " model=bll.GetModel(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); foreach (ColumnInfo current in this.Fieldlist) { string columnName = current.ColumnName; string typeName = current.TypeName; string arg_BE_0 = current.Description; bool isPrimaryKey = current.IsPrimaryKey; bool isIdentity = current.IsIdentity; if (!this.isFilterColume(columnName)) { string key; switch (key = CodeCommon.DbTypeToCS(typeName.Trim().ToLower()).ToLower()) { case "int": case "long": case "smallint": case "float": case "numeric": case "decimal": case "datetime": case "smalldatetime": if (isPrimaryKey || isIdentity) { stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.lbl", columnName, ".Text=model.", columnName, ".ToString();" })); continue; } stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.txt", columnName, ".Text=model.", columnName, ".ToString();" })); continue; case "bool": stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.chk", columnName, ".Checked=model.", columnName, ";" })); continue; case "byte[]": stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.txt", columnName, ".Text=model.", columnName, ".ToString();" })); continue; case "guid": case "uniqueidentifier": stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.lbl", columnName, ".Text=model.", columnName, ".ToString();" })); continue; } if (isPrimaryKey || isIdentity) { stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.lbl", columnName, ".Text=model.", columnName, ";" })); } else { stringPlus.AppendSpaceLine(2, string.Concat(new string[] { "this.txt", columnName, ".Text=model.", columnName, ";" })); } } } stringPlus.AppendLine(); stringPlus.AppendSpaceLine(1, "}"); return(stringPlus.Value); }
public string GetDeleteAspxCs() { if (this.ibw == null) { return("//请选择有效的表示层代码组件!"); } StringPlus stringPlus = new StringPlus(); stringPlus.AppendSpaceLine(3, "if (!Page.IsPostBack)"); stringPlus.AppendSpaceLine(3, "{"); stringPlus.AppendSpaceLine(4, this.BLLSpace + " bll=new " + this.BLLSpace + "();"); if (this._keys.Count == 1) { string columnName = this._keys[0].ColumnName; stringPlus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")"); stringPlus.AppendSpaceLine(4, "{"); string a; if ((a = CodeCommon.DbTypeToCS(this._keys[0].TypeName).ToLower()) != null) { if (a == "int") { stringPlus.AppendSpaceLine(5, "int " + columnName + "=(Convert.ToInt32(Request.Params[\"id\"]));"); goto IL_19F; } if (a == "long") { stringPlus.AppendSpaceLine(5, "long " + columnName + "=(Convert.ToInt64(Request.Params[\"id\"]));"); goto IL_19F; } if (a == "decimal") { stringPlus.AppendSpaceLine(5, "decimal " + columnName + "=(Convert.ToDecimal(Request.Params[\"id\"]));"); goto IL_19F; } if (a == "bool") { stringPlus.AppendSpaceLine(5, "bool " + columnName + "=(Convert.ToBoolean(Request.Params[\"id\"]));"); goto IL_19F; } if (a == "guid") { stringPlus.AppendSpaceLine(5, "Guid " + columnName + "=new Guid(Request.Params[\"id\"]);"); goto IL_19F; } } stringPlus.AppendSpaceLine(5, "string " + columnName + "= Request.Params[\"id\"];"); IL_19F: stringPlus.AppendSpaceLine(5, "bll.Delete(" + columnName + ");"); stringPlus.AppendSpaceLine(5, "Response.Redirect(\"list.aspx\");"); stringPlus.AppendSpaceLine(4, "}"); } else { ColumnInfo identityKey = CodeCommon.GetIdentityKey(this._keys); if (identityKey != null) { string columnName = identityKey.ColumnName; stringPlus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")"); stringPlus.AppendSpaceLine(4, "{"); string a2; if ((a2 = CodeCommon.DbTypeToCS(identityKey.TypeName).ToLower()) != null) { if (a2 == "int") { stringPlus.AppendSpaceLine(5, "int " + columnName + "=(Convert.ToInt32(Request.Params[\"id\"]));"); goto IL_309; } if (a2 == "long") { stringPlus.AppendSpaceLine(5, "long " + columnName + "=(Convert.ToInt64(Request.Params[\"id\"]));"); goto IL_309; } if (a2 == "decimal") { stringPlus.AppendSpaceLine(5, "decimal " + columnName + "=(Convert.ToDecimal(Request.Params[\"id\"]));"); goto IL_309; } if (a2 == "bool") { stringPlus.AppendSpaceLine(5, "bool " + columnName + "=(Convert.ToBoolean(Request.Params[\"id\"]));"); goto IL_309; } if (a2 == "guid") { stringPlus.AppendSpaceLine(5, "Guid " + columnName + "=new Guid(Request.Params[\"id\"]);"); goto IL_309; } } stringPlus.AppendSpaceLine(5, "string " + columnName + "= Request.Params[\"id\"];"); IL_309: stringPlus.AppendSpaceLine(4, "bll.Delete(" + columnName + ");"); stringPlus.AppendSpaceLine(4, "}"); } else { int i = 0; while (i < this._keys.Count) { string columnName = this._keys[i].ColumnName; string text = CodeCommon.DbTypeToCS(this._keys[i].TypeName); string key; if ((key = text) == null) { goto IL_453; } if (dtCollection == null) { dtCollection = new Dictionary <string, int>(6) { { "int", 0 }, { "long", 1 }, { "decimal", 2 }, { "bool", 3 }, { "guid", 4 }, { "Guid", 5 } }; } int num; if (!dtCollection.TryGetValue(key, out num)) { goto IL_453; } switch (num) { case 0: case 1: case 2: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = -1;"); break; case 3: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = false;"); break; case 4: case 5: stringPlus.AppendSpaceLine(4, text + " " + columnName + " ;"); break; default: goto IL_453; } IL_46D: stringPlus.AppendSpaceLine(4, string.Concat(new string[] { "if (Request.Params[\"id", i.ToString(), "\"] != null && Request.Params[\"id", i.ToString(), "\"].Trim() != \"\")" })); stringPlus.AppendSpaceLine(4, "{"); string a3; if ((a3 = text.ToLower()) == null) { goto IL_5BB; } if (!(a3 == "int")) { if (!(a3 == "long")) { if (!(a3 == "decimal")) { if (!(a3 == "bool")) { if (!(a3 == "guid")) { goto IL_5BB; } stringPlus.AppendSpaceLine(5, columnName + "=new Guid(Request.Params[\"id\"]);"); } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToBoolean(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToDecimal(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToInt64(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToInt32(Request.Params[\"id" + i.ToString() + "\"]));"); } IL_5DA: stringPlus.AppendSpaceLine(4, "}"); i++; continue; IL_5BB: stringPlus.AppendSpaceLine(5, columnName + "= Request.Params[\"id" + i.ToString() + "\"];"); goto IL_5DA; IL_453: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = \"\";"); goto IL_46D; } stringPlus.AppendSpaceLine(4, "#warning 代码生成提示:删除页面,请检查确认传递过来的参数是否正确"); stringPlus.AppendSpaceLine(4, "// bll.Delete(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); } } stringPlus.AppendSpaceLine(3, "}"); return(stringPlus.ToString()); }
public string GetShowAspxCs() { if (this.ibw == null) { return("//请选择有效的表示层代码组件!"); } string showAspxCs = this.ibw.GetShowAspxCs(); StringPlus stringPlus = new StringPlus(); stringPlus.AppendSpaceLine(2, "public string strid=\"\"; "); stringPlus.AppendSpaceLine(2, "protected void Page_Load(object sender, EventArgs e)"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, "if (!Page.IsPostBack)"); stringPlus.AppendSpaceLine(3, "{"); if (this._keys.Count == 1) { string columnName = this._keys[0].ColumnName; stringPlus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")"); stringPlus.AppendSpaceLine(4, "{"); stringPlus.AppendSpaceLine(5, "strid = Request.Params[\"id\"];"); string a; if ((a = CodeCommon.DbTypeToCS(this._keys[0].TypeName).ToLower()) != null) { if (a == "int") { stringPlus.AppendSpaceLine(5, "int " + columnName + "=(Convert.ToInt32(strid));"); goto IL_1BC; } if (a == "long") { stringPlus.AppendSpaceLine(5, "long " + columnName + "=(Convert.ToInt64(strid));"); goto IL_1BC; } if (a == "decimal") { stringPlus.AppendSpaceLine(5, "decimal " + columnName + "=(Convert.ToDecimal(strid));"); goto IL_1BC; } if (a == "bool") { stringPlus.AppendSpaceLine(5, "bool " + columnName + "=(Convert.ToBoolean(strid));"); goto IL_1BC; } if (a == "guid") { stringPlus.AppendSpaceLine(5, "Guid " + columnName + "=new Guid(strid);"); goto IL_1BC; } } stringPlus.AppendSpaceLine(5, "string " + columnName + "= strid;"); IL_1BC: stringPlus.AppendSpaceLine(5, "ShowInfo(" + columnName + ");"); stringPlus.AppendSpaceLine(4, "}"); } else { ColumnInfo identityKey = CodeCommon.GetIdentityKey(this._keys); if (identityKey != null) { string columnName = identityKey.ColumnName; stringPlus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")"); stringPlus.AppendSpaceLine(4, "{"); stringPlus.AppendSpaceLine(5, "strid = Request.Params[\"id\"];"); string a2; if ((a2 = CodeCommon.DbTypeToCS(identityKey.TypeName).ToLower()) != null) { if (a2 == "int") { stringPlus.AppendSpaceLine(5, "int " + columnName + "=(Convert.ToInt32(strid));"); goto IL_326; } if (a2 == "long") { stringPlus.AppendSpaceLine(5, "long " + columnName + "=(Convert.ToInt64(strid));"); goto IL_326; } if (a2 == "decimal") { stringPlus.AppendSpaceLine(5, "decimal " + columnName + "=(Convert.ToDecimal(strid));"); goto IL_326; } if (a2 == "bool") { stringPlus.AppendSpaceLine(5, "bool " + columnName + "=(Convert.ToBoolean(strid));"); goto IL_326; } if (a2 == "guid") { stringPlus.AppendSpaceLine(5, "Guid " + columnName + "=new Guid(strid);"); goto IL_326; } } stringPlus.AppendSpaceLine(5, "string " + columnName + "= strid;"); IL_326: stringPlus.AppendSpaceLine(5, "ShowInfo(" + columnName + ");"); stringPlus.AppendSpaceLine(4, "}"); } else { int i = 0; while (i < this._keys.Count) { string columnName = this._keys[i].ColumnName; string text = CodeCommon.DbTypeToCS(this._keys[i].TypeName); string key; if ((key = text.ToLower()) == null) { goto IL_478; } if (dtCollection == null) { dtCollection = new Dictionary <string, int>(6) { { "int", 0 }, { "long", 1 }, { "decimal", 2 }, { "bool", 3 }, { "guid", 4 }, { "Guid", 5 } }; } int num; if (!dtCollection.TryGetValue(key, out num)) { goto IL_478; } switch (num) { case 0: case 1: case 2: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = -1;"); break; case 3: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = false;"); break; case 4: case 5: stringPlus.AppendSpaceLine(4, text + " " + columnName + " ;"); break; default: goto IL_478; } IL_492: stringPlus.AppendSpaceLine(4, string.Concat(new string[] { "if (Request.Params[\"id", i.ToString(), "\"] != null && Request.Params[\"id", i.ToString(), "\"].Trim() != \"\")" })); stringPlus.AppendSpaceLine(4, "{"); string a3; if ((a3 = text.ToLower()) == null) { goto IL_5E0; } if (!(a3 == "int")) { if (!(a3 == "long")) { if (!(a3 == "decimal")) { if (!(a3 == "bool")) { if (!(a3 == "guid")) { goto IL_5E0; } stringPlus.AppendSpaceLine(5, columnName + "=new Guid(Request.Params[\"id\"]);"); } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToBoolean(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToDecimal(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToInt64(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToInt32(Request.Params[\"id" + i.ToString() + "\"]));"); } IL_5FF: stringPlus.AppendSpaceLine(4, "}"); i++; continue; IL_5E0: stringPlus.AppendSpaceLine(5, columnName + "= Request.Params[\"id" + i.ToString() + "\"];"); goto IL_5FF; IL_478: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = \"\";"); goto IL_492; } stringPlus.AppendSpaceLine(4, "#warning 代码生成提示:显示页面,请检查确认该语句是否正确"); stringPlus.AppendSpaceLine(4, "ShowInfo(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); } } stringPlus.AppendSpaceLine(3, "}"); stringPlus.AppendSpaceLine(2, "}"); stringPlus.AppendSpaceLine(2, showAspxCs); return(stringPlus.ToString()); }
public string GetUpdateAspxCs() { if (this.ibw == null) { return("//请选择有效的表示层代码组件!"); } string updateAspxCs = this.ibw.GetUpdateAspxCs(); string updateShowAspxCs = this.ibw.GetUpdateShowAspxCs(); StringPlus stringPlus = new StringPlus(); stringPlus.AppendSpaceLine(2, "protected void Page_Load(object sender, EventArgs e)"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, "if (!Page.IsPostBack)"); stringPlus.AppendSpaceLine(3, "{"); if (this._keys.Count == 1) { string columnName = this._keys[0].ColumnName; stringPlus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")"); stringPlus.AppendSpaceLine(4, "{"); string a; if ((a = CodeCommon.DbTypeToCS(this._keys[0].TypeName).ToLower()) != null) { if (a == "int") { stringPlus.AppendSpaceLine(5, "int " + columnName + "=(Convert.ToInt32(Request.Params[\"id\"]));"); goto IL_1AE; } if (a == "long") { stringPlus.AppendSpaceLine(5, "long " + columnName + "=(Convert.ToInt64(Request.Params[\"id\"]));"); goto IL_1AE; } if (a == "decimal") { stringPlus.AppendSpaceLine(5, "decimal " + columnName + "=(Convert.ToDecimal(Request.Params[\"id\"]));"); goto IL_1AE; } if (a == "bool") { stringPlus.AppendSpaceLine(5, "bool " + columnName + "=(Convert.ToBoolean(Request.Params[\"id\"]));"); goto IL_1AE; } if (a == "guid") { stringPlus.AppendSpaceLine(5, "Guid " + columnName + "=new Guid(Request.Params[\"id\"]);"); goto IL_1AE; } } stringPlus.AppendSpaceLine(5, "string " + columnName + "= Request.Params[\"id\"];"); IL_1AE: stringPlus.AppendSpaceLine(5, "ShowInfo(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); stringPlus.AppendSpaceLine(4, "}"); } else { ColumnInfo identityKey = CodeCommon.GetIdentityKey(this._keys); if (identityKey != null) { string columnName = identityKey.ColumnName; stringPlus.AppendSpaceLine(4, "if (Request.Params[\"id\"] != null && Request.Params[\"id\"].Trim() != \"\")"); stringPlus.AppendSpaceLine(4, "{"); string a2; if ((a2 = CodeCommon.DbTypeToCS(identityKey.TypeName).ToLower()) != null) { if (a2 == "int") { stringPlus.AppendSpaceLine(5, "int " + columnName + "=(Convert.ToInt32(Request.Params[\"id\"]));"); goto IL_2EC; } if (a2 == "long") { stringPlus.AppendSpaceLine(5, "long " + columnName + "=(Convert.ToInt64(Request.Params[\"id\"]));"); goto IL_2EC; } if (a2 == "decimal") { stringPlus.AppendSpaceLine(5, "decimal " + columnName + "=(Convert.ToDecimal(Request.Params[\"id\"]));"); goto IL_2EC; } if (a2 == "guid") { stringPlus.AppendSpaceLine(5, "Guid " + columnName + "=new Guid(Request.Params[\"id\"]);"); goto IL_2EC; } } stringPlus.AppendSpaceLine(5, "string " + columnName + "= Request.Params[\"id\"];"); IL_2EC: stringPlus.AppendSpaceLine(5, "ShowInfo(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); stringPlus.AppendSpaceLine(4, "}"); } else { int i = 0; while (i < this._keys.Count) { string columnName = this._keys[i].ColumnName; string text = CodeCommon.DbTypeToCS(this._keys[i].TypeName); string a3; if ((a3 = text.ToLower()) == null) { goto IL_400; } if (!(a3 == "int") && !(a3 == "long") && !(a3 == "decimal")) { if (!(a3 == "bool")) { if (!(a3 == "guid")) { goto IL_400; } stringPlus.AppendSpaceLine(4, text + " " + columnName + ";"); } else { stringPlus.AppendSpaceLine(4, text + " " + columnName + " = false;"); } } else { stringPlus.AppendSpaceLine(4, text + " " + columnName + " = -1;"); } IL_41A: stringPlus.AppendSpaceLine(4, string.Concat(new string[] { "if (Request.Params[\"id", i.ToString(), "\"] != null && Request.Params[\"id", i.ToString(), "\"].Trim() != \"\")" })); stringPlus.AppendSpaceLine(4, "{"); string a4; if ((a4 = text) == null) { goto IL_572; } if (!(a4 == "int")) { if (!(a4 == "long")) { if (!(a4 == "decimal")) { if (!(a4 == "bool")) { if (!(a4 == "guid")) { goto IL_572; } stringPlus.AppendSpaceLine(5, columnName + "=new Guid(Request.Params[\"id" + i.ToString() + "\"]);"); } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToBoolean(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToDecimal(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToInt64(Request.Params[\"id" + i.ToString() + "\"]));"); } } else { stringPlus.AppendSpaceLine(5, columnName + "=(Convert.ToInt32(Request.Params[\"id" + i.ToString() + "\"]));"); } IL_591: stringPlus.AppendSpaceLine(4, "}"); i++; continue; IL_572: stringPlus.AppendSpaceLine(5, columnName + "= Request.Params[\"id" + i.ToString() + "\"];"); goto IL_591; IL_400: stringPlus.AppendSpaceLine(4, text + " " + columnName + " = \"\";"); goto IL_41A; } stringPlus.AppendSpaceLine(4, "#warning 代码生成提示:显示页面,请检查确认该语句是否正确"); stringPlus.AppendSpaceLine(4, "ShowInfo(" + CodeCommon.GetFieldstrlist(this.Keys, true) + ");"); } } stringPlus.AppendSpaceLine(3, "}"); stringPlus.AppendSpaceLine(2, "}"); stringPlus.AppendSpaceLine(3, updateShowAspxCs); stringPlus.AppendSpaceLine(2, "public void btnSave_Click(object sender, EventArgs e)"); stringPlus.AppendSpaceLine(2, "{"); stringPlus.AppendSpaceLine(3, updateAspxCs); stringPlus.AppendSpaceLine(2, "}"); return(stringPlus.ToString()); }