コード例 #1
0
        public UpdateNomenclatureRLPage(NomenclatureRL nomenclature)
        {
            InitializeComponent();
            var viewModel = new UpdateNomenclatureRLViewModel();

            viewModel.NomenclatureRL = nomenclature;
            BindingContext           = viewModel;
        }
コード例 #2
0
        public async void EditNomenclatureRL()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Warning,
                    Languages.CheckConnection,
                    Languages.Ok);

                return;
            }
            if (string.IsNullOrEmpty(NomenclatureRL.code) || string.IsNullOrEmpty(NomenclatureRL.description))
            {
                Value = true;
                return;
            }
            var nomenclature = new NomenclatureRL
            {
                id          = NomenclatureRL.id,
                code        = NomenclatureRL.code,
                description = NomenclatureRL.description,
                note        = NomenclatureRL.note
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Put <NomenclatureRL>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/nomenclatureRL/update",
                res,
                nomenclature);

            Debug.WriteLine("********responseIn ViewModel*************");
            Debug.WriteLine(response);
            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            NomenclatureRLViewModel.GetInstance().Update(nomenclature);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "NomenclatureRL Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }