示例#1
0
 public LineStatus[] LengthyGetLinesStatus(LineStatus[] lines)
 {
     LineStatus[] currentLines = new LineStatus[lines.Length];
     try
     {
         if (Global.cacheMgr != null)
         {
             GetCurrentLines(lines, ref currentLines);
             int compteur = 0;
             while (Compare(currentLines, lines) && compteur <= int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerTimeOut")))
             {
                 Thread.Sleep(int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerSleepTime")));
                 GetCurrentLines(lines, ref currentLines);
                 compteur++;
             }
         }
         else
         {
             log.Debug("Cache Manager is null");
         }
         return currentLines;
     }
     catch (Exception e)
     {
         log.Error("Error while getting lines status: " + e.Message);
         return currentLines;
     }
 }
示例#2
0
 public LineStatus[] LengthyGetLinesStatus(LineStatus[] lines)
 {
     LineStatus[] currentLines = new LineStatus[lines.Length];
     try
     {
         if (Global.cacheMgr != null)
         {
             GetCurrentLines(lines, ref currentLines);
             int compteur = 0;
             while (Compare(currentLines, lines) && compteur <= int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerTimeOut")))
             {
                 Thread.Sleep(int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerSleepTime")));
                 GetCurrentLines(lines, ref currentLines);
                 compteur++;
             }
         }
         else
         {
             log.Debug("Cache Manager is null");
         }
         return(currentLines);
     }
     catch (Exception e)
     {
         log.Error("Error while getting lines status: " + e.Message);
         return(currentLines);
     }
 }
示例#3
0
        public override bool Equals(object obj)
        {
            bool b = false;

            try
            {
                if (obj != null)
                {
                    if (obj is LineStatus)
                    {
                        LineStatus lc = obj as LineStatus;
                        if (lc.directoryNumber == this.directoryNumber && lc.status == this.status && lc.doNotDisturb == this.doNotDisturb && lc.forward == this.forward && lc.mwiOn == this.mwiOn && lc.monitored == this.monitored)
                        {
                            b = true;
                        }
                    }
                    else
                    {
                        throw new Exception("Can't evaluate this object " + this._directoryNumber + ", " + obj.ToString());
                    }
                }
                return(b);
            }
            catch
            {
                return(b);
            }
        }
示例#4
0
        private void GetCurrentLines(LineStatus[] reference, ref LineStatus[] currentLines)
        {
            int currentLineCompteur = 0;

            foreach (LineStatus ls in reference)
            {
                LineStatus newLine   = new LineStatus();
                LineStatus cacheLine = null;
                if (ls.directoryNumber != "" && Global.cacheMgr.Contains(ls.directoryNumber))
                {
                    cacheLine = Global.cacheMgr.GetData(ls.directoryNumber) as LineStatus;
                }
                newLine.directoryNumber = ls.directoryNumber;
                if (cacheLine == null)
                {
                    newLine.status       = Status.unknown;
                    newLine.doNotDisturb = false;
                    newLine.forward      = "";
                    newLine.mwiOn        = false;
                    newLine.monitored    = "";
                }
                else
                {
                    if (PrivacyService.IsPrivate(cacheLine.directoryNumber))
                    {
                        newLine.status = Status.hidden;
                    }
                    else
                    {
                        newLine.status = cacheLine.status;
                    }
                    newLine.doNotDisturb = cacheLine.doNotDisturb;
                    newLine.forward      = cacheLine.forward;
                    newLine.mwiOn        = cacheLine.mwiOn;
                    newLine.monitored    = cacheLine.monitored;
                }
                currentLines[currentLineCompteur] = newLine;
                currentLineCompteur++;
            }
        }
示例#5
0
 private bool Compare(LineStatus[] currentLine, LineStatus[] cacheLine)
 {
     bool result = true;
     for (int i = 0; i < currentLine.Length; i++)
     {
         if (!currentLine[i].Equals(cacheLine[i]))
         {
             result = false;
             break;
         }
     }
     return result;
 }
示例#6
0
 private void GetCurrentLines(LineStatus[] reference, ref LineStatus[] currentLines)
 {
     int currentLineCompteur = 0;
     foreach (LineStatus ls in reference)
     {
         LineStatus newLine = new LineStatus();
         LineStatus cacheLine = null;
         if (ls.directoryNumber != "" && Global.cacheMgr.Contains(ls.directoryNumber))
         {
             cacheLine = Global.cacheMgr.GetData(ls.directoryNumber) as LineStatus;
         }
         newLine.directoryNumber = ls.directoryNumber;
         if (cacheLine == null)
         {
             newLine.status = Status.unknown;
             newLine.doNotDisturb = false;
             newLine.forward = "";
             newLine.mwiOn = false;
             newLine.monitored = "";
         }
         else
         {
             if (PrivacyService.IsPrivate(cacheLine.directoryNumber))
             {
                 newLine.status = Status.hidden;
             }
             else
             {
                 newLine.status = cacheLine.status;
             }
             newLine.doNotDisturb = cacheLine.doNotDisturb;
             newLine.forward = cacheLine.forward;
             newLine.mwiOn = cacheLine.mwiOn;
             newLine.monitored = cacheLine.monitored;
         }
         currentLines[currentLineCompteur] = newLine;
         currentLineCompteur++;
     }
 }
示例#7
0
 public IAsyncResult BeginGetLinesStatus(LineStatus[] lines, AsyncCallback cb, object s)
 {
     LengthyGetLinesStatusAsyncStub stub = new LengthyGetLinesStatusAsyncStub(LengthyGetLinesStatus);
     GetLinesStatusState glss = new GetLinesStatusState();
     glss.previousstate = s;
     glss.stub = stub;
     return stub.BeginInvoke(lines, cb, glss);
 }