private void ProcessPropertyChange(IEntity entity, TransactionStep step) { ElementBaseData ebd = entity.__Elements.Find(e => e.Name.Equals(step.MemberName)); if (ebd != null) { if (step.PropertyValueEntity != null) { ElementBaseData ebdpv = step.PropertyValueEntity.__Elements.Find(e => e.Name.Equals(step.PropertyValueElementName)); if (ebd != null) { memento.Add(new Tuple <IEntity, DataProxy, object>(entity, new DataProxy((int)ebd.ID, ebd.Data), ebdpv.Data)); ebd.Data = ebdpv.Data; } else { //set notification } } else { memento.Add(new Tuple <IEntity, DataProxy, object>(entity, new DataProxy((int)ebd.ID, ebd.Data), step.PropertyValue)); ebd.Data = step.PropertyValue; } } else { //set notification } }
//private static void PopulateChildElement<T>(SqlDataReader reader, ElementBaseData element) where T : IEntity //{ // if (reader.NextResult()) // { // if (element.IsCollection) // { // Type T2 = typeof(T).GetProperties().ToList().Find(p => p.Name.Equals(element.Name)).PropertyType.GetGenericArguments()[0]; // //getLogger().Info(string.Format("----------- {0}--------------", T2.FullName)); // MethodInfo method = typeof(CRUDActions).GetMethod("PopulateChildElementCollection", BindingFlags.NonPublic | BindingFlags.Static); // MethodInfo generic = method.MakeGenericMethod(T2); // object[] arguments = { reader, element }; // generic.Invoke(null, arguments); // } // else // { // if (reader.Read()) // (element.Data as IEntity).Elements.Where(el => (el.MultipleResultSetIndex == null && el.IsCollection == false)).ToList<ElementBaseData>().ForEach(e => SetData(reader, e)); // else // (element.Data as IEntity).Notifications.Add(new Notification() { Severity = Notification.NoticeType.Warning, Message = "Record not found. for " }); // } // } //} //private static void PopulateChildElementCollection<T2>(SqlDataReader reader, ElementBaseData element) //{ // (element.Data as Collection<T2>).AddRange(reader); //} private static void PopulateChildElement <T>(SqlDataReader reader, ElementBaseData element) where T : IEntity { //if (reader.NextResult()) //{ if (element.IsCollection) { Type T2 = typeof(T).GetProperties().ToList().Find(p => p.Name.Equals(element.Name)).PropertyType.GetGenericArguments()[0]; MethodInfo method = typeof(CRUDActions).GetMethod("PopulateChildElementCollection", BindingFlags.NonPublic | BindingFlags.Static); MethodInfo generic = method.MakeGenericMethod(T2); object[] arguments = { reader, element }; generic.Invoke(null, arguments); } else { if (reader.Read()) { (element.Data as IEntity).__Elements.Where(el => (el.MultipleResultSetIndex == null && el.IsCollection == false)).ToList <ElementBaseData>().ForEach(e => SetData(reader, e)); } else { (element.Data as IEntity).Notifications.Add(new Notification() { Severity = Notification.NoticeType.Warning, Message = "Record not found. for " }); } } //} }
private void Initialize() { __EntityName = "Rule"; ElementBaseData ebdRuleType = new ElementBaseData(RuleElementIndex.RuleType) { Data = String.Empty }; ElementBaseData ebdMessage = new ElementBaseData(RuleElementIndex.Message) { Data = String.Empty }; ElementBaseData ebdValue = new ElementBaseData(RuleElementIndex.Value) { Data = String.Empty }; ElementBaseData ebdIsString = new ElementBaseData(RuleElementIndex.IsString) { Data = false }; RuleFields.Add("RuleType", AddField(ebdRuleType)); RuleFields.Add("Message", AddField(ebdMessage)); RuleFields.Add("Value", AddField(ebdValue)); RuleFields.Add("IsString", AddField(ebdIsString)); }
private void Initialize() { __EntityName = "Method"; ElementBaseData ebdArguments = new ElementBaseData(MethodElementIndex.Arguments) { Data = new List <Argument>() }; ElementBaseData ebdCode = new ElementBaseData(MethodElementIndex.Code) { Data = String.Empty }; ElementBaseData ebdReturnType = new ElementBaseData(MethodElementIndex.ReturnType) { Data = new FieldType() }; ElementBaseData ebdFramework = new ElementBaseData(MethodElementIndex.Framework) { Data = String.Empty }; MethodFields.Add("Arguments", AddField(ebdArguments)); MethodFields.Add("Code", AddField(ebdCode)); MethodFields.Add("ReturnType", AddField(ebdReturnType)); MethodFields.Add("Framework", AddField(ebdFramework)); AttachedCollections.Add(ebdArguments); AttachedCollections.Add(ebdReturnType); }
private void Initialize() { __EntityName = "Action"; ElementBaseData ebdParametersIn = new ElementBaseData(ActionElementIndex.ParametersIn) { Data = new List <Field>() }; ElementBaseData ebdParametersOut = new ElementBaseData(ActionElementIndex.ParametersOut) { Data = new List <Field>() }; ElementBaseData ebdParametersInOut = new ElementBaseData(ActionElementIndex.ParametersInOut) { Data = new List <Field>() }; ElementBaseData ebdScript = new ElementBaseData(ActionElementIndex.Script) { Data = String.Empty }; ActionFields.Add("ParametersIn", AddField(ebdParametersIn)); ActionFields.Add("ParametersOut", AddField(ebdParametersOut)); ActionFields.Add("ParametersInOut", AddField(ebdParametersInOut)); ActionFields.Add("Script", AddField(ebdScript)); AttachedCollections.Add(ebdParametersIn); AttachedCollections.Add(ebdParametersOut); AttachedCollections.Add(ebdParametersInOut); }
private static bool SetConflicts(IEntity entity, IEntity copy) { bool ret = false; entity.CRUDConflict.Clear(); long fieldsToSave = entity.Compare(); if (fieldsToSave > 0) { long fieldsThatHaveChanged = copy.Compare(entity.__Memento); long otherFieldsChanged = Math.Abs(fieldsToSave - (fieldsToSave & fieldsThatHaveChanged)); if ((fieldsThatHaveChanged & fieldsToSave) > 0) { List <string> conflictMessages = new List <string>(); conflictMessages.Add("Other users have altered some of the same data during your session."); long conflictedFields = fieldsThatHaveChanged & fieldsToSave; List <int> fields = new List <int>(); long bw = 1; for (int i = 0; i < 64; i++) { if ((conflictedFields & bw) == bw) { int elementId = i; fields.Add(elementId); ElementBaseData element = entity.__Elements[i]; conflictMessages.Add(String.Format("Field '{0}' has been changed from '{1}' to '{2}' by another user.", element.Name, entity.__Memento.Find(m => m.ElementId == elementId).Data.ToString(), copy.__Elements[elementId].Data.ToString())); } bw = bw + bw; } List <CRUDOption> options = new List <CRUDOption>(); options.Add(new CRUDOption() { Message = "Save all my changes", OptionType = CRUDOption.CRUDOptionType.SaveAll }); if (otherFieldsChanged > 0) { options.Add(new CRUDOption() { Message = "Save my changes that don't conflict", OptionType = CRUDOption.CRUDOptionType.SaveNonConflicts }); } options.Add(new CRUDOption() { Message = "Cancel Save", OptionType = CRUDOption.CRUDOptionType.Cancel }); entity.CRUDConflict.Fields = fields; entity.CRUDConflict.Messages = conflictMessages; entity.CRUDConflict.Options = options; } } return(ret); }
private void Initialize() { __EntityName = "FieldPresentation"; ElementBaseData ebdDefaultValue = new ElementBaseData(FieldPresentationElementIndex.DefaultValue) { Data = String.Empty }; ElementBaseData ebdDisplayName = new ElementBaseData(FieldPresentationElementIndex.DisplayName) { Data = String.Empty }; ElementBaseData ebdHideOnAdd = new ElementBaseData(FieldPresentationElementIndex.HideOnAdd) { Data = false }; ElementBaseData ebdHideOnEdit = new ElementBaseData(FieldPresentationElementIndex.HideOnEdit) { Data = false }; ElementBaseData ebdHideOnSummary = new ElementBaseData(FieldPresentationElementIndex.HideOnSummary) { Data = false }; ElementBaseData ebdIsDateOnly = new ElementBaseData(FieldPresentationElementIndex.IsDateOnly) { Data = false }; ElementBaseData ebdIsTimeOnly = new ElementBaseData(FieldPresentationElementIndex.IsTimeOnly) { Data = false }; ElementBaseData ebdRedact = new ElementBaseData(FieldPresentationElementIndex.Redact) { Data = false }; ElementBaseData ebdConfirm = new ElementBaseData(FieldPresentationElementIndex.Confirm) { Data = false }; ElementBaseData ebdFieldContainerGuid = new ElementBaseData(FieldPresentationElementIndex.FieldContainerGuid) { Data = Guid.Empty }; FieldPresentationFields.Add("DefaultValue", AddField(ebdDefaultValue)); FieldPresentationFields.Add("DisplayName", AddField(ebdDisplayName)); FieldPresentationFields.Add("HideOnAdd", AddField(ebdHideOnAdd)); FieldPresentationFields.Add("HideOnEdit", AddField(ebdHideOnEdit)); FieldPresentationFields.Add("HideOnSummary", AddField(ebdHideOnSummary)); FieldPresentationFields.Add("IsDateOnly", AddField(ebdIsDateOnly)); FieldPresentationFields.Add("IsTimeOnly", AddField(ebdIsTimeOnly)); FieldPresentationFields.Add("Redact", AddField(ebdRedact)); FieldPresentationFields.Add("Confirm", AddField(ebdConfirm)); FieldPresentationFields.Add("FieldContainerGuid", AddField(ebdFieldContainerGuid)); }
private static void HydrateElement(ElementBaseData element, SqlParameter parameter) { if (parameter.SqlDbType.Equals(SqlDbType.Bit)) { element.Data = bool.Parse(parameter.Value.ToString()); } else { element.Data = parameter.Value; } }
private void Initialize() { __EntityName = "Iteration"; ElementBaseData ebdValue = new ElementBaseData(IterationElementIndex.Value) { Data = String.Empty }; IterationFields.Add("Value", AddField(ebdValue)); }
//private bool HasColumn(DataRow row, string columnName) //{ // return row.Table.Columns.Contains(columnName); //} private void ProcessReader(ElementBaseData element, SqlDataReader reader) { if (HasColumn(reader, element.Name)) { var index = reader.GetOrdinal(element.Name); //getLogger().Trace(string.Format("Collection->AddRange->ProcessReader {0} {1}", element.Name, reader.GetValue(reader.GetOrdinal(element.Name)))); element.Data = reader.GetFieldType(index).Name == "Boolean" ? reader.GetBoolean(index) : reader.GetValue(index); } else { //getLogger().Debug(String.Format("---------------------------------- element '{0}' not found in data reader", element.Name)); } }
private void Initialize() { __EntityName = "DataType"; ElementBaseData ebdSize = new ElementBaseData(DataTypeElementIndex.Size) { Data = null }; ElementBaseData ebdPrecision = new ElementBaseData(DataTypeElementIndex.Precision) { Data = null }; ElementBaseData ebdScale = new ElementBaseData(DataTypeElementIndex.Scale) { Data = null }; ElementBaseData ebdIsIdentity = new ElementBaseData(DataTypeElementIndex.IsIdentity) { Data = false }; ElementBaseData ebdColumnType = new ElementBaseData(DataTypeElementIndex.ColumnType) { Data = String.Empty }; ElementBaseData ebdDefaultValue = new ElementBaseData(DataTypeElementIndex.DefaultValue) { Data = String.Empty }; ElementBaseData ebdIsPrimaryKey = new ElementBaseData(DataTypeElementIndex.IsPrimaryKey) { Data = false }; ElementBaseData ebdMultipleResultSetIndex = new ElementBaseData(DataTypeElementIndex.MultipleResultSetIndex) { Data = 0 }; ElementBaseData ebdIsIdentifier = new ElementBaseData(DataTypeElementIndex.IsIdentifier) { Data = false }; DataTypeFields.Add("Size", AddField(ebdSize)); DataTypeFields.Add("Precision", AddField(ebdPrecision)); DataTypeFields.Add("Scale", AddField(ebdScale)); DataTypeFields.Add("IsIdentity", AddField(ebdIsIdentity)); DataTypeFields.Add("ColumnType", AddField(ebdColumnType)); DataTypeFields.Add("DefaultValue", AddField(ebdDefaultValue)); DataTypeFields.Add("IsPrimaryKey", AddField(ebdIsPrimaryKey)); DataTypeFields.Add("MultipleResultSetIndex", AddField(ebdMultipleResultSetIndex)); DataTypeFields.Add("IsIdentifier", AddField(ebdIsIdentifier)); }
private void ProcessPropertyEntityRow(IEntity entity, ElementBaseData element, DataRow row, List <string> parentPropertyEntityNames) { IEntity propertyEntity; if (element.Data == null) { try { propertyEntity = (IEntity)Activator.CreateInstance(entity.GetType().AssemblyQualifiedName.Split(',')[1].Trim(), String.Format("{0}.{1}", element.EntityType, element.TypeName)).Unwrap(); } catch (System.Exception ex) { return; } } else { propertyEntity = (IEntity)element.Data; } parentPropertyEntityNames.Add(propertyEntity.__EntityName); propertyEntity.__Elements.Where(ebd => !ebd.IsEntity).ToList().ForEach(ebd => { string rowName = String.Format("{0}_{1}", String.Join("_", parentPropertyEntityNames), ebd.Name); if (row.Table.Columns.Contains(rowName)) { ebd.Data = row[rowName]; } }); propertyEntity.__Elements.Where(ebd => ebd.IsEntity).ToList().ForEach(ebd => { ProcessPropertyEntityRow(propertyEntity, ebd, row, parentPropertyEntityNames); }); //foreach (ElementBaseData ebd in propertyEntity.__Elements.Where()) //{ // if (ebd.IsEntity) // { // ProcessPropertyEntityRow(propertyEntity, ebd, row, parentPropertyEntityNames); // } // else if (row.Table.Columns.Contains(propertyEntity.__EntityName + "_" + ebd.Name)) // { // ebd.Data = row[propertyEntity.__EntityName + "_" + ebd.Name]; // } //} element.Data = propertyEntity; }
private static void SetData(SqlDataReader reader, ElementBaseData element) { if (HasColumn(reader, element.Name)) { var index = reader.GetOrdinal(element.Name); //element.Data = reader.GetValue(reader.GetOrdinal(element.Name)); element.Data = reader.GetFieldType(index).Name == "Boolean" ? reader.GetBoolean(index) : reader.GetValue(index); //getLogger().Trace(String.Format("SetData Name: {0} Value: '{1}'", element.Name, element.Data)); } else { //getLogger().Debug(String.Format("---------------------------------- element '{0}' not found in data reader", element.Name)); } }
private void Initialize() { __EntityName = "Argument"; ElementBaseData ebdFieldType = new ElementBaseData(ArgumentElementIndex.FieldType) { Data = new FieldType() }; ElementBaseData ebdIsEntity = new ElementBaseData(ArgumentElementIndex.IsEntity) { Data = false }; ArgumentFields.Add("FieldType", AddField(ebdFieldType)); ArgumentFields.Add("IsEntity", AddField(ebdIsEntity)); AttachedCollections.Add(ebdFieldType); }
private void Initialize() { __EntityName = "Base"; RegisterActions(typeof(BaseActions)); ElementBaseData ebdComment = new ElementBaseData(BaseElementIndex.Comment) { ID = (int)BaseFields.Comment, Data = String.Empty }; ElementBaseData ebdInternalNote = new ElementBaseData(BaseElementIndex.InternalNote) { ID = (int)BaseFields.InternalNote, Data = String.Empty }; ElementBaseData ebdBaseGuid = new ElementBaseData(BaseElementIndex.BaseGuid) { ID = (int)BaseFields.BaseGuid, Data = Guid.Empty }; ElementBaseData ebdDirtyFlag = new ElementBaseData(BaseElementIndex.DirtyFlag) { ID = (int)BaseFields.DirtyFlag, Data = false }; ElementBaseData ebdSequence = new ElementBaseData(BaseElementIndex.Sequence) { ID = (int)BaseFields.Sequence, Data = 0 }; ElementBaseData ebdName = new ElementBaseData(BaseElementIndex.Name) { ID = (int)BaseFields.Name, Data = String.Empty }; __Elements.Add(ebdComment); __Elements.Add(ebdInternalNote); __Elements.Add(ebdBaseGuid); __Elements.Add(ebdDirtyFlag); __Elements.Add(ebdSequence); __Elements.Add(ebdName); }
private void Initialize() { __EntityName = "Enumeration"; ElementBaseData ebdIterations = new ElementBaseData(EnumerationElementIndex.Iterations) { Data = new List <Iteration>() }; ElementBaseData ebdFieldType = new ElementBaseData(EnumerationElementIndex.FieldType) { Data = new FieldType() }; EnumerationFields.Add("Iterations", AddField(ebdIterations)); EnumerationFields.Add("FieldType", AddField(ebdFieldType)); AttachedCollections.Add(ebdIterations); AttachedCollections.Add(ebdFieldType); }
private void Initialize() { __EntityName = "Extension"; ElementBaseData ebdNamespace = new ElementBaseData(ExtensionElementIndex.Namespace) { Data = String.Empty }; ElementBaseData ebdBluePrintGuid = new ElementBaseData(ExtensionElementIndex.BluePrintGuid) { Data = Guid.Empty }; ElementBaseData ebdVersion = new ElementBaseData(ExtensionElementIndex.Version) { Data = String.Empty }; ExtensionFields.Add("Namespace", AddField(ebdNamespace)); ExtensionFields.Add("BluePrintGuid", AddField(ebdBluePrintGuid)); ExtensionFields.Add("Version", AddField(ebdVersion)); }
private void Initialize() { __EntityName = "Interface"; ElementBaseData ebdFields = new ElementBaseData(InterfaceElementIndex.Fields) { Data = new List <Field>() }; ElementBaseData ebdNamespace = new ElementBaseData(InterfaceElementIndex.Namespace) { Data = String.Empty }; ElementBaseData ebdBluePrintGuid = new ElementBaseData(InterfaceElementIndex.BluePrintGuid) { Data = Guid.Empty }; ElementBaseData ebdVersion = new ElementBaseData(InterfaceElementIndex.Version) { Data = String.Empty }; ElementBaseData ebdExtended = new ElementBaseData(InterfaceElementIndex.Extended) { Data = new Extension() }; ElementBaseData ebdFieldContainerGuid = new ElementBaseData(InterfaceElementIndex.FieldContainerGuid) { Data = Guid.NewGuid() }; InterfaceFields.Add("Fields", AddField(ebdFields)); InterfaceFields.Add("Namespace", AddField(ebdNamespace)); InterfaceFields.Add("BluePrintGuid", AddField(ebdBluePrintGuid)); InterfaceFields.Add("Version", AddField(ebdVersion)); InterfaceFields.Add("Extended", AddField(ebdExtended)); InterfaceFields.Add("FieldContainerGuid", AddField(ebdFieldContainerGuid)); AttachedCollections.Add(ebdFields); AttachedCollections.Add(ebdExtended); }
private void ProcessRow(IEntity entity, ElementBaseData element, DataRow row) { if (element.IsEntity) { ProcessPropertyEntityRow(entity, element, row, new List <string>()); //IEntity propertyEntity; //if (element.Data == null) // propertyEntity = (IEntity)Activator.CreateInstance(entity.GetType().AssemblyQualifiedName.Split(',')[1].Trim(), String.Format("{0}.{1}", entity.GetType().Namespace, element.TypeName)).Unwrap(); //else // propertyEntity = (IEntity)element.Data; //foreach (ElementBaseData ebd in propertyEntity.__Elements) //{ // if (row.Table.Columns.Contains(propertyEntity.__EntityName + "_" + ebd.Name)) // { // ebd.Data = row[propertyEntity.__EntityName + "_" + ebd.Name]; // } //} //element.Data = propertyEntity; } else { if (row.Table.Columns.Contains(element.Name)) { element.Data = row[element.Name] is System.DBNull ? null : row[element.Name]; //var index = reader.GetOrdinal(element.Name); ////getLogger().Trace(string.Format("Collection->AddRange->ProcessReader {0} {1}", element.Name, reader.GetValue(reader.GetOrdinal(element.Name)))); //element.Data = reader.GetFieldType(index).Name == "Boolean" ? reader.GetBoolean(index) : reader.GetValue(index); } else { //getLogger().Debug(String.Format("---------------------------------- element '{0}' not found in data reader", element.Name)); } } }
private static void UpdateAttachedCollection <T>(SqlConnection conn, IEntity entity, ElementBaseData attachedCollection) where T : IEntity { Type T2 = typeof(T).GetProperties().ToList().Find(p => p.Name.Equals(attachedCollection.Name)).PropertyType.GetGenericArguments()[0]; MethodInfo method = typeof(CRUDActions).GetMethod("UpdateAttachedCollectionType", BindingFlags.NonPublic | BindingFlags.Static); MethodInfo generic = method.MakeGenericMethod(T2); object[] arguments = { conn, entity, attachedCollection }; generic.Invoke(null, arguments); }
private static void SaveCollection(ElementBaseData ebd, IEntity copy) { //(ebdData as List<T>) }
private void Initialize() { __EntityName = "Field"; ElementBaseData ebdDisplayName = new ElementBaseData(FieldElementIndex.DisplayName) { Data = String.Empty }; ElementBaseData ebdRules = new ElementBaseData(FieldElementIndex.Rules) { Data = new List <Rule>() }; ElementBaseData ebdDataType = new ElementBaseData(FieldElementIndex.DataType) { Data = new DataType() }; ElementBaseData ebdAttributes = new ElementBaseData(FieldElementIndex.Attributes) { Data = new List <Attribute>() }; ElementBaseData ebdDefaultValue = new ElementBaseData(FieldElementIndex.DefaultValue) { Data = String.Empty }; ElementBaseData ebdFieldType = new ElementBaseData(FieldElementIndex.FieldType) { Data = new FieldType() }; ElementBaseData ebdIsNodeAttribute = new ElementBaseData(FieldElementIndex.IsNodeAttribute) { Data = false }; ElementBaseData ebdIsNodeValue = new ElementBaseData(FieldElementIndex.IsNodeValue) { Data = false }; ElementBaseData ebdIsDateOnly = new ElementBaseData(FieldElementIndex.IsDateOnly) { Data = false }; ElementBaseData ebdIsTimeOnly = new ElementBaseData(FieldElementIndex.IsTimeOnly) { Data = false }; ElementBaseData ebdUseForMatching = new ElementBaseData(FieldElementIndex.UseForMatching) { Data = false }; ElementBaseData ebdIsEntity = new ElementBaseData(FieldElementIndex.IsEntity) { Data = false }; ElementBaseData ebdDataChangeNotification = new ElementBaseData(FieldElementIndex.DataChangeNotification) { Data = false }; ElementBaseData ebdDependant = new ElementBaseData(FieldElementIndex.Dependant) { Data = false }; ElementBaseData ebdHideOnAdd = new ElementBaseData(FieldElementIndex.HideOnAdd) { Data = false }; ElementBaseData ebdHideOnEdit = new ElementBaseData(FieldElementIndex.HideOnEdit) { Data = false }; ElementBaseData ebdHideOnSummary = new ElementBaseData(FieldElementIndex.HideOnSummary) { Data = false }; ElementBaseData ebdRedact = new ElementBaseData(FieldElementIndex.Redact) { Data = false }; ElementBaseData ebdConfirm = new ElementBaseData(FieldElementIndex.Confirm) { Data = false }; ElementBaseData ebdFieldPresentations = new ElementBaseData(FieldElementIndex.FieldPresentations) { Data = new List <FieldPresentation>() }; FieldFields.Add("DisplayName", AddField(ebdDisplayName)); FieldFields.Add("Rules", AddField(ebdRules)); FieldFields.Add("DataType", AddField(ebdDataType)); FieldFields.Add("Attributes", AddField(ebdAttributes)); FieldFields.Add("DefaultValue", AddField(ebdDefaultValue)); FieldFields.Add("FieldType", AddField(ebdFieldType)); FieldFields.Add("IsNodeAttribute", AddField(ebdIsNodeAttribute)); FieldFields.Add("IsNodeValue", AddField(ebdIsNodeValue)); FieldFields.Add("IsDateOnly", AddField(ebdIsDateOnly)); FieldFields.Add("IsTimeOnly", AddField(ebdIsTimeOnly)); FieldFields.Add("UseForMatching", AddField(ebdUseForMatching)); FieldFields.Add("IsEntity", AddField(ebdIsEntity)); FieldFields.Add("DataChangeNotification", AddField(ebdDataChangeNotification)); FieldFields.Add("Dependant", AddField(ebdDependant)); FieldFields.Add("HideOnAdd", AddField(ebdHideOnAdd)); FieldFields.Add("HideOnEdit", AddField(ebdHideOnEdit)); FieldFields.Add("HideOnSummary", AddField(ebdHideOnSummary)); FieldFields.Add("Redact", AddField(ebdRedact)); FieldFields.Add("Confirm", AddField(ebdConfirm)); FieldFields.Add("FieldPresentations", AddField(ebdFieldPresentations)); AttachedCollections.Add(ebdRules); AttachedCollections.Add(ebdDataType); AttachedCollections.Add(ebdAttributes); AttachedCollections.Add(ebdFieldType); AttachedCollections.Add(ebdFieldPresentations); }
private static void UpdateAttachedCollectionType <T2>(SqlConnection conn, IEntity entity, ElementBaseData attachedCollection) where T2 : IEntity { SqlParameter[] para = BuildSqlParameters(entity.__Elements.Where(e => e.UseForMatching).ToList()); para = para.Distinct().ToArray(); if (conn.State.Equals(ConnectionState.Closed)) { conn.Open(); } (attachedCollection.Data as List <T2>).ForEach(e => UpdateAttachedCollectionItem <T2>(conn, entity, para, e, attachedCollection.Name)); }
private void Initialize() { __EntityName = "FieldType"; ElementBaseData ebdFramework = new ElementBaseData(FieldTypeElementIndex.Framework) { Data = String.Empty }; ElementBaseData ebdIsNullable = new ElementBaseData(FieldTypeElementIndex.IsNullable) { Data = false }; ElementBaseData ebdIsCollection = new ElementBaseData(FieldTypeElementIndex.IsCollection) { Data = false }; ElementBaseData ebdCollectionType = new ElementBaseData(FieldTypeElementIndex.CollectionType) { Data = String.Empty }; ElementBaseData ebdDefaultValue = new ElementBaseData(FieldTypeElementIndex.DefaultValue) { Data = String.Empty }; ElementBaseData ebdTextEncoding = new ElementBaseData(FieldTypeElementIndex.TextEncoding) { Data = String.Empty }; ElementBaseData ebdIsFactoryEntity = new ElementBaseData(FieldTypeElementIndex.IsFactoryEntity) { Data = false }; ElementBaseData ebdFieldTypeOption = new ElementBaseData(FieldTypeElementIndex.FieldTypeOption) { Data = String.Empty }; ElementBaseData ebdIsInterface = new ElementBaseData(FieldTypeElementIndex.IsInterface) { Data = false }; ElementBaseData ebdNamespace = new ElementBaseData(FieldTypeElementIndex.Namespace) { Data = String.Empty }; ElementBaseData ebdFieldTypeName = new ElementBaseData(FieldTypeElementIndex.FieldTypeName) { Data = String.Empty }; ElementBaseData ebdIsAttached = new ElementBaseData(FieldTypeElementIndex.IsAttached) { Data = false }; ElementBaseData ebdDoNotPersist = new ElementBaseData(FieldTypeElementIndex.DoNotPersist) { Data = false }; ElementBaseData ebdSqlDataType = new ElementBaseData(FieldTypeElementIndex.SqlDataType) { Data = String.Empty }; ElementBaseData ebdBluePrintGuid = new ElementBaseData(FieldTypeElementIndex.BluePrintGuid) { Data = Guid.Empty }; ElementBaseData ebdVersion = new ElementBaseData(FieldTypeElementIndex.Version) { Data = String.Empty }; ElementBaseData ebdIsOneToMany = new ElementBaseData(FieldTypeElementIndex.IsOneToMany) { Data = false }; FieldTypeFields.Add("Framework", AddField(ebdFramework)); FieldTypeFields.Add("IsNullable", AddField(ebdIsNullable)); FieldTypeFields.Add("IsCollection", AddField(ebdIsCollection)); FieldTypeFields.Add("CollectionType", AddField(ebdCollectionType)); FieldTypeFields.Add("DefaultValue", AddField(ebdDefaultValue)); FieldTypeFields.Add("TextEncoding", AddField(ebdTextEncoding)); FieldTypeFields.Add("IsFactoryEntity", AddField(ebdIsFactoryEntity)); FieldTypeFields.Add("FieldTypeOption", AddField(ebdFieldTypeOption)); FieldTypeFields.Add("IsInterface", AddField(ebdIsInterface)); FieldTypeFields.Add("Namespace", AddField(ebdNamespace)); FieldTypeFields.Add("FieldTypeName", AddField(ebdFieldTypeName)); FieldTypeFields.Add("IsAttached", AddField(ebdIsAttached)); FieldTypeFields.Add("DoNotPersist", AddField(ebdDoNotPersist)); FieldTypeFields.Add("SqlDataType", AddField(ebdSqlDataType)); FieldTypeFields.Add("BluePrintGuid", AddField(ebdBluePrintGuid)); FieldTypeFields.Add("Version", AddField(ebdVersion)); FieldTypeFields.Add("IsOneToMany", AddField(ebdIsOneToMany)); }
private void Initialize() { __EntityName = "Entity"; ElementBaseData ebdFields = new ElementBaseData(EntityElementIndex.Fields) { Data = new List <Field>() }; ElementBaseData ebdActions = new ElementBaseData(EntityElementIndex.Actions) { Data = new List <Action>() }; ElementBaseData ebdEnumerators = new ElementBaseData(EntityElementIndex.Enumerators) { Data = new List <Enumeration>() }; ElementBaseData ebdAttributes = new ElementBaseData(EntityElementIndex.Attributes) { Data = new List <Attribute>() }; ElementBaseData ebdInterfaces = new ElementBaseData(EntityElementIndex.Interfaces) { Data = new List <Interface>() }; ElementBaseData ebdExtended = new ElementBaseData(EntityElementIndex.Extended) { Data = new Extension() }; ElementBaseData ebdEntityId = new ElementBaseData(EntityElementIndex.EntityId) { Data = 0 }; ElementBaseData ebdEntityName = new ElementBaseData(EntityElementIndex.EntityName) { Data = String.Empty }; ElementBaseData ebdBluePrintGuid = new ElementBaseData(EntityElementIndex.BluePrintGuid) { Data = Guid.Empty }; ElementBaseData ebdVersion = new ElementBaseData(EntityElementIndex.Version) { Data = String.Empty }; ElementBaseData ebdDeletionType = new ElementBaseData(EntityElementIndex.DeletionType) { Data = DeletionTypeOption.Delete }; ElementBaseData ebdIcon = new ElementBaseData(EntityElementIndex.Icon) { Data = String.Empty }; ElementBaseData ebdMethods = new ElementBaseData(EntityElementIndex.Methods) { Data = new List <Method>() }; ElementBaseData ebdFieldContainerGuid = new ElementBaseData(EntityElementIndex.FieldContainerGuid) { Data = Guid.NewGuid() }; EntityFields.Add("Fields", AddField(ebdFields)); EntityFields.Add("Actions", AddField(ebdActions)); EntityFields.Add("Enumerators", AddField(ebdEnumerators)); EntityFields.Add("Attributes", AddField(ebdAttributes)); EntityFields.Add("Interfaces", AddField(ebdInterfaces)); EntityFields.Add("Extended", AddField(ebdExtended)); EntityFields.Add("EntityId", AddField(ebdEntityId)); EntityFields.Add("EntityName", AddField(ebdEntityName)); EntityFields.Add("BluePrintGuid", AddField(ebdBluePrintGuid)); EntityFields.Add("Version", AddField(ebdVersion)); EntityFields.Add("DeletionType", AddField(ebdDeletionType)); EntityFields.Add("Icon", AddField(ebdIcon)); EntityFields.Add("Methods", AddField(ebdMethods)); EntityFields.Add("FieldContainerGuid", AddField(ebdFieldContainerGuid)); AttachedCollections.Add(ebdFields); AttachedCollections.Add(ebdActions); AttachedCollections.Add(ebdEnumerators); AttachedCollections.Add(ebdAttributes); AttachedCollections.Add(ebdInterfaces); AttachedCollections.Add(ebdExtended); AttachedCollections.Add(ebdMethods); }
private static void PopulateChildElementCollection <T2>(SqlDataReader reader, ElementBaseData element) where T2 : IEntity { Collection <T2> col = new Collection <T2>(); col.AddRange(reader); col.ToList().ForEach(i => (element.Data as List <T2>).Add(i)); //(element.Data as Collection<T2>).AddRange(reader); }
private static void ConvertElementToSqlParameterIn(List <SqlParameter> parameters, ElementBaseData ebd) { //if (ebd.IsEntity) //{ // Type elementType = ebd.Data.GetType(); // IEntity entityInstance = (IEntity)Activator.CreateInstance(elementType); // List<ElementBaseData> childElements = entityInstance.Elements.Where(i => (ebd.ChildParametersIn & i.Bitwise) = i.Bitwise); //} //else parameters.Add(new SqlParameter(ebd.Name, ebd.Data)); }