예제 #1
0
 protected override void UpdateWsStateAsync(string description, bool toOut)
 {
     if (VirtualRoot.DaemonOperation.IsNTMinerOpened())
     {
         var state = base.GetState();
         if (!string.IsNullOrEmpty(description))
         {
             state.Description = description;
         }
         state.ToOut = toOut;
         RpcRoot.JsonRpc.FirePostAsync(NTKeyword.Localhost, NTKeyword.MinerClientPort, ControllerUtil.GetControllerName <IMinerClientController>(), nameof(IMinerClientController.ReportWsDaemonState), null, state, timeountMilliseconds: 3000);
     }
 }
        async void GetBlockContainer(string blockID)
        {
            loading.IsVisible = true;

            try
            {
                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getCollectionInquiry(), this);

                clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (response != null)
                {
                    var records = JObject.Parse(content)["Result"].ToObject <List <clsDataRow> >();

                    foreach (clsDataRow record in records)
                    {
                        BlockContainer container = new BlockContainer();

                        foreach (clsCaptionValue summary in record.Summary)
                        {
                            switch (summary.Caption)
                            {
                            case "Container No.":
                                container.ContainerNo = summary.Value;
                                break;

                            case "Location":
                                container.Location = summary.Value;
                                break;

                            case "Customer":
                                container.Customer = summary.Value;
                                break;

                            case "Closing Date":
                                container.ClosingDate = summary.Value;
                                break;
                            }
                        }

                        if (!(String.IsNullOrEmpty(container.Location)) && container.Location.Contains(blockID.Substring(0, 3)))
                        {
                            blockContainers.Add(container);
                        }
                    }

                    dataGrid.ItemsSource = blockContainers;
                }
            }
            catch
            {
            }

            loading.IsVisible = false;
        }
예제 #3
0
        public async void GetStopList()
        {
            try
            {
                string listtype = (action == "Inbound Trip") ? "InboundList" : "OutboundList";

                var content = await CommonFunction.CallWebService(0, null, "https://api.asolute.com/host/api/", ControllerUtil.getBusStops(listtype), this);

                clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (response.IsGood)
                {
                    stops = JObject.Parse(content)["Result"].ToObject <List <clsBusTicket> >();


                    App.Database.deleteRecords(action);
                    App.Database.deleteRecordSummary(action);


                    foreach (clsBusTicket stop in stops)
                    {
                        ListItems items = new ListItems
                        {
                            StopId   = stop.StopId,
                            StopName = stop.StopName,
                            Rate     = stop.Rate,
                            Category = action
                        };

                        App.Database.SaveMenuAsync(items);

                        foreach (ListItems station in stop.Stops)
                        {
                            SummaryItems summaryItem = new SummaryItems
                            {
                                Id        = stop.StopId,
                                StopId    = station.StopId,
                                StopName  = station.StopName,
                                Rate      = station.Rate,
                                BackColor = "#ffffff"
                            };
                            summaryItem.Type = action;


                            App.Database.SaveSummarysAsync(summaryItem);
                        }
                    }

                    var test = App.Database.GetMainMenu(action);

                    LoadStoplist();
                }
                else
                {
                    await DisplayAlert("Error", response.Message, "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
예제 #4
0
        protected async void GetSubJobList()
        {
            records.Clear();

            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getSubJobURL(jobID), this);

            clsResponse pending_response = JsonConvert.DeserializeObject <clsResponse>(content);

            if (pending_response.IsGood)
            {
                App.Database.DeleteTruckModel();

                List <clsTruckingModel> trucks = JObject.Parse(content)["Result"].ToObject <List <clsTruckingModel> >();

                foreach (clsTruckingModel truck in trucks)
                {
                    string     summary = "";
                    TruckModel record  = new TruckModel();

                    record.TruckId  = truck.TruckId;
                    record.RecordId = truck.Id;

                    foreach (clsCaptionValue truckValue in truck.Summary)
                    {
                        if (!(String.IsNullOrEmpty(truckValue.Caption)))
                        {
                            summary += truckValue.Caption + "  :  " + truckValue.Value + "\r\n" + "\r\n";
                        }
                        else
                        {
                            summary += truckValue.Value + "\r\n" + "\r\n";
                        }


                        if (truckValue.Caption.Equals("Job No."))
                        {
                            record.JobNo = truckValue.Value;
                        }
                    }

                    record.Summary = summary;

                    //App.Database.SaveTruckModelAsync(record);
                    records.Add(record);
                }

                loadPendingList();
            }
            else
            {
                await DisplayAlert("JsonError", pending_response.Message, "OK");
            }
        }
예제 #5
0
        public async void BarCodeScan(object sender, EventArgs e)
        {
            try
            {
                var scanPage = new ZXingScannerPage();
                await Navigation.PushAsync(scanPage);

                scanPage.OnScanResult += (result) =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.addJobURL(result.Text), this);
                        clsResponse jsonResponse = JsonConvert.DeserializeObject <clsResponse>(content);

                        if (jsonResponse.IsGood)
                        {
                            GetJobList();
                            //Ultis.Settings.UpdatedRecord = "Yes";
                            displayToast("Job added to job list.");
                            scanPage.ResumeAnalysis();
                        }
                        else
                        {
                            var answer = await DisplayAlert("Error", jsonResponse.Message, "OK", "Cancel");
                            if (answer.Equals(true))
                            {
                                scanPage.ResumeAnalysis();
                            }
                            else
                            {
                                await Navigation.PopAsync();
                            }
                        }
                    });
                };
            }
            catch
            {
                await DisplayAlert("Error", "Please try again later", "OK");
            }
        }
