コード例 #1
0
		// Token: 0x06000B95 RID: 2965 RVA: 0x0003E88A File Offset: 0x0003CA8A
		internal static bool GetDeviceStatus(OrganizationId orgId, MobileDevice device, string externalUserObjectId, out bool isManaged, out bool isCompliant)
		{
			if (device == null)
			{
				isManaged = true;
				isCompliant = true;
				return true;
			}
			isManaged = device.IsManaged;
			isCompliant = device.IsCompliant;
			return !device.IsDisabled;
		}
コード例 #2
0
        public IHttpActionResult PostMobileDevice(MobileDevice mobileDevice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MobileDevices.Add(mobileDevice);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = mobileDevice.MobileDeviceId }, mobileDevice));
        }
コード例 #3
0
 private kAMDError StopSession()
 {
     this.isSessionOpen = false;
     try
     {
         return((kAMDError)MobileDevice.AMDeviceStopSession(this.DevicePtr));
     }
     catch
     {
         return(kAMDError.kAMDUndefinedError);
     }
 }
コード例 #4
0
        public override void Import(DirectoryInfo xmlFilePath)
        {
            using (var fileStream = new FileStream(xmlFilePath.FullName, FileMode.Open))
            {
                var shop          = (XmlModels.Shop) this.XmlSerializer.Deserialize(fileStream);
                var mobileDevices = shop.MobileDevices.ToList();

                var batteriesToInsert     = new List <Battery>(mobileDevices.Count);
                var displaysToInsert      = new List <Display>(mobileDevices.Count);
                var processorsToInsert    = new List <Processor>(mobileDevices.Count);
                var mobileDevicesToInsert = new List <MobileDevice>(mobileDevices.Count);

                foreach (var mobileDevice in mobileDevices)
                {
                    Battery battery = this.mobileDeviceFactory.CreateBattery(
                        mobileDevice.Battery.Type,
                        mobileDevice.Battery.Capacity);
                    batteriesToInsert.Add(battery);

                    Display display = this.mobileDeviceFactory.CreateDisplay(
                        mobileDevice.Display.Type,
                        mobileDevice.Display.Size,
                        mobileDevice.Display.Resolution);
                    displaysToInsert.Add(display);

                    Processor processor = this.mobileDeviceFactory.CreateProcessor(
                        mobileDevice.Processor.CacheMemory,
                        mobileDevice.Processor.ClockSpeed);
                    processorsToInsert.Add(processor);

                    MobileDevice mobileDeviceToInsert = this.mobileDeviceFactory.CreateMobileDevice(
                        mobileDevice.Brand,
                        mobileDevice.Model,
                        display,
                        battery,
                        processor);
                    mobileDevicesToInsert.Add(mobileDeviceToInsert);
                }

                this.InsertCollectionIntoMongoAsync <Battery>(batteriesToInsert, "batteries");
                this.InsertCollectionIntoMongoAsync <Display>(displaysToInsert, "displays");
                this.InsertCollectionIntoMongoAsync <Processor>(processorsToInsert, "processors");
                this.InsertCollectionIntoMongoAsync <MobileDevice>(mobileDevicesToInsert, "mobileDevices");

                this.SqlServerDatabase.Context.Batteries.AddRange(batteriesToInsert);
                this.SqlServerDatabase.Context.Displays.AddRange(displaysToInsert);
                this.SqlServerDatabase.Context.Processors.AddRange(processorsToInsert);
                this.SqlServerDatabase.Context.MobileDevices.AddRange(mobileDevicesToInsert);

                this.SqlServerDatabase.SaveChanges();
            }
        }
コード例 #5
0
ファイル: Tracker.cs プロジェクト: valuecreation/RoutePlanner
        /// <summary>
        /// Get tracking device for route.
        /// </summary>
        /// <param name="devices">List with all tracking devices.</param>
        /// <param name="route">Route which device should be found.</param>
        /// <returns>Route tracking device or null if route has no device.</returns>
        private TrackingDevice _GetTrackingDevice(IEnumerable <TrackingDevice> devices, Route route)
        {
            // Check if route has associated device.
            MobileDevice device = TrackingHelper.GetDeviceByRoute(route);

            if (device == null)
            {
                return(null);
            }

            // Return device.
            return(_FindDevice(devices, device));
        }
