コード例 #1
0
        public async Task <bool> GetItemListByFilter(ContentPage Context, ItemsRequestStructure P, string Filter)
        {
            OutputStructure OS = new OutputStructure();

            OS.Intent   = "GetItemListByFilter";
            OS.DeviceID = new CommonProcs().GetProperty("ext_TabSel_Other_DeviceID");

            OS.Value0 = P.Metadata;
            OS.Value1 = Filter;
            OS.Value2 = P.ParentMetadata;
            OS.Value3 = P.ParentUID;


            if (!CrossConnectivity.Current.IsConnected)
            {
                await((MainPage)Context).DisplayAlert("Error!", "Нет подключения к сети.", "ok");
                return(false);
            }
            object ip = "";

            App.Current.Properties.TryGetValue("ext_Address", out ip);

            string            FullServiceAddr = ip.ToString();
            JsonSerialization JS           = new JsonSerialization();
            string            OutputString = JS.Serialize(OS);

            Status res = await HttpRequest(OutputString, FullServiceAddr,
                                           new CommonProcs().GetProperty("ext_Login"), new CommonProcs().GetProperty("ext_Password"), Context);

            if (!res.MajorStatus)
            {
                await Context.DisplayAlert("Error!", "Ошибка при обмене с сервисом: " + res.MinorStatus.ToString(), "ok");

                return(false);
            }
            try
            {
                FillObjectsList(new JsonSerialization().deserializeJSON <InputStructure>((string)res.MinorStatus), (ItemList)Context, P);
            }
            catch
            {
                await Context.DisplayAlert("Error!", "Ошибка при разборке полученного пакета!", "ok");

                return(false);
            }

            return(true);
        }
コード例 #2
0
        public async void MethodInvoker()
        {
            Exchange        EE = new Exchange(this);
            OutputStructure OS = new OutputStructure
            {
                DeviceID = (string)new CommonProcs().GetProperty("ext_TabSel_Other_DeviceID"),
                Intent   = "DeleteItem",
                Value0   = "Good",
                Value1   = refDocument.UID,
                Value2   = GoodItemRef.StringID,
            };

            if (await EE.DeleteItem(OS))
            {
                RefLv_Goods.Remove(GoodItemRef);
                Navigation.PopAsync();
            }
        }
コード例 #3
0
        public async Task <bool> GetGoodByBarcode(string Barcode)
        {
            OutputStructure OS = new OutputStructure();

            OS.Intent   = "GetGoodByBarcode";
            OS.DeviceID = new CommonProcs().GetProperty("ext_TabSel_Other_DeviceID");
            OS.Value0   = Barcode;

            if (!CrossConnectivity.Current.IsConnected)
            {
                await(Context).DisplayAlert("Error!", "Нет подключения к сети.", "ok");
                return(false);
            }
            object ip = "";

            App.Current.Properties.TryGetValue("ext_Address", out ip);

            string            FullServiceAddr = ip.ToString();
            JsonSerialization JS           = new JsonSerialization();
            string            OutputString = JS.Serialize(OS);

            Status res = await HttpRequest(OutputString, FullServiceAddr,
                                           new CommonProcs().GetProperty("ext_Login"), new CommonProcs().GetProperty("ext_Password"), Context);

            if (!res.MajorStatus)
            {
                await Context.DisplayAlert("Error!", "Ошибка при обмене с сервисом: " + res.MinorStatus.ToString(), "ok");

                return(false);
            }
            try
            {
                ReplaceObjectInGoodRedactingPage(new JsonSerialization().deserializeJSON <InputStructure>((string)res.MinorStatus));
            }
            catch
            {
                await Context.DisplayAlert("Error!", "Ошибка при разборке полученного пакета!", "ok");

                return(false);
            }

            return(true);
        }
コード例 #4
0
        public async Task <bool> DeleteItem(OutputStructure locOS)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                await((MainPage)Context).DisplayAlert("Error!", "Нет подключения к сети.", "ok");
                return(false);
            }
            object ip = "";

            App.Current.Properties.TryGetValue("ext_Address", out ip);

            string FullServiceAddr = ip.ToString();
            string OutputString    = SerialObj_ThisClass.Serialize(locOS);

            Status res = await HttpRequest(OutputString, FullServiceAddr,
                                           new CommonProcs().GetProperty("ext_Login"), new CommonProcs().GetProperty("ext_Password"), (ContentPage)Context);

            if (!res.MajorStatus)
            {
                await((ContentPage)Context).DisplayAlert("Error!", "Ошибка при обмене с сервисом: " + res.MinorStatus.ToString(), "ok");
                return(false);
            }

            try
            {
                InputStructure IS = new JsonSerialization().deserializeJSON <InputStructure>((string)res.MinorStatus);
                if (IS.Status != "ok")
                {
                    await((ContentPage)Context).DisplayAlert("Error!", (string)res.MinorStatus.ToString(), "ok");
                    return(false);
                }
            }
            catch
            {
                await Context.DisplayAlert("Error!", "Ошибка при разборке полученного пакета!", "ok");

                return(false);
            }

            return(true);
        }
コード例 #5
0
        public async Task <bool> SendGoodListToServer(ObservableCollection <Good> refGoodList, Document refDocument)
        {
            OutputStructure OS = new OutputStructure();

            OS.Intent   = "AquiringOk";
            OS.DeviceID = new CommonProcs().GetProperty("ext_TabSel_Other_DeviceID");
            OS.Value0   = refDocument.UID;
            OS.Value1   = refDocument.Metadata;
            foreach (Good g in refGoodList)
            {
                OS.Table0.Add(new TablePart
                {
                    Metadata = g.Metadata,
                    Value0   = g.nGood,
                    UID      = g.uidGood,
                    //Value1 = g.nUnit,
                    Value2 = g.uidUnit,
                    //Value3 = g.nGoodDescription,
                    Value4 = g.uidGoodDescription,
                    //Value5 = g.nSerial,
                    Value6 = g.uidSerial,
                    //Value7 = g.nQuality,
                    Value8  = g.uidQuality,
                    Value9  = g.Amount,
                    Value10 = g.AmountAquired,
                    Value11 = g.Value0,
                    Value12 = g.Value1,
                    Value13 = g.Value2,
                    Value18 = g.StringID,
                    Value19 = g.Barcode
                });
            }

            if (!CrossConnectivity.Current.IsConnected)
            {
                await((MainPage)Context).DisplayAlert("Error!", "Нет подключения к сети.", "ok");
                return(false);
            }
            object ip = "";

            App.Current.Properties.TryGetValue("ext_Address", out ip);

            string FullServiceAddr = ip.ToString();
            string OutputString    = SerialObj_ThisClass.Serialize(OS);

            Status res = await HttpRequest(OutputString, FullServiceAddr,
                                           new CommonProcs().GetProperty("ext_Login"), new CommonProcs().GetProperty("ext_Password"), (ContentPage)Context);

            if (!res.MajorStatus)
            {
                await((ContentPage)Context).DisplayAlert("Error!", "Ошибка при обмене с сервисом: " + res.MinorStatus.ToString(), "ok");
                return(false);
            }

            if (((string)res.MinorStatus) != "\"\"")
            {
                await((ContentPage)Context).DisplayAlert("Error!", (string)res.MinorStatus.ToString(), "ok");
                return(false);
            }

            //Update docs list at main page
            Device.BeginInvokeOnMainThread(() => {
                AppGlobals.refMainPageContext.UpdateList();
            });

            return(true);
        }