public static SipProfile Load(string name) { SipProfile ret = null; Connection conn = ConnectionPoolManager.GetConnection(typeof(SipProfile)); List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(SipProfile), new SelectParameter[] { new EqualParameter("Name", name) }); if (tmp.Count > 0) { ret = (SipProfile)tmp[0]; } conn.CloseConnection(); 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 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(); }
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 sDeployedProfile(SipProfile profile) { _name = profile.Name; _contextName = profile.Context.Name; _settings = new List<NameValuePair>(); ClassQuery cq = new ClassQuery("Org.Reddragonit.FreeSwitchConfig.DataCore.DB.Core", "Select sps.SettingType,sps.Value from SipProfileSetting sps WHERE sps.Profile.Name = @profileName"); IDbDataParameter[] pars = new IDbDataParameter[]{ cq.CreateParameter("@profileName",profile.Name) }; cq.Execute(pars); while (cq.Read()) _settings.Add(new NameValuePair(cq[0].ToString(), cq[1].ToString())); cq.Close(); }
public static void RegenerateSIPProfile(SipProfile profile) { sDeployedProfile prof = new sDeployedProfile(profile); Lock(); List<sDeployedProfile> profs = profiles; bool add = true; for (int x = 0; x < profs.Count; x++) { if (profs[x].Name == prof.Name) { profs[x] = prof; add = false; break; } } if (add) profs.Add(prof); profiles = profs; UnLock(); _deployer.DeploySipProfile(prof); EventController.TriggerEvent(new SipProfileDeploymentEvent(prof)); }