コード例 #6
0
        public virtual MobileDevice MobileDeviceFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            MobileDevice entity = new MobileDevice();

            entity.MobileDeviceId = (System.Int32)dr["MobileDeviceID"];
            entity.UserAgent      = dr["UserAgent"].ToString();
            entity.Name           = dr["Name"].ToString();
            return(entity);
        }
コード例 #7
0
        public IActionResult PostMobileDevice([FromBody] MobileDevice mobileDevice)
        {
            mobileDevice.BeneficiaryId = Guid.NewGuid();

            if (!MobileDeviceValidations.MobileDeviceIsValid(mobileDevice))
            {
                return(Forbid());
            }

            _mobileDeviceRepository.Add(mobileDevice);

            return(Ok(mobileDevice));
        }
コード例 #8
0
        public static Customer CreateCustomer(Registration registration)
        {
            var timeCreated  = DateTime.Now;
            var mobileDevice = new MobileDevice()
            {
                DeviceId        = registration.DeviceId,
                LineNumber      = registration.PhoneNumber,
                NetworkOperator = registration.OperatorDeviceSim,
                SimCountryIso   = string.Empty,
                SimOperator     = registration.OperatorDeviceSim,
                SimSerialNumber = registration.SimSerialNumber,
                SubscriberId    = registration.SimSubscriberId
            };
            var person = new Person()
            {
                DateOfBirth = registration.Dob,
                DateCreated = timeCreated,
                Firstname   = registration.FirstName,
                Lastname    = registration.LastName,
            };

            PasswordHasher.GetNewPassword(registration.Pwd, false);
            var pwd           = PasswordHasher.HashPassword(registration.Pwd);
            var customerLogin = new CustomerLogin()
            {
                EmailAddress         = registration.Email,
                LoginStatusCode      = "Enabled",
                EmailAddressVerified = false,
                Number  = registration.PhoneNumber,
                Pwd     = pwd.Item1,
                PwdSalt = pwd.Item2,
            };

            List <MobileDevice> mobiles = new List <MobileDevice>();

            mobiles.Add(mobileDevice);

            var customer = new Customer()
            {
                Balance          = 0,
                CurrencyCode     = "XAF",
                CustomerTypeCode = "Standard",
                DateCreated      = timeCreated,
                MobileDevices    = new System.Collections.ObjectModel.ObservableCollection <MobileDevice>(mobiles),
                Person           = person,
                IdRegistration   = registration.IdRegistration,
                CustomerLogin    = customerLogin,
            };

            return(customer);
        }
コード例 #9
0
        // GET: MobileDevice/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MobileDevice mobileDevice = db.MobileDevices.Find(id);

            if (mobileDevice == null)
            {
                return(HttpNotFound());
            }
            return(View(mobileDevice));
        }
コード例 #10
0
        public static bool SameMobileIds(this MobileDevice myMobile, LoginAttempt loginAttempt)
        {
            if (myMobile == null | loginAttempt == null)
            {
                return(false);
            }
            var result = myMobile.DeviceId == loginAttempt.DeviceId &&
                         myMobile.LineNumber == loginAttempt.Number &&
                         myMobile.SimOperator == loginAttempt.SimOperator &&
                         myMobile.SimSerialNumber == loginAttempt.SimSerialNumber &&
                         myMobile.SubscriberId == loginAttempt.SubscriberId;

            return(true); // A modifier
        }
コード例 #11
0
        /// <summary>
        /// Verifies if Mobile Device is valid
        /// </summary>
        /// <param name="mobileDevice">Mobile Device to be verified</param>
        /// <returns>If Mobile Device is valid</returns>
        public static bool MobileDeviceIsValid(MobileDevice mobileDevice)
        {
            if (!ValidationsHelper.DateIsValid(mobileDevice.MobileDeviceManufactoringYear))
            {
                return(false);
            }

            if (mobileDevice.MobileDeviceInvoiceValue <= 0)
            {
                return(false);
            }

            return(true);
        }
