static public void SetSetting(string SettingName, string value, int portalId)
    {
        StaffBrokerDataContext d = new StaffBrokerDataContext();

        var q = from c in d.AP_StaffBroker_Settings where c.SettingName == SettingName && c.PortalId == portalId select c;

        if (q.Count() == 0)
        {
            AP_StaffBroker_Setting insert = new AP_StaffBroker_Setting();
            insert.SettingName  = SettingName;
            insert.SettingValue = value;
            insert.PortalId     = portalId;
            d.AP_StaffBroker_Settings.InsertOnSubmit(insert);
        }
        else
        {
            q.First().SettingValue = value;
        }

        d.SubmitChanges();
    }
    public static void SetSetting(string SettingName, string value, int portalId)
    {
        StaffBrokerDataContext d = new StaffBrokerDataContext();

        var q = from c in d.AP_StaffBroker_Settings where c.SettingName == SettingName && c.PortalId == portalId select c;

        if (q.Count() == 0)
        {
            AP_StaffBroker_Setting insert = new AP_StaffBroker_Setting();
            insert.SettingName = SettingName;
            insert.SettingValue = value;
            insert.PortalId = portalId;
            d.AP_StaffBroker_Settings.InsertOnSubmit(insert);

        }
        else
        {
            q.First().SettingValue = value;
        }

        d.SubmitChanges();
    }