Ejemplo n.º 1
0
        public static void DefineOrUpdateProperty(scene_property p)
        {
            if (p != null)
            {
                using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
                {
                    scene_property existing_property = db.scene_property.FirstOrDefault(ep => ep.name == p.name);

                    if (existing_property == null)
                    {
                        db.scene_property.AddObject(p);
                    }
                    else
                    {
                        //Update
                        existing_property.friendly_name = p.friendly_name;
                        existing_property.description = p.description;
                        existing_property.value_data_type = p.value_data_type;
                        existing_property.defualt_value = p.defualt_value;

                        foreach (var option in db.scene_property_option.Where(o => o.scene_property_id == existing_property.id).ToArray())
                        {
                            db.DeleteObject(option);
                        }

                        foreach (scene_property_option spo in p.scene_property_option)
                            existing_property.scene_property_option.Add(new scene_property_option { option = spo.option });

                    }
                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            scene_property hotkeypropert = new scene_property
            {
                name = "GLOBALHOTKEY",
                friendly_name = "Global Hotkey",
                description = "Hotkey that will activate this scene.",
                defualt_value = "None",
                value_data_type = (int)Data_Types.LIST
            };

            foreach (string option in Enum.GetNames(typeof(CustomHotKeys)))
            {
                hotkeypropert.scene_property_option.Add(new scene_property_option { option = option.Replace('_', '+') });
            }

            scene_property.DefineOrUpdateProperty(hotkeypropert);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the scene_property EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToscene_property(scene_property scene_property)
 {
     base.AddObject("scene_property", scene_property);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new scene_property object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="friendly_name">Initial value of the friendly_name property.</param>
 /// <param name="defualt_value">Initial value of the defualt_value property.</param>
 /// <param name="value_data_type">Initial value of the value_data_type property.</param>
 public static scene_property Createscene_property(global::System.Int64 id, global::System.String friendly_name, global::System.String defualt_value, global::System.Int64 value_data_type)
 {
     scene_property scene_property = new scene_property();
     scene_property.id = id;
     scene_property.friendly_name = friendly_name;
     scene_property.defualt_value = defualt_value;
     scene_property.value_data_type = value_data_type;
     return scene_property;
 }