internal static void SetSettingValue(SipProfileSettingTypes type, string value, SipProfile profile) { Connection conn = ConnectionPoolManager.GetConnection(typeof(SipProfileSetting)); if (GetSettingValue(type, profile) != null) { Dictionary <string, object> fields = new Dictionary <string, object>(); fields.Add("Value", value); conn.Update(typeof(SipProfileSetting), fields, new SelectParameter[] { new EqualParameter("Profile", profile), new EqualParameter("SettingType", type) }); } else { SipProfileSetting sps = new SipProfileSetting(); sps.Profile = profile; sps.SettingType = type; sps.Value = value; conn.Save(sps); } conn.CloseConnection(); }
internal static string GetSettingValue(SipProfileSettingTypes type, SipProfile profile) { string ret = null; ClassQuery cq = new ClassQuery("Org.Reddragonit.FreeSwitchConfig.DataCore.DB.Core", "Select sps.Value from SipProfileSetting sps WHERE sps.Profile.Name = @profileName AND sps.SettingType = @type"); IDbDataParameter[] pars = new IDbDataParameter[]{ cq.CreateParameter("@profileName",profile.Name), cq.CreateParameter("@type",type) }; cq.Execute(pars); if (cq.Read()) ret = cq.GetString(0); cq.Close(); return ret; }
internal static string GetSettingValue(SipProfileSettingTypes type, SipProfile profile) { string ret = null; ClassQuery cq = new ClassQuery("Org.Reddragonit.FreeSwitchConfig.DataCore.DB.Core", "Select sps.Value from SipProfileSetting sps WHERE sps.Profile.Name = @profileName AND sps.SettingType = @type"); IDbDataParameter[] pars = new IDbDataParameter[] { cq.CreateParameter("@profileName", profile.Name), cq.CreateParameter("@type", type) }; cq.Execute(pars); if (cq.Read()) { ret = cq.GetString(0); } cq.Close(); return(ret); }
internal static void SetSettingValue(SipProfileSettingTypes type, string value, SipProfile profile) { Connection conn = ConnectionPoolManager.GetConnection(typeof(SipProfileSetting)); if (GetSettingValue(type, profile) != null) { Dictionary<string, object> fields = new Dictionary<string, object>(); fields.Add("Value", value); conn.Update(typeof(SipProfileSetting), fields, new SelectParameter[]{ new EqualParameter("Profile",profile), new EqualParameter("SettingType",type) }); } else { SipProfileSetting sps = new SipProfileSetting(); sps.Profile = profile; sps.SettingType = type; sps.Value = value; conn.Save(sps); } conn.CloseConnection(); }
public string this[SipProfileSettingTypes type] { get { return(SipProfileSetting.GetSettingValue(type, this)); } set { SipProfileSetting.SetSettingValue(type, value, this); } }
public string this[SipProfileSettingTypes type] { get { return SipProfileSetting.GetSettingValue(type, this); } set { SipProfileSetting.SetSettingValue(type, value, this); } }