public static void ShowAzCustomMateManage(Form owner) { if (!MetadataOperate.ConfigWhetherInit()) { GeneralHelpler.SomethingWarning("当前配置未正确设置,请重新设置!!"); return; } if (!MetadataOperate.MetaWhetherInit()) { GeneralHelpler.SomethingWarning("当前配置元数据没有初始化,请先生成!!"); return; } foreach (var f in owner.MdiChildren) { if (f.Name == typeof(AzCustomMateManage).Name) { f.BringToFront(); return; } } AzCustomMateManage azCustomMateManage = new AzCustomMateManage { MdiParent = owner }; azCustomMateManage.Show(); }
public int UpdataDisplayFormOtherSchemaName(string currentSchemaName, string copyfromSchemaName) { string sql = MetadataOperate.DbCreateLoad(BaseConstants.Az_CopyMetaCloumfile) .ReaplaceTemplate(BaseConstants.Az_Parameters1, currentSchemaName.AddSingleQuotes()) .ReaplaceTemplate(BaseConstants.Az_Parameters2, copyfromSchemaName.AddSingleQuotes()); return(repository.ExecuteNonQuerySql().WithSql(sql).Go()); }
public int InitColumnValueSchema(string initSchemaName) { string sql = MetadataOperate.DbCreateLoad(BaseConstants.Az_InitColumnValueSchemafile) .ReaplaceTemplate(BaseConstants.Az_Parameters1, initSchemaName.AddSingleQuotes()) .ReaplaceTemplate(BaseConstants.AppNameDefautSign, MetadataOperate.GetDefAppNameUpdate(azNormalSet.AzBase.AzTablePrefix));; return(repository.ExecuteNonQuerySql().WithSql(sql).Go()); }
public int UpdataCodeSetVales() { return(repository.Update() .UsingTableName(azNormalSet.AzMetaTableName) .Set(m => m.CodeSetVales, string.Empty) .Where(m => m.AppName == MetadataOperate.GetDefAppNameUpdate(azNormalSet.AzBase.AzTablePrefix)) .Go()); }
public List <AzMetaTableEntity> GetDBSchema() { List <AzMetaTableEntity> result = new List <AzMetaTableEntity>(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" SELECT TOP (100) PERCENT A.name AS SchemaName, CASE WHEN A.xtype = 'U' THEN 1 WHEN A.xtype = 'V' THEN 2 ELSE 3 END AS ObjDataType, B.value as ClassDisPlay"); stringBuilder.Append(" FROM sys.sysobjects AS A LEFT OUTER JOIN"); stringBuilder.Append(" (SELECT TOP (100) PERCENT value, major_id"); stringBuilder.Append(" FROM sys.extended_properties"); stringBuilder.Append(" WHERE (name = N'MS_Description') AND (minor_id = 0)) AS B ON A.id = B.major_id"); if (string.IsNullOrWhiteSpace(azNormalSet.AzBase.AzTablePrefix)) { stringBuilder.Append(" WHERE (NOT (A.name LIKE N'sys%')) AND (NOT (A.name LIKE N'sp_%')) And(A.xtype = 'U' OR"); } else { stringBuilder.Append($" WHERE (NOT (A.name LIKE N'sys%')) AND (NOT (A.name LIKE N'sp_%')) And (A.name LIKE '{azNormalSet.AzBase.AzTablePrefix}%') AND (A.xtype = 'U' OR"); } stringBuilder.Append($" A.xtype = 'V' OR A.xtype = 'P') AND (NOT (A.name LIKE N'{BaseConstants.CodeToolName}%'))"); stringBuilder.Append(" ORDER BY SchemaName"); string cmdstr = stringBuilder.ToString(); string dbConnectionString = azNormalSet.AzConnectionString; using (SqlConnection cn = new SqlConnection(dbConnectionString)) { cn.Open(); using (SqlCommand cmd = new SqlCommand(cmdstr, cn)) { using (SqlDataReader atkDataReader = cmd.ExecuteReader()) { int id = 1; while (atkDataReader.Read()) { string scname = atkDataReader["SchemaName"] is DBNull ? null : (string)atkDataReader["SchemaName"]; string objname = ReMovePer(scname); AzMetaTableEntity schemaEntity = new AzMetaTableEntity(); schemaEntity.Id = id; schemaEntity.ClassName = azNormalSet.AzBase.AzClassPrefix + objname; schemaEntity.ObjModeName = objname; schemaEntity.SchemaName = scname; schemaEntity.AppName = MetadataOperate.GetDefAppNameUpdate(azNormalSet.AzBase.AzTablePrefix); schemaEntity.ObjDataType = (int)atkDataReader["ObjDataType"];; schemaEntity.ClassDisPlay = atkDataReader["ClassDisPlay"] is DBNull ? null : (string)atkDataReader["ClassDisPlay"]; schemaEntity.ObjModeType = 1; result.Add(schemaEntity); id += 1; } } } } return(result); }
private void tspButtonImport_Click(object sender, System.EventArgs e) { if (GeneralHelpler.ConfirmQuestionOperate("确定导入元数据吗?") == DialogResult.Cancel) { return; } var azMetaTable = azMetaTableEntities.AsQueryable().Where(m => m.ObjModeName == currentSelectObjModeName).FirstOrDefault(); if (azMetaTable != null) { var listcol = AzMetaCustomCloumHandle.Handle().Select().Where(m => m.TableName == azMetaTable.SchemaFrom).Go(); MetadataOperate.ImportCustomMetaData(azMetaTable.SchemaFrom, azMetaTable.SchemaName, listcol.Count() == 0); LoadMataColum(azMetaTable.SchemaFrom); // tspButtonImport.Enabled = false; } }
private void ACM_DBCreate(object sender, DoWorkEventArgs e) { // 创建 MetadataOperate.CreateMetaTable(); MetadataOperate.CreateMetaCloum(); MetadataOperate.CreateMetaQueryView(); MetadataOperate.CreateUpdateRemarkSp(); MetadataOperate.CreateExecSp(); // 清除数据 MetadataOperate.ClearAllMetaData(); // MetadataOperate.ImportMetaData(); MetadataOperate.InitMetaData(); }
private int CreateDBTabeOp(string objModeName) { AzMetaTableEntity azMetaTable = AzMetaTableHandle.Handle().Select() .Where(t => t.ObjModeName == objModeName) .Go().FirstOrDefault(); IEnumerable <AzMetaCustomCloumEntity> cloumListEntities = AzMetaCustomCloumHandle.Handle().Select() .Where(t => t.TableName == azMetaTable.SchemaName) .Go(); string strcreate = DataOperate.CreateDBObject(azMetaTable, cloumListEntities); int result = MetadataOperate.ExecuteCmd(strcreate); if (result > 0) { azMetaTable.ObjModeType = 0; azMetaTable.ObjDataType = 0; AzMetaTableHandle.Handle().Updata(azMetaTable); } return(result); }
private void SaveMasterInfo() { JavaScriptSerializer js = new JavaScriptSerializer(); if (string.IsNullOrWhiteSpace(azClassCreatProperty.ObjPresentation.UpdateTableName)) { azClassCreatProperty.ObjPresentation.UpdateTableName = azMetaTable.SchemaName; } azMetaTable.CodeSetVales = js.Serialize(azClassCreatProperty); if (azMetaTable.ComeFrom == 1) { azMetaTable.ObjModeType = 1; azMetaTable.AppName = MetadataOperate.GetDefAppNameUpdate(AzNormalSet.GetAzNormalSet().AzBase.AzTablePrefix); azMetaTable = AzMetaTableHandle.Handle().Insert(azMetaTable); return; } AzMetaTableHandle.Handle().Updata(azMetaTable); SetSelectedObject(azMetaTable); OnMasterSaveNotification?.Invoke(); }
private void btSave_Click(object sender, System.EventArgs e) { if (VerificationText()) { return; } int objModeType = 1; if (rdbMetaChild.Checked) { objModeType = 4; } metaTableEntity = new AzMetaTableEntity { ObjModeName = textObjModeName.Text, ClassName = textClassName.Text, SchemaName = textTableName.Text, SchemaFrom = textSchemaFrom.Text, ClassDisPlay = textClassDisPlay.Text, CodeSetVales = "", Remark = textRemark.Text, IsCustom = true, ObjDataType = 1, ObjModeType = objModeType, AppName = MetadataOperate.GetDefAppNameUpdate(azNormalSet.AzBase.AzTablePrefix), }; if (IsEdit) { metaTableEntity.Id = azId; AzMetaTableHandle.Handle().Updata(metaTableEntity); } else { AzMetaTableHandle.Handle().Insert(metaTableEntity); } DialogResult = DialogResult.OK; }
public void GenerateOne(AzMetaTableEntity azMetaTable) { MetadataOperate.ImportCustomMetaData(azMetaTable.SchemaName, azMetaTable.SchemaName); }
private void ACM_DBClearAll(object sender, DoWorkEventArgs e) { MetadataOperate.ClearAllMetaData(); }
private void ACM_DBInit(object sender, DoWorkEventArgs e) { MetadataOperate.InitMetaData(); }