コード例 #12
0
        public string RegisterDevice(int cid, string rid, string mdos, string did)
        {
            bool isNewEntity = false;

            try
            {
                if (String.Equals(rid.Trim(), "") || String.Equals(mdos.Trim(), "") || cid <= 0)
                {
                    throw new Exception("Required parameters are invalid!");
                }

                if (!_validDevices.Contains(mdos))
                {
                    throw new Exception("You're pushing a message for an invalid mobile device OS! Valid OS are: ios, android, wp and wsa.");
                }

                // decode the registration channel
                if (mdos.Equals("wp") || mdos.Equals("wsa"))
                {
                    rid = Helpers.DecodeBase64NTimes(rid, 1);
                }

                MobileDevice mobileDevice = DatabaseContext.MobileDevice.FirstOrDefault(x => x.ClientID == cid && x.DeviceID.Equals(did));

                isNewEntity  = mobileDevice == null;
                mobileDevice = mobileDevice ?? new MobileDevice();

                mobileDevice.ModifiedAt = DateTime.Now;
                mobileDevice.PushNotificationsRegistrationID = rid;
                mobileDevice.Active = true;

                if (isNewEntity)
                {
                    mobileDevice.ClientID           = cid;
                    mobileDevice.DeviceID           = did;
                    mobileDevice.CreatedAt          = DateTime.Now;
                    mobileDevice.SmartphonePlatform = mdos;
                    DatabaseContext.MobileDevice.Add(mobileDevice);
                }

                DatabaseContext.SaveChanges();
                DatabaseContext.Dispose();

                return(String.Format("Device {0} successfully at: {1}, MobileDeviceID: {2}", isNewEntity ? "registered" : "updated", DateTime.Now.ToString(), mobileDevice.ID));
            }
            catch (Exception ex)
            {
                return(String.Format("SERVER ERROR! Details: {0} Time: {1}", ex.Message, DateTime.Now.ToString()));
            }
        }
コード例 #13
0
        /// <summary>
        /// Occurs when user changes any property in mobile device
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void device_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            // if any property except "SyncType" was changed - return
            if (e.PropertyName != MobileDevice.PropertyNameSyncType)
            {
                return;
            }

            DataRow row = null; // edited row

            if (_InsertionRow.IsBeingEdited)
            {
                row = _InsertionRow; // if insertion row is in editing - use insertion row as current row
            }
            else
            {
                row = XceedGrid.GetContainerFromItem(XceedGrid.CurrentItem) as DataRow; // otherwise - get current row by current item
            }
            Debug.Assert(row != null);

            MobileDevice device = (MobileDevice)sender; // edited mobile device

            Debug.Assert(device != null);

            // update value in field corresponding to sync type for show validation
            switch (device.SyncType)
            {
            case SyncType.None:
                break;

            case SyncType.EMail:
                device.EmailAddress = (string)row.Cells[MobileDevice.PropertyNameEmailAddress].Content;
                break;

            case SyncType.ActiveSync:
                device.ActiveSyncProfileName = (string)row.Cells[MobileDevice.PropertyNameActiveSyncProfileName].Content;
                break;

            case SyncType.Folder:
                device.SyncFolder = (string)row.Cells[MobileDevice.PropertyNameSyncFolder].Content;
                break;

            case SyncType.WMServer:
                device.TrackingId = (string)row.Cells[MobileDevice.PropertyNameName].Content;
                break;

            default:
                break;
            }
        }
コード例 #14
0
        public IHttpActionResult DeleteMobileDevice(int id)
        {
            MobileDevice mobileDevice = db.MobileDevices.Find(id);

            if (mobileDevice == null)
            {
                return(NotFound());
            }

            db.MobileDevices.Remove(mobileDevice);
            db.SaveChanges();

            return(Ok(mobileDevice));
        }
