public void UpdateTypeTest() { Bso.Archive.BusObj.EventType testType = Bso.Archive.BusObj.EventType.GetEventTypeByID(-1); if (testType.IsNew) { testType.TypeID = -1; } testType.TypeName = "Adage"; BsoArchiveEntities.Current.Save(); var typeID = Helper.CreateXElement(Constants.EventType.typeIDElement, "-1"); var typeName2 = Helper.CreateXElement(Constants.EventType.typeName2Element, "Test"); var typeItem = new System.Xml.Linq.XElement(Constants.EventType.typeElement, typeID, typeName2); var eventItem = new System.Xml.Linq.XElement(Constants.Event.eventElement, typeItem); var doc = new System.Xml.Linq.XDocument(eventItem); Bso.Archive.BusObj.EventType typeGroup = Bso.Archive.BusObj.EventType.NewEventType(); typeGroup.UpdateData(doc, "TypeName2", "eventTypeName2"); Assert.IsTrue(testType.TypeName2 == "Test"); BsoArchiveEntities.Current.DeleteObject(testType); BsoArchiveEntities.Current.DeleteObject(typeGroup); BsoArchiveEntities.Current.Save(); }
public void GetTypeFromNodeTest() { var typeID = Helper.CreateXElement(Constants.EventType.typeIDElement, "-1"); var typeName = Helper.CreateXElement(Constants.EventType.typeNameElement, "Test EventType Name"); var typeName2 = Helper.CreateXElement(Constants.EventType.typeName2Element, "Test EventType Name 2"); var typeItem = new System.Xml.Linq.XElement(Constants.EventType.typeElement, typeID, typeName, typeName2); var node = new System.Xml.Linq.XElement(Constants.Event.eventElement, typeItem); Bso.Archive.BusObj.EventType EventType = Bso.Archive.BusObj.EventType.NewEventType(); EventType = Bso.Archive.BusObj.EventType.GetEventTypeFromNode(node); Assert.IsNotNull(EventType); Assert.IsTrue(EventType.TypeID == -1); }
/// <summary> /// Set Data for Type object /// </summary> /// <param name="typeID"></param> /// <param name="type"></param> /// <param name="typeName"></param> /// <param name="typeName2"></param> /// <remarks> /// Takes a Type object along with variables and assigns those variables to /// the Type objects fields. /// </remarks> /// <returns></returns> private static EventType SetEventTypeData(int typeID, EventType type, string typeName, string typeName2) { type.TypeID = typeID; type.TypeName = typeName; type.TypeName2 = typeName2; return type; }
/// <summary> /// Deprecated Method for adding a new object to the EventTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEventTypes(EventType eventType) { base.AddObject("EventTypes", eventType); }
/// <summary> /// Create a new EventType object. /// </summary> /// <param name="typeID">Initial value of the TypeID property.</param> /// <param name="typeName">Initial value of the TypeName property.</param> /// <param name="typeName2">Initial value of the TypeName2 property.</param> /// <param name="typePerformance">Initial value of the TypePerformance property.</param> /// <param name="createdOn">Initial value of the CreatedOn property.</param> /// <param name="modifiedOn">Initial value of the ModifiedOn property.</param> /// <param name="stamp">Initial value of the Stamp property.</param> /// <param name="active">Initial value of the Active property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param> public static EventType CreateEventType(global::System.Int32 typeID, global::System.String typeName, global::System.String typeName2, global::System.Int32 typePerformance, global::System.DateTime createdOn, global::System.DateTime modifiedOn, global::System.Byte[] stamp, global::System.Boolean active, global::System.Int32 createdBy, global::System.Int32 modifiedBy) { EventType eventType = new EventType(); eventType.TypeID = typeID; eventType.TypeName = typeName; eventType.TypeName2 = typeName2; eventType.TypePerformance = typePerformance; eventType.CreatedOn = createdOn; eventType.ModifiedOn = modifiedOn; eventType.Stamp = stamp; eventType.Active = active; eventType.CreatedBy = createdBy; eventType.ModifiedBy = modifiedBy; return eventType; }
public static EventType NewEventType() { EventType newObject = new EventType(); BsoArchiveEntities.Current.AddToEventTypes(newObject); BsoArchiveEntities.SetDefaultValue(newObject); return newObject; }