Exemple #1
0
        public static ExtensionNumber Load(string number)
        {
            ExtensionNumber        ret  = null;
            List <SelectParameter> pars = new List <SelectParameter>();

            if (number.Contains("@"))
            {
                pars.Add(new EqualParameter("Number", number.Substring(0, number.LastIndexOf('@'))));
                pars.Add(new EqualParameter("Context.Name", number.Substring(number.LastIndexOf('@') + 1)));
            }
            else
            {
                pars.Add(new EqualParameter("Number", number));
                pars.Add(new EqualParameter("Context.Name", Context.Current.Name));
            }
            Connection conn = ConnectionPoolManager.GetConnection(typeof(ExtensionNumber));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(ExtensionNumber), pars.ToArray());

            if (tmp.Count > 0)
            {
                ret = (ExtensionNumber)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }
Exemple #2
0
        public static ExtensionNumber Load(string number, string context)
        {
            ExtensionNumber ret  = null;
            Connection      conn = ConnectionPoolManager.GetConnection(typeof(ExtensionNumber));
            List <Org.Reddragonit.Dbpro.Structure.Table> tmp = conn.Select(typeof(ExtensionNumber), new SelectParameter[] { new EqualParameter("Number", number), new EqualParameter("Context.Name", context) });

            if (tmp.Count > 0)
            {
                ret = (ExtensionNumber)tmp[0];
            }
            conn.CloseConnection();
            return(ret);
        }