예제 #1
0
        public async Task <HttpResponseMessage> PostKeg(KegRequestModel model, string kegId, string sessionId)
        {
            var cts  = new CancellationTokenSource();
            var task = RemoteRequestAsync(_dashboardApi.GetApi(Priority.UserInitiated).PostKeg(model, string.Empty, sessionId, cts.Token));

            runningTasks.Add(task.Id, cts);

            return(await task);
        }
예제 #2
0
        public async Task <object> PostKegAsync(KegRequestModel model, string kegId, string sessionId, string RequestType)
        {
            //ManifestModelGet manifestModelGet = new ManifestModelGet();

            // It is earlier
            //string url = string.Format(Configuration.PostKegUrl, sessionId);
            string url = string.Format(Configuration.GetKegStatusByKegIdUrl, kegId, sessionId);

            string content = JsonConvert.SerializeObject(model);
            var    value   = await App.kegIDClient.ExecuteServiceCall <KegIDResponse>(url, HttpMethodType.Send, content, RequestType : RequestType);

            //manifestModelGet = !string.IsNullOrEmpty(value.Response) ? DeserializeObject<ManifestModelGet>(value.Response, GetJsonSetting()) : new ManifestModelGet();
            //manifestModelGet.StatusCode = value.StatusCode;
            //return manifestModelGet;
            return(null);
        }
예제 #3
0
        private async void SaveCommandRecieverAsync()
        {
            try
            {
                var model = new KegRequestModel
                {
                    KegId               = KegId,
                    Barcode             = Barcode,
                    OwnerId             = PartnerModel.PartnerId,
                    AltBarcode          = Barcode,
                    Notes               = "",
                    ReferenceKey        = "",
                    ProfileId           = "",
                    AssetType           = SelectedItemType,
                    AssetSize           = Size,
                    AssetVolume         = "",
                    AssetDescription    = "",
                    OwnerSkuId          = "",
                    FixedContents       = "",
                    Tags                = Tags,
                    MaintenanceAlertIds = new List <string>(),
                    LessorId            = "",
                    PurchaseDate        = DateTimeOffset.Now,
                    PurchasePrice       = 0,
                    PurchaseOrder       = "",
                    ManufacturerName    = "",
                    ManufacturerId      = "",
                    ManufactureLocation = "",
                    ManufactureDate     = DateTimeOffset.Now,
                    Material            = "",
                    Markings            = "",
                    Colors              = ""
                };

                var Result = await _dashboardService.PostKegAsync(model, KegId, AppSettings.SessionId, Configuration.Keg);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }
예제 #4
0
        private async Task DeviceCheckIn()
        {
            Device.StartTimer(TimeSpan.FromDays(1), () =>
            {
#pragma warning disable IDE0039 // Use local function
                Func <Task> value = async() => await RunSafe(DeviceCheckIn());
#pragma warning restore IDE0039 // Use local function
                return(true);   // True = Repeat again, False = Stop the timer
            });

            var current = Connectivity.NetworkAccess;
            if (current == NetworkAccess.Internet)
            {
                DeviceCheckinRequestModel deviceModel = new DeviceCheckinRequestModel
                {
                    AppVersion  = AppInfo.VersionString,
                    DeviceId    = DeviceInfo.Manufacturer,
                    DeviceModel = DeviceInfo.Model,
                    OS          = DeviceInfo.VersionString,
                    PushToken   = "",
                    UserId      = Settings.UserId
                };
                var deviceCheckInResponse = await ApiManager.PostDeviceCheckin(deviceModel, Settings.SessionId);

                if (!deviceCheckInResponse.IsSuccessStatusCode)
                {
                    var param = new NavigationParameters
                    {
                        { "IsLogOut", true }
                    };
                    await NavigationService.NavigateAsync("LoginView", param);
                }

                Device.StartTimer(TimeSpan.FromMilliseconds(KegRefresh), () =>
                {
                    var model = new KegRequestModel
                    {
                        KegId               = string.Empty,
                        Barcode             = string.Empty,
                        OwnerId             = ConstantManager.Partner?.PartnerId,
                        AltBarcode          = string.Empty,
                        Notes               = "",
                        ReferenceKey        = "",
                        ProfileId           = "",
                        AssetType           = string.Empty,
                        AssetSize           = string.Empty,
                        AssetVolume         = "",
                        AssetDescription    = "",
                        OwnerSkuId          = "",
                        FixedContents       = "",
                        Tags                = new List <Tag>(),
                        MaintenanceAlertIds = new List <string>(),
                        LessorId            = "",
                        PurchaseDate        = DateTimeOffset.Now,
                        PurchasePrice       = 0,
                        PurchaseOrder       = "",
                        ManufacturerName    = "",
                        ManufacturerId      = "",
                        ManufactureLocation = "",
                        ManufactureDate     = DateTimeOffset.Now,
                        Material            = "",
                        Markings            = "",
                        Colors              = ""
                    };

                    Task.Factory.StartNew(async() =>
                    {
                        var value = await ApiManager.PostKeg(model, string.Empty, Settings.SessionId);
                    });
                    return(false); // True = Repeat again, False = Stop the timer
                });
            }
        }