using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace HySoft.BaseCallCenter.Web.formmanage { public partial class entityedit : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { string res = ""; string name = txtF_Name.Text.Trim(); string tablename = txtF_DBTableName.Value.Trim(); string tablepre = txtF_DBTableNamePre.Value.Trim(); try { DateTime dat = DateTime.Now; if (string.IsNullOrEmpty(name.Trim())) { res= "实体名称不能为空"; } if (string.IsNullOrEmpty(tablename.Trim())) { res= "实体数据表名不能为空"; } Model.T_Form_EntityInfo model = new Model.T_Form_EntityInfo(); model.F_Name = name.Trim(); model.F_DBTableName = tablepre.Trim() + tablename.Trim(); model.F_IsActivity = 1; model.F_Des = txtF_Remark.Text.Trim(); model.F_CreateSQL = ""; model.F_CreateOn = dat; model.F_LastModifyOn = dat; model.F_ModifySQL = ""; model.EntityAttributeItems= null; Model.T_Form_EntityAttribute[] arrmodel = new Model.T_Form_EntityAttribute[1]; Model.T_Form_EntityAttribute attributemodel = new Model.T_Form_EntityAttribute(); #region 主键 attributemodel.F_TypeId = 2; attributemodel.F_DBTypeName = "int"; attributemodel.F_Name = name.Trim() + "主键ID"; attributemodel.F_DBFieldlName = "F_" + tablename.Trim() + "Id"; attributemodel.F_DBTableName = model.F_DBTableName; attributemodel.F_Length = null; attributemodel.F_IsNullable = false; attributemodel.F_EntityId = model.F_EntityId; attributemodel.F_DefaultValue = null; attributemodel.F_ColumnNumber = 0; attributemodel.F_ValidForUpdateAPI = false; attributemodel.F_ValidForReadAPI = true; attributemodel.F_ValidForCreateAPI = false; attributemodel.F_VisibleToPlatform = false; attributemodel.F_IsPKAttribute = true; attributemodel.F_IsCustomField = false; attributemodel.F_DisplayMask = 0; attributemodel.F_IsSortAttribute = true; attributemodel.F_PrecisionValue = null; attributemodel.F_IsIdentity = true; attributemodel.F_AppDefaultValue = null; attributemodel.F_Locked = false; attributemodel.F_MaxLength = null; attributemodel.F_MinValue = null; attributemodel.F_MaxValue = null; attributemodel.F_LookupStyle = null; attributemodel.F_Des = name.Trim() + "主键ID"; #endregion arrmodel[0] = attributemodel; model.EntityAttributeItems = arrmodel; int r = new BLL.T_Form_EntityInfo().AddTran(model); if (r == 0) { res = "success"; } else { if (r == -2) { res = "创建实体失败:实体数据表名称已存在"; } else if (r == -1) { res = "创建实体失败-1"; } else { res = "创建实体失败" + r.ToString(); } } } catch { res = "创建实体异常"; } } } }