Esempio n. 1
0
    void Session_Start(object sender, EventArgs e)
    {
        //Code that runs when a new session is started
        DataTable dt = new DataTable();

        dt = Settings.GetSettingsCondition("", "*",
                                           DataExtension.AndConditon(
                                               SettingsTSql.GetSettingsByVskey(SettingsExtension.KeyTotalView),
                                               SettingsTSql.GetSettingsByVslang(TatThanhJsc.LanguageModul.Cookie.GetLanguageValueAdmin())), "");
        if (dt.Rows.Count > 0)
        {
            string[] fields    = { "VSVALUE" };
            string[] values    = { "VSVALUE + 1" };
            string   condition = DataExtension.AndConditon(
                SettingsTSql.GetSettingsByVskey(SettingsExtension.KeyTotalView),
                SettingsTSql.GetSettingsByVslang(TatThanhJsc.LanguageModul.Cookie.GetLanguageValueAdmin()));
            Settings.UpdateSettings(DataExtension.UpdateTransfer(fields, values), condition);
        }
        else
        {
            Settings.InsertSettings(SettingsExtension.KeyTotalView, "", "0", TatThanhJsc.LanguageModul.Cookie.GetLanguageValueAdmin());
        }
    }
    private void SaveConfig(string fullkey, string order, bool status)
    {
        string split = "->";
        string encodekey = SecurityExtension.BuildPassword(fullkey);
        string firstkey = fullkey.Substring(0, fullkey.IndexOf(split));        

        fullkey = order + split + fullkey + split + (status == true ? "1" : "0");

        DataTable dt = new DataTable();
        condition = DataExtension.AndConditon(
            SettingsTSql.GetSettingsByVskey(encodekey),
            SettingsTSql.GetSettingsByVslang(language)
            );
        dt = Settings.GetSettingsCondition("1", "*", condition, "");
        if (dt.Rows.Count < 1)
        {
            Settings.InsertSettings(encodekey, firstkey, fullkey, language);
        }
        else
        {
            Settings.UpdateSettings(SettingsTSql.GetSettingsByVsvalue(fullkey), condition);
        }
    }