예제 #6
0
 private void Init()
 {
     RpcRoot.JsonRpc.GetAsync(RpcRoot.OfficialServerHost, RpcRoot.OfficialServerPort, ControllerUtil.GetControllerName <INTMinerWalletController>(), nameof(INTMinerWalletController.NTMinerWallets), null, (DataResponse <List <NTMinerWalletData> > response, Exception e) => {
         if (response.IsSuccess() && response.Data != null && response.Data.Count != 0)
         {
             var ethWallets = response.Data.Where(a => "ETH".Equals(a.CoinCode, StringComparison.OrdinalIgnoreCase)).ToArray();
             if (ethWallets.Length != 0)
             {
                 _ethWallets.Clear();
                 _ethWallets.AddRange(ethWallets.Select(a => a.Wallet));
             }
         }
     });
 }
예제 #7
0
        public async void checkEquipment(object sender, EventArgs e)
        {
            string equipmentId = equipmentID.Text;

            if (NetworkCheck.IsInternet())
            {
                try
                {
                    var client = new HttpClient();
                    client.BaseAddress = new Uri(Ultis.Settings.SessionBaseURI);

                    var eqUri = ControllerUtil.getEquipmentURL(equipmentId);

                    var eqResponse = await client.GetAsync(eqUri);

                    var eqContent = await eqResponse.Content.ReadAsStringAsync();

                    Debug.WriteLine(eqContent);

                    newEqResponse = JsonConvert.DeserializeObject <clsResponse>(eqContent);

                    List <clsCaptionValue> eqInfo = new List <clsCaptionValue>();

                    int count = 0;
                    for (int i = 0; i < newEqResponse.Result.Count; i++)
                    {
                        string caption = newEqResponse.Result[i]["Caption"];
                        string value   = newEqResponse.Result[i]["Value"];
                        bool   display = newEqResponse.Result[i]["Display"];
                        eqInfo.Add(new clsCaptionValue(caption, value, display));
                    }
                    count++;

                    List <EqDetails> numberRow = new List <EqDetails>();
                    for (int j = 0; j < count; j++)
                    {
                        EqDetails listRow = new EqDetails();
                        listRow.count = "true";

                        numberRow.Add(listRow);
                    }

                    ObservableCollection <EqDetails> row = new ObservableCollection <EqDetails>(numberRow);



                    var Template = new DataTemplate(() =>
                    {
                        AbsoluteLayout absoluteLayout = new AbsoluteLayout();
                        StackLayout cellWrapper       = new StackLayout()
                        {
                            Padding           = new Thickness(10, 20, 20, 20),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.FillAndExpand
                        };

                        foreach (clsCaptionValue items in eqInfo)
                        {
                            Label label = new Label
                            {
                                Text = items.Caption + ": " + items.Value
                            };

                            label.FontAttributes = FontAttributes.Bold;


                            cellWrapper.Children.Add(label);
                        }

                        absoluteLayout.Children.Add(cellWrapper);


                        return(new ViewCell {
                            View = absoluteLayout
                        });
                    });

                    euipmentList.ItemsSource   = row;
                    euipmentList.HasUnevenRows = true;
                    euipmentList.ItemTemplate  = Template;
                }
                catch (HttpRequestException)
                {
                    await DisplayAlert("Unable to connect", "Please try again later", "Ok");
                }
            }
            else
            {
                await DisplayAlert("Reminder", "Currently offline cant search", "OK");
            }
        }