コード例 #15
0
ファイル: PR_6_2.CS プロジェクト: BudimirDavor/CsharpSchool2
    static void Main()
    {
        MobileDevice[] Gadgets = new MobileDevice[3];
        Gadgets[0] = new MobileDevice("Palm OS");
        Gadgets[1] = new MobileDevice("Pocket PC");
        Gadgets[2] = new MobileDevice("Symbian");

        SetMarketShare(Gadgets);

        for (int i = 0; i < 3; i++)
        {
            Console.WriteLine(Gadgets[i].OPSustav + " - " + Gadgets[i].MarketShare + " %");
        }
    }
コード例 #16
0
 public static MobileDevice InsertMobileDevice(ref MobileDevice myMobile, KoloAndroidEntities4Serialization db, out string error)
 {
     error = "";
     try
     {
         db.MobileDevices.Add(myMobile);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         error = ExceptionHelper.GetExceptionMessage(e);
     }
     return(myMobile);
 }
コード例 #17
0
ファイル: Tracker.cs プロジェクト: valuecreation/RoutePlanner
        private static TrackingDevice _FindDevice(
            IEnumerable <TrackingDevice> devices,
            MobileDevice device)
        {
            foreach (TrackingDevice td in devices)
            {
                if (td.Device.Equals(device))
                {
                    return(td);
                }
            }

            return(null);
        }
コード例 #18
0
        public override object Evaluate(PXCache cache, object item, Dictionary <Type, object> pars)
        {
            Guid?userID = (Guid?)pars[typeof(UserID)];

            if (userID.HasValue)
            {
                MobileDevice device = PXSelectReadonly <MobileDevice, Where <MobileDevice.userID, Equal <Required <MobileDevice.userID> >,
                                                                             And <MobileDevice.enabled, Equal <True>,
                                                                                  And <MobileDevice.expiredToken, NotEqual <True> > > > >
                                      .SelectWindowed(cache.Graph, 0, 1, userID);

                return(device?.DeviceOS);
            }
            return(null);
        }
コード例 #19
0
        private static MobileDevice GetMobileDeviceFromXcrunDeviceInfo(string xcrunDeviceInfo)
        {
            // String comes in the form of
            // iPhone (9.3.3) [f8233a0aac771cbb24fce52ac2cc3960fc47f83e]
            // We only need what is inside the brackets []
            var index    = xcrunDeviceInfo.IndexOf('[') + 1;                                     //find the index of [ and exclude it
            var deviceId = xcrunDeviceInfo.Substring(index, xcrunDeviceInfo.Length - index - 1); // get rid of everything except the device id

            var endOfNameIndex = xcrunDeviceInfo.IndexOf(' ') + 1;
            var name           = xcrunDeviceInfo.Substring(0, endOfNameIndex - 1);

            var mobileDevice = new MobileDevice(deviceId, name);

            return(mobileDevice);
        }
コード例 #20
0
        public kAMDError Disconnect()
        {
            var kAMDSuccess = kAMDError.kAMDSuccess;

            this.isConnected = false;
            try
            {
                kAMDSuccess = (kAMDError)MobileDevice.AMDeviceDisconnect(DevicePtr);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
            }
            return(kAMDSuccess);
        }
コード例 #21
0
        // GET: api/MobileDevice
        public string GetMobileDevices(string access_token, string subscriber_number)
        {
            MobileDevice md = new MobileDevice
            {
                mobile_number = subscriber_number,
                access_token  = access_token,
                optin_date    = DateTime.UtcNow,
                optout_date   = (DateTime?)null
            };

            db.MobileDevices.Add(md);
            db.SaveChanges();

            return("success");
        }
コード例 #22
0
        private void reservations_ToolButton_Click(object sender, EventArgs e)
        {
            MobileDevice mobileDevice = GetFirstSelectedDataItem();

            if (mobileDevice != null)
            {
                using (var form = new AssetReservationListForm <MobileDevice>(mobileDevice))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        RefreshItems();
                    }
                }
            }
        }
