示例#1
0
 /// <summary>
 /// Create a new property_collection_source object.
 /// </summary>
 /// <param name="collection_source_id">Initial value of the collection_source_id property.</param>
 /// <param name="source_refresh_interval">Initial value of the source_refresh_interval property.</param>
 public static property_collection_source Createproperty_collection_source(global::System.Decimal collection_source_id, global::System.Decimal source_refresh_interval)
 {
     property_collection_source property_collection_source = new property_collection_source();
     property_collection_source.collection_source_id = collection_source_id;
     property_collection_source.source_refresh_interval = source_refresh_interval;
     return property_collection_source;
 }
示例#2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the property_collection_source EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToproperty_collection_source(property_collection_source property_collection_source)
 {
     base.AddObject("property_collection_source", property_collection_source);
 }
示例#3
0
        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();
            }
        }