예제 #8
0
 public void SetPlayerChipsImage(IPlayer player, PictureBox chip)
 {
     ControllerUtil.SetChipsImage(player.ChipsAmount, chip, PathChipsFolder, ChipsFileNames, MaxPlayers + 1);
 }
예제 #9
0
        async void GetNewPalletList()
        {
            try
            {
                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.loadNewPalletURL(id, productPallet.ProductLinkId), this);

                clsResponse newPallet_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (newPallet_response.IsGood)
                {
                    newPallet      = JObject.Parse(content)["Result"].ToObject <clsPalletNew>();
                    unitBox.Text   = newPallet.DefaultProductUom;
                    statusBox.Text = newPallet.DefaultStockStatus;

                    foreach (clsKeyValue size in newPallet.PalletSize)
                    {
                        sizes.Add(size.Value);
                        string[] defaultSize = size.Value.Split('(');
                        if (defaultSize[1].Contains(newPallet.DefaultProductUom))
                        {
                            sizeBox.Text = size.Value;
                        }
                    }

                    foreach (clsKeyValue unit in newPallet.ProductUom)
                    {
                        units.Add(unit.Key);
                    }

                    foreach (clsKeyValue status_ in newPallet.StockStatus)
                    {
                        status.Add(status_.Key);
                    }

                    sizeBox.ComboBoxSource   = sizes;
                    unitBox.ComboBoxSource   = units;
                    statusBox.ComboBoxSource = status;

                    if (newPallet.ControlVolume != "H")
                    {
                        clsAttribute volume = new clsAttribute
                        {
                            Key     = "M3",
                            Caption = "M3",
                            Value   = newPallet.ControlVolume
                        };

                        newPallet.Attribute.Add(volume);
                    }

                    if (newPallet.ControlWeight != "H")
                    {
                        clsAttribute weight = new clsAttribute
                        {
                            Key     = "KG",
                            Caption = "KG",
                            Value   = newPallet.ControlWeight
                        };

                        newPallet.Attribute.Add(weight);
                    }

                    int row = 4, column = 0;
                    foreach (clsAttribute attr in newPallet.Attribute)
                    {
                        StackLayout autoGenerateEntryStack = new StackLayout
                        {
                            //Orientation = StackOrientation.Horizontal,
                            StyleId = attr.Key
                        };

                        if (attr.Key == "ExpiryDate" || attr.Key == "MfgDate")
                        {
                            customDatePicker = new CustomDatePicker
                            {
                                StyleId           = attr.Key,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                NullableDate      = null
                            };

                            customDatePicker.Unfocused += (object sender, FocusEventArgs e) =>
                            {
                                DateUnfocus(sender);
                            };

                            Label fieldLbl = new Label
                            {
                                Text                  = attr.Caption,
                                FontAttributes        = FontAttributes.Bold,
                                VerticalTextAlignment = TextAlignment.Center
                            };

                            autoGenerateEntryStack.Children.Add(fieldLbl);
                            autoGenerateEntryStack.Children.Add(customDatePicker);
                        }
                        else
                        {
                            Entry entry = new Entry
                            {
                                StyleId           = attr.Key,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                            };

                            entry.Completed += Handle_Completed;

                            entry.Behaviors.Add(new MaxLengthValidation {
                                MaxLength = 50
                            });

                            if (attr.Key == "M3" || attr.Key == "KG")
                            {
                                entry.Keyboard = Keyboard.Numeric;
                            }

                            inputLayout           = new SfTextInputLayout();
                            inputLayout.Hint      = attr.Caption;
                            inputLayout.InputView = entry;
                            inputLayout.StyleId   = attr.Key;

                            /*  customEntry = new CustomEntry
                             * {
                             *   StyleId = attr.Key,
                             *   HorizontalOptions = LayoutOptions.FillAndExpand,
                             *
                             * };
                             *
                             * customEntry.Completed += Handle_Completed;
                             *
                             * customEntry.Behaviors.Add(new MaxLengthValidation { MaxLength = 50 });
                             *
                             * //entryStack.Children.Add(customEntry);*/

                            if (attr.Key != "ExpiryDate" && attr.Key != "MfgDate" && attr.Key != "M3" && attr.Key != "KG")
                            {
                                Image scan = new Image
                                {
                                    Source          = "barCode.png",
                                    WidthRequest    = 60,
                                    HeightRequest   = 30,
                                    VerticalOptions = LayoutOptions.Center,
                                    StyleId         = attr.Key
                                };

                                var scan_barcode = new TapGestureRecognizer
                                {
                                    NumberOfTapsRequired = 1
                                };

                                scan_barcode.Tapped += (sender, e) =>
                                {
                                    var image = sender as Image;

                                    EntryScan(image);
                                };
                                scan.GestureRecognizers.Add(scan_barcode);

                                inputLayout.TrailingView = scan;
                            }


                            autoGenerateEntryStack.Children.Add(inputLayout);
                        }

                        if (attr.Value == "M")
                        {
                            /*  if (customEntry != null)
                             * {
                             *   customEntry.LineColor = Color.LightYellow;
                             * }
                             * if (customDatePicker != null)
                             * {
                             *   customDatePicker.BackgroundColor = Color.LightYellow;
                             * }*/

                            if (inputLayout != null)
                            {
                                inputLayout.ContainerBackgroundColor = Color.LightYellow;
                            }
                            if (customDatePicker != null)
                            {
                                customDatePicker.BackgroundColor = Color.LightYellow;
                            }
                        }
                        else
                        {
                            /*if (customEntry != null)
                             * {
                             *  customEntry.LineColor = Color.WhiteSmoke;
                             * }*/
                            if (inputLayout != null)
                            {
                                inputLayout.ContainerBackgroundColor = Color.WhiteSmoke;
                            }
                        }

                        entryStack.Children.Add(autoGenerateEntryStack);
                        // entryStack.Children.Add(scan);

                        //grid.Children.Add(fieldLbl, column, row);
                        column++;
                        //grid.Children.Add(entryStack, column, row);
                        row++;
                        column = 0;
                    }
                }
                else
                {
                    await DisplayAlert("Error", newPallet_response.Message, "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
예제 #10
0
        async void Handle_Tapped(object sender, System.EventArgs e)
        {
            var image = sender as Image;

            switch (image.StyleId)
            {
            case "barcode_icon":
                PalletScan();
                break;

            case "confirm_icon":
                try
                {
                    checkField.Clear();

                    foreach (clsAttribute attr in newPallet.Attribute)
                    {
                        if (attr.Value == "M")
                        {
                            string test = (!(String.IsNullOrEmpty(SearchControl(attr.Key, "GetValue", "")))) ? SearchControl(attr.Key, "GetValue", "") : String.Empty;

                            if (String.IsNullOrEmpty(test))
                            {
                                checkField.Add(false);
                            }
                            else
                            {
                                checkField.Add(true);
                            }
                        }
                    }

                    if (!(String.IsNullOrEmpty(quantity.Text)) && !(String.IsNullOrEmpty(sizeBox.Text)) &&
                        !(String.IsNullOrEmpty(statusBox.Text)) && !(String.IsNullOrEmpty(unitBox.Text)) && !(checkField.Contains(false)))
                    {
                        clsPallet pallet = new clsPallet
                        {
                            Id          = id,
                            ProductCode = (actionID == "BARRY") ? palletNo.Text.Substring(0, 16) : productPallet.ProductCode,
                            PalletId    = (!(String.IsNullOrEmpty(palletNo.Text))) ? palletNo.Text : String.Empty,
                            PalletSize  = newPallet.PalletSize[sizes.FindIndex(x => x.Equals(sizeBox.Text))].Key,
                            Qty         = Convert.ToInt32(quantity.Text),
                            Uom         = newPallet.ProductUom[units.FindIndex(x => x.Equals(unitBox.Text))].Key,
                            StockStatus = statusBox.Text,
                            String01    = (!(String.IsNullOrEmpty(SearchControl("String01", "GetValue", "")))) ? SearchControl("String01", "GetValue", "") : String.Empty,
                            String02    = (!(String.IsNullOrEmpty(SearchControl("String02", "GetValue", "")))) ? SearchControl("String02", "GetValue", "") : String.Empty,
                            String03    = (!(String.IsNullOrEmpty(SearchControl("String03", "GetValue", "")))) ? SearchControl("String03", "GetValue", "") : String.Empty,
                            String04    = (!(String.IsNullOrEmpty(SearchControl("String04", "GetValue", "")))) ? SearchControl("String04", "GetValue", "") : String.Empty,
                            String05    = (!(String.IsNullOrEmpty(SearchControl("String05", "GetValue", "")))) ? SearchControl("String05", "GetValue", "") : String.Empty,
                            String06    = (!(String.IsNullOrEmpty(SearchControl("String06", "GetValue", "")))) ? SearchControl("String06", "GetValue", "") : String.Empty,
                            ExpiryDate  = (!(String.IsNullOrEmpty(SearchControl("ExpiryDate", "GetValue", "")))) ? SearchControl("ExpiryDate", "GetValue", "") : String.Empty,
                            MfgDate     = (!(String.IsNullOrEmpty(SearchControl("MfgDate", "GetValue", "")))) ? SearchControl("MfgDate", "GetValue", "") : String.Empty,
                            Volume      = (!(String.IsNullOrEmpty(SearchControl("M3", "GetValue", "")))) ? Convert.ToDouble(SearchControl("M3", "GetValue", "")) : 0,
                            Weight      = (!(String.IsNullOrEmpty(SearchControl("KG", "GetValue", "")))) ? Convert.ToDouble(SearchControl("KG", "GetValue", "")) : 0
                        };

                        var content = await CommonFunction.CallWebService(1, pallet, Ultis.Settings.SessionBaseURI, ControllerUtil.postNewPalletURL(id), this);

                        clsResponse upload_response = JsonConvert.DeserializeObject <clsResponse>(content);

                        if (upload_response.IsGood)
                        {
                            await DisplayAlert("Success", "New pallet added.", "OK");

                            palletNo.Text = String.Empty;
                            quantity.Text = String.Empty;

                            List <string> dynamicFields = new List <string>
                            {
                                "String01",
                                "String02",
                                "String03",
                                "String04",
                                "String05",
                                "String06",
                                "ExpiryDate",
                                "MfgDate",
                                "M3",
                                "KG"
                            };

                            foreach (string field in dynamicFields)
                            {
                                SearchControl(field, "ClearValue", "");
                            }

                            palletNo.Focus();
                        }
                    }
                    else
                    {
                        await DisplayAlert("Missing field", "Please fill in all mandatory field.", "OK");
                    }
                }
                catch (Exception error)
                {
                    await DisplayAlert("Error", error.Message, "OK");
                }
                break;
            }
        }
예제 #11
0
        public async void GetHaulageVolume(string date)
        {
            data.Clear();

            var volume_content = await CommonFunction.GetRequestAsync(Ultis.Settings.SessionBaseURI, ControllerUtil.getHaulageVolumeURL(date));

            clsResponse volume_response = JsonConvert.DeserializeObject <clsResponse>(volume_content);

            if (volume_response.IsGood)
            {
                firstLoad = false;

                CurrentPage = Children[1];

                Title = dataTime.ToString("MMMM yyyy");

                volumes = JObject.Parse(volume_content)["Result"].ToObject <List <clsVolume> >();

                foreach (clsVolume volume in volumes)
                {
                    double revenue = Convert.ToDouble(volume.Revenue) / 1000;

                    HaulageVolume dataValue = new HaulageVolume
                    {
                        Entity  = volume.Entity,
                        Job     = volume.Job.ToString("N0"),
                        Revenue = revenue.ToString("N0") + " K"
                    };

                    data.Add(dataValue);
                }

                gridHeight = 0;

                if (volumes.Count == 1)
                {
                    gridHeight = 100;
                }
                else
                {
                    gridHeight = data.Count * 60;
                }

                PageContent();
            }
            else
            {
                await DisplayAlert("JsonError", volume_response.Message, "OK");
            }
        }
        public async void getCategory()
        {
            var content = await CommonFunction.CallWebService(0,null,Ultis.Settings.SessionBaseURI, ControllerUtil.getCategoryListURL(providerCode),this);
            clsResponse provider_response = JsonConvert.DeserializeObject<clsResponse>(content);

            if (provider_response.IsGood)
            {
                categories = JObject.Parse(content)["Result"].ToObject<List<clsCaptionValue>>();

                App.Database.deleteRecords("Category");
                App.Database.deleteRecordSummary("Category");

                foreach (clsCaptionValue category in categories)
                {
                    ListItems menu = new ListItems();
                    menu.Id = category.Caption;
                    menu.Name = category.Value;
                    menu.Category = "Category";
                    App.Database.SaveMenuAsync(menu);

                    SummaryItems summaryItem = new SummaryItems();
                    summaryItem.Id = category.Caption;
                    summaryItem.Caption = "";
                    summaryItem.Value = category.Value;
                    summaryItem.Display = category.Display;
                    summaryItem.Type = "Category";
                    summaryItem.BackColor = "";
                    App.Database.SaveSummarysAsync(summaryItem);

                   /* string quantity = new String(category.Value.Where(Char.IsDigit).ToArray());
                    string[] name = category.Value.Split('(');

                    TrackingCategory trackingCategory = new TrackingCategory();
                    trackingCategory.CategoryCode = category.Caption;
                    trackingCategory.Name = name[0];
                    trackingCategory.Amount = Convert.ToInt32(quantity);

                    pieData.Add(trackingCategory);*/
                }

               /* bar.ItemsSource = pieData;
                bar.XBindingPath = "Name";
                bar.YBindingPath = "Amount";


                activityIndicator.IsEnabled = false;
                activityIndicator.IsVisible = false;
                activityIndicator.IsRunning = false;*/

                 loadCateogoryList();
            }
            else
            {
                await DisplayAlert("JsonError", provider_response.Message, "OK");
            }
        }
예제 #13
0
        public async void Register_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (RegisterButton.Text.Equals("Next"))
                {
                    if (emailAddressEntry.Text.Contains("@"))
                    {
                        string[] emailFormat = emailAddressEntry.Text.Split('@');

                        if (emailFormat[1].Contains("."))
                        {
                            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getCompanyNameURL(businessRegEntry.Text), this);

                            clsResponse company_response = JsonConvert.DeserializeObject <clsResponse>(content);

                            if (company_response.IsGood)
                            {
                                companyEntryView.IsVisible = true;
                                term.IsVisible             = true;

                                companyEntry.Text   = company_response.Result;
                                RegisterButton.Text = "Confirm";
                            }
                        }
                        else
                        {
                            await DisplayAlert("Error", "Email address must in [email protected] format.", "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", "Email address must in [email protected] format.", "OK");
                    }
                }
                else
                {
                    if (!(String.IsNullOrEmpty(emailAddressEntry.Text)) && !(String.IsNullOrEmpty(userNameEntry.Text)) && !(String.IsNullOrEmpty(phoneEntry.Text)) &&
                        !(String.IsNullOrEmpty(businessRegEntry.Text)) && !(String.IsNullOrEmpty(companyEntry.Text)))
                    {
                        try
                        {
                            OneSignal.Current.IdsAvailable((playerID, pushToken) => firebaseID = playerID);

                            Ultis.Settings.FireID = firebaseID;
                        }
                        catch
                        {
                        }

                        clsRegister register = new clsRegister();

                        register.DeviceId    = Ultis.Settings.DeviceUniqueID;
                        register.UserName    = userNameEntry.Text;
                        register.Email       = emailAddressEntry.Text;
                        register.MobileNo    = phoneEntry.Text;
                        register.RegNo       = businessRegEntry.Text;
                        register.CompanyName = companyEntry.Text;
                        register.FirebaseId  = firebaseID;
                        register.DeviceIdiom = CrossDeviceInfo.Current.Idiom.ToString();
                        register.DeviceMfg   = CrossDeviceInfo.Current.Manufacturer;
                        register.DeviceModel = CrossDeviceInfo.Current.Model;
                        register.OSPlatform  = CrossDeviceInfo.Current.Platform.ToString();
                        register.OSVer       = CrossDeviceInfo.Current.VersionNumber.ToString();
                        register.AppVer      = CrossDeviceInfo.Current.AppVersion;

                        var content = await CommonFunction.CallWebService(1, register, Ultis.Settings.SessionBaseURI, ControllerUtil.postBusinessRegisterURL(), this);

                        clsResponse register_response = JsonConvert.DeserializeObject <clsResponse>(content);

                        if (register_response.IsGood)
                        {
                            Application.Current.MainPage = new AccountActivation();
                        }
                        else
                        {
                            await DisplayAlert("Json Error", register_response.Message, "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", "Please enter all the field .", "OK");
                    }

                    /*if (term.Checked)
                     * {
                     * }
                     * else
                     * {
                     *  await DisplayAlert("Reminder", "Please tick the check box to continue", "OK");
                     * }*/
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
예제 #14
0
 public void SetLocations()
 {
     ControllerUtil.SetLocations(this.Locations, ChipsCoordX, ChipsCoordY);
 }
예제 #15
0
        public async void uploadDetail(object sender, EventArgs e)
        {
            bool done = false;

            try
            {
                if (SignatureStack.IsVisible == true)
                {
                    Stream signatureImage = await signature.GetImageStreamAsync(SignatureImageFormat.Png, strokeColor : Color.Black, fillColor : Color.White);

                    if (signatureImage != null)
                    {
                        await CommonFunction.StoreSignature(jobID, signatureImage, this);

                        //UploadImage(jobID);
                        BackgroundTask.StartTimer();
                        done = true;
                    }
                    else
                    {
                        await DisplayAlert("Signature Error", "Please sign for the job.", "OK");
                    }
                }

                if (done == true || SignatureStack.IsVisible == false)
                {
                    clsTruckingModel futile = new clsTruckingModel();

                    futile.Id         = jobID;
                    futile.Remarks    = remarkTextEditor.Text;
                    futile.ReasonCode = keyValue[ReasonPicker.SelectedIndex].Key;

                    if (Title.Equals("Cargo Return"))
                    {
                        futile.RefNo = ReferenceNo.Text;
                    }

                    var content = await CommonFunction.CallWebService(1, futile, Ultis.Settings.SessionBaseURI, ControllerUtil.postFutileTripURL(), this);

                    clsResponse futile_response = JsonConvert.DeserializeObject <clsResponse>(content);

                    if (futile_response.IsGood)
                    {
                        await DisplayAlert("Success", "Job status updated as futile.", "OK");

                        await Navigation.PopAsync();
                    }
                    else
                    {
                        await DisplayAlert("Error", futile_response.Message, "OK");
                    }
                }
            }
            catch
            {
            }
        }
예제 #16
0
 public void SetLocations(Point[] otherLocations)
 {
     ControllerUtil.SetLocations(this.Locations, otherLocations);
 }
예제 #17
0
        public async void ReasonList()
        {
            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getReasonListURL(), this);

            clsResponse reason_response = JsonConvert.DeserializeObject <clsResponse>(content);

            if (reason_response.IsGood)
            {
                keyValue = JObject.Parse(content)["Result"].ToObject <List <clsKeyValue> >();

                foreach (clsKeyValue reason in keyValue)
                {
                    ReasonPicker.Items.Add(reason.Value);
                }
            }
            else
            {
                await DisplayAlert("Error", reason_response.Message, "OK");
            }
        }
예제 #18
0
 public void SetPotChipsImage(int potAmount, PictureBox chip)
 {
     ControllerUtil.SetChipsImage(potAmount, chip, PathChipsFolder, ChipsFileNames, MaxPlayers + 1);
 }
예제 #19
0
 public void GetAllControll()
 {
     ControllerUtil util = new ControllerUtil();
     List<string> temp = util.GetControllerNames();
 }
예제 #20
0
        protected async void GetJobList()
        {
            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getTruckListURL(webServiceAction), this);

            clsResponse job_response = JsonConvert.DeserializeObject <clsResponse>(content);

            if (job_response.IsGood)
            {
                records.Clear();

                App.Database.DeleteTruckModel();
                App.Database.DeleteTruckModeDetail();

                List <clsTruckingModel> trucks = JObject.Parse(content)["Result"].ToObject <List <clsTruckingModel> >();

                foreach (clsTruckingModel truck in trucks)
                {
                    string     summary = "";
                    TruckModel record  = new TruckModel
                    {
                        TruckId       = truck.TruckId,
                        RecordId      = truck.Id,
                        Action        = truck.Action,
                        EventRecordId = truck.EventRecordId,
                        Latitude      = truck.Latitude,
                        Longitude     = truck.Longitude,
                        TelNo         = truck.TelNo,
                        ReqSign       = truck.ReqSign
                    };

                    if (!(String.IsNullOrEmpty(truck.BackColor)))
                    {
                        record.BackColor = truck.BackColor;
                    }
                    else
                    {
                        record.BackColor = "#ffffff";
                    }

                    foreach (clsCaptionValue truckSummary in truck.Summary)
                    {
                        if (!(String.IsNullOrEmpty(truckSummary.Caption)))
                        {
                            summary += truckSummary.Caption + "  :  " + truckSummary.Value + "\r\n" + "\r\n";
                        }
                    }

                    foreach (clsCaptionValue truckDetail in truck.Details)
                    {
                        DetailItems detail = new DetailItems();

                        detail.Id      = truck.Id;
                        detail.Caption = truckDetail.Caption;
                        detail.Value   = truckDetail.Value;
                        detail.Display = truckDetail.Display;
                        App.Database.SaveDetailsAsync(detail);
                    }

                    record.Summary = summary;

                    App.Database.SaveTruckModelAsync(record);
                }
                loadJobList();
            }
            else
            {
                await DisplayAlert("JsonError", job_response.Message, "OK");
            }
        }
예제 #21
0
 public void GetControllerNameTest()
 {
     Assert.AreEqual("FileUrl", ControllerUtil.GetControllerName <IFileUrlController>());
 }
 //
 // GET: /UserRight/
 public ActionResult Index()
 {
     ControllerUtil util = new ControllerUtil();
     ViewBag.Data = util.GetControllerNames();
     return View();
 }
예제 #23
0
        public async void downloadRunSheet(string date)
        {
            try
            {
                activityIndicator.IsRunning = true;
                firstLoad   = false;
                CurrentPage = Children[1];

                string url = (runSheetItem.Id == "RunSheet") ? ControllerUtil.getDownloadHaulageHistoryURL(date) : ControllerUtil.getBusTripHistory(date);

                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, url, this);

                clsResponse json_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (json_response.IsGood == true)
                {
                    switch (option)
                    {
                    case "previous":
                        datePicker.Date = datePicker.Date.AddDays(-1);
                        break;

                    case "next":
                        datePicker.Date = datePicker.Date.AddDays(1);
                        break;

                    case "none":
                        break;
                    }

                    history = JObject.Parse(content)["Result"].ToObject <List <clsHaulageModel> >();

                    App.Database.deleteRecords(runSheetItem.Id);
                    App.Database.deleteRecordSummary(runSheetItem.Id);
                    //App.Database.deleteHaulage("HaulageHistory");
                    if (history != null)
                    {
                        foreach (clsHaulageModel data in history)
                        {
                            ListItems record = new ListItems
                            {
                                Id             = data.Id,
                                Background     = data.BackColor,
                                Category       = runSheetItem.Id,
                                Name           = runSheetItem.Name,
                                TruckId        = data.TruckId,
                                ReqSign        = data.ReqSign,
                                Latitude       = data.Latitude,
                                Longitude      = data.Longitude,
                                TelNo          = data.TelNo,
                                EventRecordId  = data.EventRecordId,
                                TrailerId      = data.TrailerId,
                                ContainerNo    = data.ContainerNo,
                                MaxGrossWeight = data.MaxGrossWeight,
                                TareWeight     = data.TareWeight,
                                CollectSeal    = data.CollectSeal,
                                SealNo         = data.SealNo,
                                ActionId       = data.ActionId.ToString(),
                                ActionMessage  = data.ActionMessage,
                                Title          = data.Title,
                                SealMode       = data.SealMode
                            };

                            App.Database.SaveMenuAsync(record);

                            foreach (clsCaptionValue summaryList in data.Summary)
                            {
                                SummaryItems summaryItem = new SummaryItems();

                                summaryItem.Id        = data.Id;
                                summaryItem.Caption   = summaryList.Caption;
                                summaryItem.Value     = summaryList.Value;
                                summaryItem.Display   = summaryList.Display;
                                summaryItem.Type      = runSheetItem.Id;
                                summaryItem.BackColor = data.BackColor;
                                App.Database.SaveSummarysAsync(summaryItem);
                            }
                        }

                        option = "none";
                    }

                    refreshRunSheetHistory();
                }
            }
            catch (Exception exception)
            {
                await DisplayAlert("Error", exception.Message, "OK");
            }
        }