コード例 #23
0
        // Token: 0x060000BF RID: 191 RVA: 0x00008A20 File Offset: 0x00006C20
        private bool DnIsMangled(MobileDevice device)
        {
            string escapedName = device.Id.Rdn.EscapedName;
            string value       = ADDeviceManager.EasDeviceCnString(device);

            if (!escapedName.Equals(value, StringComparison.Ordinal))
            {
                string value2 = ADDeviceManager.MowaDeviceCnString(device);
                if (!escapedName.Equals(value2, StringComparison.Ordinal))
                {
                    AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Found mangled device object DN: {0}", device.Id.DistinguishedName);
                    return(true);
                }
            }
            return(false);
        }
コード例 #24
0
ファイル: AppController.cs プロジェクト: wochizhuzhua/Guoli
        /// <summary>
        /// 确保设备信息在数据库中是唯一的
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        private MobileDevice MakeDeviceUnique(MobileDevice device)
        {
            var bll = new MobileDeviceBll();
            var model = bll.QuerySingle($"UniqueId='{device.UniqueId}' AND IsDelete=0");
            if (model == null)
            {
                model = device;
                var success = bll.Insert(model).Id > 0;
                if (!success)
                {
                    throw new Exception("设备信息插入失败!");
                }
            }

            return model;
        }
コード例 #25
0
        private static string CreateBody(MobileDevice device, string type, int numberOfDevices)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("<b>Device {0}</b><br>", type);
            builder.AppendFormat("<b>Company: {0}</b><br>", device.Company.CompanyName);
            builder.Append("<br>");
            builder.AppendFormat("Date requested: {0} {1}<br>", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
            builder.AppendFormat("Colossus reg. no. {0}<br>", device.Company.ColossusRegNo);
            builder.AppendFormat("Device serial no: {0}<br>", device.SerialNo);
            builder.Append("<br>");
            builder.AppendFormat("Device count: {0}<br>", numberOfDevices);
            builder.AppendFormat("License count: {0}<br>", device.Company.ColossusMobileLicences);

            return(builder.ToString());
        }
コード例 #26
0
        private static AssetDetail CreateAssetDetail(Asset asset, AssetReservationResult testAsset)
        {
            Printer printer = asset as Printer;

            if (printer != null)
            {
                return(CreatePrintDeviceDetail(testAsset, printer));
            }

            VirtualPrinter virtualPrinter = asset as VirtualPrinter;

            if (virtualPrinter != null)
            {
                return(CreatePrintDeviceDetail(testAsset, virtualPrinter));
            }

            Camera camera = asset as Camera;

            if (camera != null)
            {
                return(CreateCameraDetail(testAsset, camera));
            }

            DeviceSimulator simulator = asset as DeviceSimulator;

            if (simulator != null)
            {
                if (simulator.SimulatorType.Equals("Jedi", StringComparison.InvariantCultureIgnoreCase))
                {
                    return(CreateJediSimulatorDetail(testAsset, simulator));
                }
                else
                {
                    return(CreateSiriusSimulatorDetail(testAsset, simulator));
                }
            }

            MobileDevice mobileDevice = asset as MobileDevice;

            if (mobileDevice != null)
            {
                return(CreateMobileDeviceDetail(testAsset, mobileDevice));
            }

            // If we get to this point, just create a plain old asset
            return(new AssetDetail(testAsset.AssetId, testAsset.AvailabilityStart, testAsset.AvailabilityEnd));
        }
