示例#1
0
文件: CCallLog.cs 项目: whins/SIPComm
        /////////////////////////////////////////////////////////////////////////////////////
        public void addCall(ECallType type, string number, string name, DateTime time, TimeSpan duration)
        {
            int delta = (int)duration.TotalSeconds;

            CCallRecord record = new CCallRecord();
            // todo:::extract name from number
            record.Name = name;
            record.Number = number;
            record.Duration = duration;
            record.Type = type;
            record.Time = time;
            addRecord(record);
        }
示例#2
0
 public void deleteRecord(CCallRecord record)
 {
     this.deleteRecord(record.Number, record.Type);
 }
示例#3
0
 protected void addRecord(CCallRecord record)
 {
     CCallRecord calllogItem = findRecord(record.Number, record.Type);
       if ((null == calllogItem)||(record.Type != calllogItem.Type))
       {
     _callList.Push(record);
       }
       else
       {
     deleteRecord(record);
     record.Count = calllogItem.Count + 1;
     _callList.Push(record);
       }
 }
示例#4
0
        public void load(string fileName)
        {
            XmlDocument xmlDocument = new XmlDocument();
              try
              {
            xmlDocument.Load(fileName);
              }
              catch (System.IO.FileNotFoundException ee)
              {
            System.Console.WriteLine(ee.Message);

            XmlNode root = xmlDocument.CreateNode("element", "Calllog", "");
            xmlDocument.AppendChild(root);

              }
              catch (System.Xml.XmlException e) { System.Console.WriteLine(e.Message); }

              XmlNodeList list = xmlDocument.SelectNodes("/Calllog/Record");

              // create list
              _callList = new Stack<CCallRecord>();
              foreach (XmlNode item in list)
              {
            CCallRecord record = new CCallRecord();

            XmlNode snode = item.SelectSingleNode(NAME);
            if ((snode != null) && (null != snode.FirstChild) &&(snode.FirstChild.Value != null)) record.Name = snode.FirstChild.Value;

            snode = item.SelectSingleNode(NUMBER);
            if ((snode != null) && (null != snode.FirstChild) && (snode.FirstChild.Value != null))
            {
              record.Number = snode.FirstChild.Value;
            }
            else
            {
              continue;
            }

            snode = item.SelectSingleNode(DATETIME);
            if ((snode != null) && (null!= snode.FirstChild) && (snode.FirstChild.Value != null)) record.Time = DateTime.Parse(snode.FirstChild.Value);

            snode = item.SelectSingleNode(DURATION);
            if ((snode != null) && (null != snode.FirstChild) && (snode.FirstChild.Value != null)) record.Duration = TimeSpan.Parse(snode.FirstChild.Value);

            snode = item.SelectSingleNode(COUNT);
            if ((snode != null) && (null != snode.FirstChild) && (snode.FirstChild.Value != null)) record.Count = int.Parse(snode.FirstChild.Value);

            snode = item.SelectSingleNode(TYPE);
            if ((snode != null) && (null != snode.FirstChild) && (snode.FirstChild.Value != null)) record.Type = (ECallType)int.Parse(snode.FirstChild.Value);

            _callList.Push(record);
              }
        }
示例#5
0
 public void deleteRecord(CCallRecord record) { }
 public void deleteRecord(CCallRecord record)
 {
 }