public List <SimpleWizardRule> GetSimpleWizardRules(string dialplanName, string callDirection) { try { SIPCallDirection callDirn = SIPCallDirection.None; Enum.TryParse <SIPCallDirection>(callDirection, out callDirn); if (callDirn == SIPCallDirection.None) { throw new ApplicationException("The call direction string of " + callDirection + " passed to GetSimpleWizardRules was not recognised."); } using (var ssEntities = new SIPSorceryEntities()) { if (!dialplanName.IsNullOrBlank()) { string callDirnStr = callDirn.ToString(); var rules = (from rule in ssEntities.SimpleWizardRules join dialplan in ssEntities.SIPDialPlans on rule.DialPlanID equals dialplan.ID where rule.Owner == m_owner && dialplan.DialPlanName == dialplanName && rule.Direction == callDirnStr && !rule.IsDisabled orderby rule.Priority select rule).ToList(); logger.Debug("Rules count " + rules.Count + "."); return(rules); } else { throw new ApplicationException("The dialplan name must be specified for GetSimpleWizardRules."); } } } catch (Exception excp) { logger.Error("Exception GetSimpleWizardRules. " + excp.Message); return(null); } }
private void GetRules(int offset, int count, AssetViewPanel panel, SIPCallDirection ruleDirection) { if (!m_routesPanelRefreshInProgress) { m_routesPanelRefreshInProgress = true; m_riaContext.SimpleWizardRules.Clear(); var routesQuery = m_riaContext.GetSimpleWizardRulesQuery().Where(x => x.DialPlanID == m_dialPlan.ID && x.Direction == ruleDirection.ToString()).OrderBy(x => x.Priority).Skip(offset).Take(count); routesQuery.IncludeTotalCount = true; m_riaContext.Load <SimpleWizardRule>(routesQuery, LoadBehavior.RefreshCurrent, RulesLoaded, panel); } }
private void GetRules(int offset, int count, AssetViewPanel panel, SIPCallDirection ruleDirection) { if (!m_routesPanelRefreshInProgress) { m_routesPanelRefreshInProgress = true; m_riaContext.SimpleWizardRules.Clear(); var routesQuery = m_riaContext.GetSimpleWizardRulesQuery().Where(x => x.DialPlanID == m_dialPlan.ID && x.Direction == ruleDirection.ToString()).OrderBy(x => x.Priority).Skip(offset).Take(count); routesQuery.IncludeTotalCount = true; m_riaContext.Load<SimpleWizardRule>(routesQuery, LoadBehavior.RefreshCurrent, RulesLoaded, panel); } }