/// <summary> /// Create a new property object. /// </summary> /// <param name="property_id">Initial value of the property_id property.</param> /// <param name="property_name">Initial value of the property_name property.</param> /// <param name="tag_name">Initial value of the tag_name property.</param> /// <param name="last_update_date">Initial value of the last_update_date property.</param> /// <param name="property_definition_id">Initial value of the property_definition_id property.</param> /// <param name="collection_source_id">Initial value of the collection_source_id property.</param> /// <param name="equipment_id">Initial value of the equipment_id property.</param> /// <param name="property_storage_group_id">Initial value of the property_storage_group_id property.</param> public static property Createproperty(global::System.Decimal property_id, global::System.String property_name, global::System.String tag_name, global::System.DateTime last_update_date, global::System.Decimal property_definition_id, global::System.Decimal collection_source_id, global::System.Decimal equipment_id, global::System.Decimal property_storage_group_id) { property property = new property(); property.property_id = property_id; property.property_name = property_name; property.tag_name = tag_name; property.last_update_date = last_update_date; property.property_definition_id = property_definition_id; property.collection_source_id = collection_source_id; property.equipment_id = equipment_id; property.property_storage_group_id = property_storage_group_id; return property; }
/// <summary> /// Deprecated Method for adding a new object to the properties EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToproperties(property property) { base.AddObject("properties", property); }
private void WriteToDB() { string connectionStringForChroniclerEntities = ConfigurationManager.ConnectionStrings["ChroniclerEntities"].ConnectionString; connectionStringForChroniclerEntities = string.Format(connectionStringForChroniclerEntities, Settings.DataBase.ConnectionString); using (ChroniclerEntities chroniclerEntities = new ChroniclerEntities(connectionStringForChroniclerEntities)) { foreach (Group group in Settings.Groups) { property_collection_source propertyCollection = new property_collection_source() { source_refresh_interval = group.RefreshInterval, source_description = group.Description, source_group_name = group.GroupName, source_is_active = group.IsActive ? 1 : 0, source_server_id = group.OpcServer.URL }; foreach (var prop in group.Properties) { property newProperty = new property() { property_name = prop.Name, tag_name = prop.TagName, last_update_date = DateTime.Now, property_definition_id = 0, property_storage_group_id = 0 }; propertyCollection.properties.Add(newProperty); } chroniclerEntities.AddObject("ChroniclerEntities." + typeof(property_collection_source).Name, propertyCollection); } chroniclerEntities.SaveChanges(); } }