Using Gentle.Config (DefaultConnectionString) and how to save and load settings? (1 Viewer)

MoPhat

Retired Team Member
  • Premium Supporter
  • June 17, 2007
    816
    226
    Berg
    Home Country
    Switzerland Switzerland
    Hi iam developing a new Plugin for he TV Server witch checks the next upcomings shedules and if the start time in the EPG has changed will change the schedule time too :D

    Here in switzerland/germany channels is normal that the show is not coming on the same time everyday :( , in this case the recording lands in the manuall folder :mad:

    So the plugin works well in a testform, i'm now on the final steps.

    But:

    - How to i'am using the Gentle.Config to receive the SQL Connection String?
    - How do i'am load/save settings from the plugin?
    Code:
    is this correct so?
    
       public void SettingsLoad()
            {
                TvBusinessLayer layer = new TvBusinessLayer();
                txtPreTime.Text = layer.GetSetting("Schedules_Corrector_PreTime", "-20").Value;
                txtAfterTime.Text = layer.GetSetting("Schedules_Corrector_AfterTime", "20").Value;
                txtIntervall.Text = layer.GetSetting("Schedules_Corrector_Intervall", "60").Value;
            }
    
            public void SettingsSave()
            {
                TvBusinessLayer layer = new TvBusinessLayer();
                Setting setting = layer.GetSetting("Schedules_Corrector_PreTime", "-20");
                setting.Value = txtPreTime.Text;
                setting.Persist();
    
                setting = layer.GetSetting("Schedules_Corrector_AfterTime", "20");
                setting.Value = txtAfterTime.Text;
                setting.Persist();
    
                setting = layer.GetSetting("Schedules_Corrector_Intervall", "60");
                setting.Value = txtIntervall.Text;
                setting.Persist();
            }

    - how do i'am commit a schedule change to the TVServer?

    thank you for the help, for me (my wife) is this plugin essantially... maybe for you too?

    :D

    MoPhat
     

    rtv

    Retired Team Member
  • Premium Supporter
  • April 7, 2005
    3,622
    301
    Osnabruck
    Home Country
    Germany Germany
    - How to i'am using the Gentle.Config to receive the SQL Connection String?
    Please try not to handle SQL connections in your plugin. You'd have to reference all gentle libs as well as the database providers, etc. In addition there are ongoing changes like relocating the gentle.config, etc. Your plugin would have to be maintained with all these changes as well then. Try to use the businesslayer for everything you need.

    - How do i'am load/save settings from the plugin?
    is this correct so?
    ...
    public void SettingsLoad()
    ...
    Yep. This should work okay.

    - how do i'am commit a schedule change to the TVServer?
    Broce and Bavarian will be the people who know best. Technically it's the same as above. Simply persist your changed Schedule object.
     

    MoPhat

    Retired Team Member
  • Premium Supporter
  • June 17, 2007
    816
    226
    Berg
    Home Country
    Switzerland Switzerland
    thank you rtv how do im use the businesslayer to get the connection string, is there a connection class?

    :D
    MoPhat
     

    Users who are viewing this thread

    Top Bottom