Пример #1
0
 public override SpeedDial[] GetSpeedDials(string extension)
 {
     log.Debug("GetSpeedDial from " + extension);
     List<SpeedDial> speeddials = new List<SpeedDial>();
     string sql = "select label, speeddialindex, speeddialnumber from speeddial where fkdevice in (select  pkid from device d where pkid in (select fkdevice from devicenumplanmap where fknumplan in (select pkid from numplan where dnorpattern = '" + extension + "'";
     if (defaultContext != "")
     {
         sql += " and fkroutepartition in (select pkid from routepartition where name = '"+defaultContext+"')";
     }
     sql += ")))";
     ExecuteSQLQueryReq esqr = new ExecuteSQLQueryReq();
     esqr.sql = sql;
     ExecuteSQLQueryRes esqres = _aas.executeSQLQuery(esqr);
     if ([email protected] != null)
     {
         if ([email protected] > 0)
         {
             foreach (XmlNode[] nodes in [email protected])
             {
                 SpeedDial sd = new SpeedDial();
                 sd.displayName = nodes[0].InnerText;
                 sd.directoryNumber = nodes[2].InnerText;
                 sd.position = Convert.ToInt32(nodes[1].InnerText);
                 speeddials.Add(sd);
             }
         }
         else
         {
             log.Debug("No speeddial available for " + extension);
         }
     }
     return speeddials.ToArray();
 }
Пример #2
0
        public static DataSet Search(DirectoryType dir)
        {
            DataSet results = new DataSet();
            DataTable dt = results.Tables.Add();
            CiscoDatasourceType ldt = (CiscoDatasourceType)dir.Item;
            try
            {
                Init(ldt.server, ldt.axluser, ldt.axluserpwd);
                ExecuteSQLQueryReq query = new ExecuteSQLQueryReq();
                query.sql = "select firstname, lastname, telephonenumber, department from enduser";
                ExecuteSQLQueryRes response = _axl.executeSQLQuery(query);
                dt.Columns.Add("firstname");
                dt.Columns.Add("lastname");
                dt.Columns.Add("telephonenumber");
                dt.Columns.Add("department");
                if (response != null && [email protected] != null && [email protected] > 0)
                {

                    foreach (object o in [email protected])
                    {
                        List<object> values = new List<object>();
                        values.Add(((XmlNode[])o)[0].InnerText);
                        values.Add(((XmlNode[])o)[1].InnerText);
                        values.Add(((XmlNode[])o)[2].InnerText);
                        values.Add(((XmlNode[])o)[3].InnerText);
                        dt.Rows.Add(values.ToArray());
                    }
                }
                else
                {
                    log.Error("No result retreive from AXL Server");
                }
                return results;
            }
            catch (Exception e)
            {
                log.Error(e.Message);
                return results;
            }
        }
Пример #3
0
 public override bool IsPrivate(string dn)
 {
     bool isprivate = false;
     if (System.Web.HttpContext.Current.Cache.Get(dn + "_privacy") == null)
     {
         ExecuteSQLQueryReq query = new ExecuteSQLQueryReq();
         query.sql = "select name from dirgroup dg inner join enduserdirgroupmap eudgm";
         query.sql += " on dg.pkid = eudgm.fkdirgroup inner join enduser eu on eu.pkid = ";
         query.sql += "eudgm.fkenduser where eu.pkid in (select distinct eu.pkid from enduser eu";
         query.sql += " inner join endusernumplanmap eunpm on eu.pkid = eunpm.fkenduser ";
         query.sql += "inner join numplan np on np.pkid = eunpm.fknumplan where dnorpattern in ('";
         query.sql += dn + "'))";
         ExecuteSQLQueryRes response = _aas.executeSQLQuery(query);
         if (response != null && [email protected] != null)
         {
             foreach (XmlNode[] nodes in [email protected])
             {
                 if (nodes.Length == 1)
                 {
                     if (System.Web.Configuration.WebConfigurationManager.AppSettings["CiscoPrivacyGroup"] == nodes[0].InnerText)
                     {
                         isprivate = true;
                         break;
                     }
                 }
             }
         }
         else
         {
             log.Error("Unable to retreive group membership from " + dn);
         }
         System.Web.HttpContext.Current.Cache.Add(dn + "_privacy", isprivate, null, DateTime.Now.AddHours(10), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, OnCacheSuppress);
     }
     else
     {
         isprivate = (bool)System.Web.HttpContext.Current.Cache.Get(dn + "_privacy");
     }
     return isprivate;
 }
 private string GetPhoneFromLine(string line)
 {
     string phone = "";
     ExecuteSQLQueryReq sql = new ExecuteSQLQueryReq();
     sql.sql = "select name from device d inner join devicenumplanmap dnpm on dnpm.fkdevice = d.pkid inner join numplan np on np.pkid = dnpm.fknumplan where dnorpattern = '"+line+"' and fkroutepartition in (select pkid from routepartition where name = '"+_sharedLinePartition+"')";
     if (_axl != null)
     {
         ExecuteSQLQueryRes res = _axl.executeSQLQuery(sql);
         if (res != null)
         {
             if ([email protected] > 0)
             {
                 if ([email protected] > 1)
                 {
                     string[] device = new string[[email protected]];
                     int compteur = 0;
                     foreach (object o in [email protected])
                     {
                         XmlNode[] element = (XmlNode[])o;
                         device[compteur] = element[0].InnerText;
                         compteur++;
                     }
                     throw new SharedLineException(line);
                 }
                 else
                 {
                     XmlNode[] element = (XmlNode[])[email protected][0];
                     phone = element[0].InnerText;
                 }
                 return phone;
             }
             else
             {
                 log.Error("Line " + line + " doesn't exist.");
                 throw new Exception("No phone device founded from this line");
             }
         }
         else
         {
             throw new Exception("No result retreived.");
         }
     }
     else
     {
         throw new System.Exception("Impossible d'éxécuter l'ordre sans client AXL");
     }
 }