コード例 #27
0
        public string Single(int mdid, string m, int direct = 0)
        {
            bool isDirect = direct == 1;

            try
            {
                if (String.IsNullOrEmpty(m) || m.Length <= 5 || m.Length > 60)
                {
                    throw new Exception("The message must be between 5 and 60 characters!");
                }

                MobileDevice mobileDevice = DatabaseContext.MobileDevice.FirstOrDefault(x => x.ID == mdid);

                if (mobileDevice == null)
                {
                    return("The message could not be pushed to an unexisting device! There is no device for the id: " + mdid);
                }

                var pushNotification = new PushNotification()
                {
                    CreatedAt      = DateTime.Now,
                    Message        = m,
                    MobileDeviceID = mdid,
                    ModifiedAt     = DateTime.Now,
                    Status         = (int)PushNotificationStatus.Unprocessed,
                    Description    = isDirect ? "(Web API) New message pushed directly." : "(Web API) New message queued for push."
                };

                // if true, the message will get processed and saved to the DB, dbctx will be disposed
                if (isDirect && !Processor.ProcessNotification(DatabaseContext, pushNotification, true))
                {
                    throw new Exception("Error on direct push of the notification!");
                }

                // enqueue for push, processor will handle when run
                if (!isDirect && !Processor.EnqueueNotificationOnDatabase(DatabaseContext, pushNotification))
                {
                    throw new Exception("Error on enqueuing the push notification to the database!");
                }

                return(String.Format("Message successfully enqueued for {0}push at: {1}", isDirect ? "immediate " : "", DateTime.Now.ToString()));
            }
            catch (Exception ex)
            {
                return(String.Format("SERVER ERROR! Details: {0} Time: {1}", ex.Message, DateTime.Now.ToString()));
            }
        }
コード例 #28
0
        /// <summary>
        /// Check deploying type.
        /// </summary>
        /// <param name="routesConfigs">Config of routes to deploy.</param>
        /// <returns>True if need to deploy to tracking server. False otherwise.</returns>
        private bool _IsDeployToTrackingServer(IList <SentRouteConfig> routesConfigs)
        {
            // Get first selected route and check its type.
            foreach (SentRouteConfig sendedRouteConfig in routesConfigs)
            {
                if (sendedRouteConfig.IsChecked)
                {
                    MobileDevice mobileDevice = sendedRouteConfig.Route.Driver.MobileDevice;

                    if (mobileDevice == null)
                    {
                        mobileDevice = sendedRouteConfig.Route.Vehicle.MobileDevice;
                    }

                    if (mobileDevice.SyncType != SyncType.WMServer)
                    {
                        return(false);
                    }
                }
            }

            // Show error in case of not all used mobile devices has unique tracking ID.
            if (!_IsTrackingIDUnique(routesConfigs))
            {
                string sendedMessage = (string)_resourceDictionary["FailedToSendRoutes"];

                List <MessageDetail> details    = new List <MessageDetail>();
                string        messageDetailText = (string)_resourceDictionary["MobileDevicesShouldHaveUniqueIDs"];
                MessageDetail detail            = new MessageDetail(MessageType.Error, messageDetailText);
                details.Add(detail);
                _app.Messenger.AddError(sendedMessage, details);

                return(false);
            }
            else
            {
                // Check that all routes has mobile device and its types is "Tracking server".
                if (!_IsMobileDevicesPresentWithTrackingType(routesConfigs))
                {
                    string messageDetailText = (string)_resourceDictionary["AllMobileDevicesShouldBePresentWithTrackingType"];
                    _app.Messenger.AddWarning(messageDetailText);
                }
            }

            return(true);
        }
コード例 #29
0
        private bool ValidateAppVersion(MobileDevice mobileDevice, PushNotification notification)
        {
            if (notification.MinimumAppVersion == null && notification.MaximumAppVersion == null)
            {
                return(true);
            }

            Version appVersion;

            if (Version.TryParse(mobileDevice.AppVersion, out appVersion) &&
                appVersion >= notification.MinimumAppVersion)
            {
                return(notification.MaximumAppVersion == null || appVersion <= notification.MaximumAppVersion);
            }

            return(false);
        }
コード例 #30
0
        public virtual MobileDevice CreateMobileDevice(
            Brand brand,
            string model,
            Display display     = null,
            Battery battery     = null,
            Processor processor = null)
        {
            string nullOrEmptyModelMessage = string.Format(NullOrEmptyString, "Mobile device's model");

            this.ValidateIfStringIsNullOrEmpty(model, nullOrEmptyModelMessage);

            var mobileDevice = new MobileDevice {
                Brand = brand, Model = model
            };

            return(mobileDevice);
        }