/// <summary> /// Check Existence of Std columns and create them in AD and DB /// </summary> /// <param name="table">name of the table</param> /// <param name="EntityType">Entity Type</param> public static void CheckStandardColumns(MTable table, String EntityType) { if (table == null) { return; } if (Utility.Util.IsEmpty(EntityType)) { EntityType = table.GetEntityType(); } table.GetColumns(true); // get new columns // Key Column String colName = table.GetTableName() + "_ID"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.ID); col.SetIsKey(true); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetEntityType(EntityType); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } colName = "AD_Client_ID"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.TableDir); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetAD_Val_Rule_ID(116); // Client Login col.SetDefaultValue("@#AD_Client_ID@"); col.SetConstraintType(X_AD_Column.CONSTRAINTTYPE_Restrict); col.SetEntityType(EntityType); col.SetIsCopy(true); // By Default isCopy check box should be true on this Column. CreateColumn(col, table, true); } colName = "AD_Org_ID"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.TableDir); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetIsMandatoryUI(true); col.SetAD_Val_Rule_ID(104); // Org Security col.SetDefaultValue("@#AD_Org_ID@"); col.SetConstraintType(X_AD_Column.CONSTRAINTTYPE_Restrict); col.SetEntityType(EntityType); col.SetIsCopy(true); // By Default isCopy check box should be true on this Column. CreateColumn(col, table, true); } colName = "Created"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.DateTime); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetEntityType(EntityType); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } colName = "Updated"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.DateTime); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetEntityType(EntityType); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } colName = "CreatedBy"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.Table); col.SetAD_Reference_Value_ID(110); col.SetConstraintType(X_AD_Column.CONSTRAINTTYPE_DoNOTCreate); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetEntityType(EntityType); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } colName = "UpdatedBy"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.Table); col.SetAD_Reference_Value_ID(110); col.SetConstraintType(X_AD_Column.CONSTRAINTTYPE_DoNOTCreate); col.SetIsUpdateable(false); col.SetIsMandatory(true); col.SetEntityType(EntityType); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } colName = "IsActive"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.YesNo); col.SetDefaultValue("Y"); col.SetIsUpdateable(true); col.SetIsMandatory(true); col.SetEntityType(EntityType); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } colName = "Export_ID"; if (table.GetColumn(colName) == null) { MColumn col = new MColumn(table); col.SetColumnName(colName); col.SetAD_Reference_ID(DisplayType.String); col.SetIsUpdateable(true); col.SetIsMandatory(false); col.SetEntityType(EntityType); col.SetFieldLength(50); col.SetIsCopy(false); // By Default isCopy check box should be False on this Column. CreateColumn(col, table, true); } } // checkStandardColumns