Exemple #1
0
 private static void SaveToDB(CSource.CMobilePhone phone_,
                              List <Contact> contacts_, List <Call> calls_, List <Sms> sms_)
 {
     using (DataStore ds = new DataStore())
     {
         DeviceInfo devInfo = new DeviceInfo();
         devInfo.Label = phone_.Label;
         Device dev1 = ds.createDevice(phone_.UniqueIdentifier, "phone", devInfo);
         if (contacts_ != null)
         {
             foreach (var c in contacts_)
             {
                 var contact = dev1.createContact(c.Name, 0);
                 contact.addTextProp(257, c.Number);
             }
         }
         if (calls_ != null)
         {
             foreach (var c in calls_)
             {
                 dev1.addCall(c.Number, c.Duration, c.Status, c.StartTime, c.StopTime, (int)c.Type);
             }
         }
         if (sms_ != null)
         {
             foreach (var s in sms_)
             {
                 dev1.addSMS((int)s.SendReceive, s.SMSInfo);
             }
         }
         ds.commit();
     }
 }
Exemple #2
0
 private static void SaveToDB(CSource source_, string rootFolder_)
 {
     using (DataStore ds = new DataStore())
     {
         DeviceInfo devInfo = new DeviceInfo();
         devInfo.Label = source_.Label;
         Device dev1 = ds.createDevice(source_.UniqueIdentifier, "simcard", devInfo);
         if (rootFolder_ != null)
         {
             dDevFileSystem devFS = dev1.createDevFileSystem(rootFolder_);
             ds.commit();
         }
     }
 }
Exemple #3
0
        public dDevice createDevice(String uid, String type, dDeviceInfo devInfo = null, dDevice parent = null)
        {
            if (m_db == null)
            {
                return(null);
            }
            // add device entity only if it is a new one
            mbs_deviceset devEnt = m_db.mbs_deviceset.Find(uid);

            if (devEnt == null)
            {
                devEnt = new mbs_deviceset {
                    UID = uid, Type = type
                };
                if (devInfo != null)
                {
                    devEnt.Label        = devInfo.Label;
                    devEnt.Manufacturer = devInfo.Manufacturer;
                    devEnt.Product      = devInfo.Product;
                    devEnt.ESN          = devInfo.ESN;
                    devEnt.Lac          = devInfo.Lac;
                    devEnt.Cid          = devInfo.Cid;
                    devEnt.HWRevision   = devInfo.HWRevision;
                    devEnt.IMEI         = devInfo.IMEI;
                    devEnt.Phone        = devInfo.Phone;
                    devEnt.Platform     = devInfo.Platform;
                    devEnt.ReturnedIMEI = devInfo.ReturnedIMEI;
                    devEnt.SWRevision   = devInfo.SWRevision;
                    devEnt.IMSI         = devInfo.IMSI;
                    devEnt.ICCID        = devInfo.ICCID;
                    devEnt.LAI          = devInfo.LAI;
                    devEnt.Phrase       = devInfo.Phrase;
                }
                m_db.mbs_deviceset.Add(devEnt);
            }

            // add session entity
            mbs_sessionset sessionEnt = new mbs_sessionset {
                MBS_DeviceUID = uid,
                Timestamp     = DateTime.Now
            };

            if (devInfo != null)
            {
                sessionEnt.Description = devInfo.Description;
                sessionEnt.OwnerID     = devInfo.OwnerID;
                sessionEnt.OwnerName   = devInfo.OwnerName;
            }

            if (parent != null)
            {
                sessionEnt.ParentSessionId = parent.m_session;
            }
            m_db.mbs_sessionset.Add(sessionEnt);

            m_db.SaveChanges();

            return(new dDevice(m_db, sessionEnt.Id));
        }