Example #1
0
        public async void GetConventionById()
        {
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }
            var timestamp = DateTime.Now.ToFileTime();
            var cookie    = Settings.Cookie; //.Split(11, 33)
            var res       = cookie.Substring(11, 32);
            var response  = await apiService.GetAttachmentWithCoockie <UpdateConventionGlobalConfig>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/conventionGlobalConfig/getById?id=" + ConfigurationConvention.id + "&time=" + timestamp,
                res);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            UpdateConvention = (UpdateConventionGlobalConfig)response.Result;
        }
        public async void NewAddress()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

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

                return;
            }
            var emailPattern = "^[a-z0-9._-]+@[a-z0-9._-]+\\.[a-z]{2,6}$";

            if (string.IsNullOrEmpty(Email))
            {
                Value = true;
                return;
            }
            if (!String.IsNullOrWhiteSpace(Email) && !(Regex.IsMatch(Email, emailPattern)))
            {
                Value = true;
                return;
            }

            List <AddAddress> addAddresses = new List <AddAddress>();

            addAddresses.Add(new AddAddress()
            {
                code        = "#PostedReports",
                addressMail = Email,
                duplicate   = false
            });
            var _jobCron = new AddJobCron
            {
                addresses = addAddresses
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <AddJobCron>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/postedReports/saveMails",
                res,
                _jobCron);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Email Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #3
0
        /* public void Update(Icdo icdo)
         * {
         *   IsRefreshing = true;
         *   var oldIcdo = icdoList
         *       .Where(p => p.id == icdo.id)
         *       .FirstOrDefault();
         *   oldIcdo = icdo;
         *   ICDO = new ObservableCollection<Icdo>(icdoList);
         *   IsRefreshing = false;
         * }*/
        public async Task DeleteJobCron(Configs configs)
        {
            IsRefreshing = true;

            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                IsRefreshing = false;
                await dialogService.ShowMessage("Error", connection.Message);

                return;
            }
            var cookie   = Settings.Cookie; //.Split(11, 33)
            var res      = cookie.Substring(11, 32);
            var response = await apiService.Delete <Configs>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/mailSender/deleteCron/" + configs.id + "?id=@id",
                res);

            if (!response.IsSuccess)
            {
                IsRefreshing = false;
                await dialogService.ShowMessage(
                    "Error",
                    response.Message);

                return;
            }
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            IsRefreshing = false;
        }
        public async void GetRequests()
        {
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }
            var _search = new SearchModel
            {
                id1       = Patient.id,
                maxResult = 50,
                order     = "desc",
                sortedBy  = "request_creation_date",
                status    = "ALL"
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            Debug.WriteLine("********cookie ViewModel*************");
            Debug.WriteLine(cookie);
            var response = await apiService.PostRequest <Request>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/request/searchRequest?mobile=mobile",  ///request/searchByExample
                res,
                _search);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            requestList = (List <Request>)response.Result;
            Requests    = new ObservableCollection <Request>(requestList);
            if (Requests.Count() == 0)
            {
                IsVisible = true;
            }
            else
            {
                IsVisible = false;
            }
        }
Example #5
0
        public async void ActivateInstrument()
        {
            var connection = await apiService.CheckConnection();

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

                return;
            }
            var cookie   = Settings.Cookie; //.Split(11, 33)
            var res      = cookie.Substring(11, 32);
            var response = await apiService.GetAttachmentWithCoockie <Instrument>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/instrument/activate?id=" + Instrument.id,
                res);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            await InstrumentViewModel.GetInstance().Activate(Instrument);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Instrument Activated");
            await PopupNavigation.Instance.PopAsync(true);
        }
        public async void GetAttachments()
        {
            IsRefreshing = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }

            var response = await apiService.GetList <CsvFTP>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/csvFTP/list");

            if (!response.IsSuccess)
            {
                IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            attachmentsList = (List <CsvFTP>)response.Result;
            Attachments     = new ObservableCollection <CsvFTP>(attachmentsList);
            IsRefreshing    = false;
        }
Example #7
0
        private async void LoadSolicitudes()
        {
            this.IsRefreshing = true;

            var connection = await apiService.CheckConnection();

            if (!connection.IsSucess)
            {
                this.IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert("Error", connection.Message, "OK");

                return;
            }
            var urlAPI     = Application.Current.Resources["UrlAPI"].ToString();
            var prefix     = Application.Current.Resources["UrlPrefix"].ToString();
            var controller = Application.Current.Resources["UrlSolicitudesController"].ToString();
            var response   = await this.apiService.GetList <Solicitudes>(urlAPI, prefix, controller);

            if (!response.IsSucess)
            {
                this.IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "OK");

                return;
            }

            var list = (List <Solicitudes>)response.Result;

            this.Solicitudes = new ObservableCollection <Solicitudes>(list);


            this.IsRefreshing = false;
        }
        public async void EditRequestCatalog()
        {
            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(RequestCatalog.code) || string.IsNullOrEmpty(RequestCatalog.description))
            {
                Value = true;
                return;
            }
            if (RequestCatalog.branch == null || RequestCatalog.icdo == null || RequestCatalog.nomenclatura == null)
            {
                Value = true;
                //await Application.Current.MainPage.DisplayAlert("Warning", "Branch is required", "ok");
                return;
            }
            var requestCatalog = new Requestcatalog
            {
                id           = RequestCatalog.id,
                code         = RequestCatalog.code,
                description  = RequestCatalog.description,
                branch       = RequestCatalog.branch,
                icdo         = RequestCatalog.icdo,
                siapec       = RequestCatalog.siapec,
                nomenclatura = RequestCatalog.nomenclatura,
                valid        = RequestCatalog.valid
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

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

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

                return;
            }
            Value = false;
            RequestCatalogViewModel.GetInstance().Update(requestCatalog);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "RequestCatalog Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #9
0
        public async void AddTVA()
        {
            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(Description) || string.IsNullOrEmpty(Code) || string.IsNullOrEmpty(Valeur))
            {
                HasError = true;
                return;
            }
            else
            {
                HasError = false;
            }

            /* if (string.IsNullOrEmpty(Code))
             * {
             *   Value = true;
             *   return;
             * }*/
            var tva = new AddTVA
            {
                code        = Code,
                description = Description,
                value       = Valeur,
                bolla       = Bollo
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <AddTVA>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/tvaCode/save",
                res,
                tva);

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

                return;
            }
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "TVA Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void EditSymptoms()
        {
            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(Symptoms.data.esitCodi) || string.IsNullOrEmpty(Symptoms.data.esitDesc))
            {
                Value = true;
                return;
            }
            var symptoms = new UpdateSymptoms
            {
                id           = Symptoms.data.id,
                esitCodi     = Symptoms.data.esitCodi,
                esitDesc     = Symptoms.data.esitDesc,
                esitColp     = Symptoms.data.esitColp,
                esitDefa     = Symptoms.data.esitDefa,
                esitEspr     = Symptoms.data.esitEspr,
                esitSucc     = Symptoms.data.esitSucc,
                esitLive     = Symptoms.data.esitLive,
                esitPtnm     = Symptoms.data.esitPtnm,
                esitOrdi     = Symptoms.data.esitOrdi,
                esitTipo     = Symptoms.data.esitTipo,
                esitTest     = Symptoms.data.esitTest,
                esitTipoCodi = Symptoms.data.esitTipoCodi
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <UpdateSymptoms>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/diagnosis/updateRootEsit?oldCode=" + Symptoms.data.esitCodi + "&checklistId=14",
                res,
                symptoms);

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

                return;
            }
            Value = false;
            // SymptomsViewModel.GetInstance().Update(Symptoms);
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Symptoms Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #11
0
        public async void GetUsers()
        {
            IsRefreshing = true;
            var connection = await apiService.CheckConnection();

            var cookie = Settings.Cookie;
            var res    = cookie.Substring(11, 32);

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }
            var _role = new Role
            {
                id        = Role.id,
                authority = Role.authority,
                type      = Role.type
            };
            var response = await apiService.PostRole <User>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/user/getUsresByRole",
                res,
                _role);

            if (!response.IsSuccess)
            {
                IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            userList     = (List <User>)response.Result;
            IsRefreshing = false;
            if (userList == null)
            {
                IsVisible = true;
            }
            else
            {
                Users = new ObservableCollection <User>(userList);

                if (Users.Count() == 0)
                {
                    IsVisible = true;
                }
                else
                {
                    IsVisible = false;
                }
            }
        }
        public async void AddContainer()
        {
            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(Description))
            {
                Value = true;
                return;
            }
            if (Valuem3 == 0 || ValueSeaFreight == 0)
            {
                Value = true;
                return;
            }
            if (Currency == null)
            {
                Value = true;
                return;
            }
            var _seaFreight = new SeaFreight
            {
                value    = ValueSeaFreight,
                currency = Currency
            };
            var container = new AddContainer
            {
                description = Description,
                value       = Valuem3,
                seaFreight  = _seaFreight
            };
            var response = await apiService.Save <AddContainer>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/container",
                container);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }

            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("Medial", "Container Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #13
0
        public async void NewAddress()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

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

                return;
            }
            var emailPattern = "^[a-z0-9._-]+@[a-z0-9._-]+\\.[a-z]{2,6}$";

            if (string.IsNullOrEmpty(Email))
            {
                Value = true;
                return;
            }
            if (!String.IsNullOrWhiteSpace(Email) && !(Regex.IsMatch(Email, emailPattern)))
            {
                Value = true;
                return;
            }

            var cookie = Settings.Cookie;
            var res    = cookie.Substring(11, 32);

            var cookieContainer = new CookieContainer();
            var handler         = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };
            var client = new HttpClient(handler);
            var url    = "https://portalesp.smart-path.it/Portalesp/login/resetPassword?email=" + Email;

            Debug.WriteLine("********url*************");
            Debug.WriteLine(url);
            client.BaseAddress = new Uri(url);
            cookieContainer.Add(client.BaseAddress, new Cookie("JSESSIONID", res));
            var response = await client.GetAsync(url);

            if (!response.IsSuccessStatusCode)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.StatusCode.ToString(), "ok");

                return;
            }
            var result = await response.Content.ReadAsStringAsync();

            Debug.WriteLine("********result*************");
            Debug.WriteLine(result);
            Value = false;
            DependencyService.Get <INotification>().CreateNotification(Languages.Notification, Languages.CkeckEmail);
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #14
0
        public async void GetAttachmentRestrict()
        {
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }

            /* var cookie = Settings.Cookie;  //.Split(11, 33)
             * var res = cookie.Substring(11, 32);
             *
             * var cookieContainer = new CookieContainer();
             * var handler = new HttpClientHandler() { CookieContainer = cookieContainer };
             * var client = new HttpClient(handler);
             * cookieContainer.Add(client.BaseAddress, new Cookie("JSESSIONID", res));
             * var uri = "https://portalesp.smart-path.it/Portalesp/request/getAttachmentListRestrict?requestId=50958&clientId=1";
             * //var response = await client.GetAsync(uri);
             * //var result = await response.Content.ReadAsStringAsync();
             * var result = await client.GetStringAsync(uri);
             * AttachmentLists = JsonConvert.DeserializeObject<AttachmentList>(result);*/

            var cookie   = Settings.Cookie; //.Split(11, 33)
            var res      = cookie.Substring(11, 32);
            var response = await apiService.GetAttachmentWithCoockie <AttachmentListRestrict>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/request/getAttachmentListRestrict?requestId=" + Attachment.requests.Select(i => i.id).FirstOrDefault() + "&clientId=" + Attachment.requests.Select(i => i.client.id).FirstOrDefault(), //+ Attachment.requests.Select(i=> i.id ),
                res);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Attachments = (AttachmentListRestrict)response.Result;
        }
        public async void EditCheckList()
        {
            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(CheckList.chlsCodi) || string.IsNullOrEmpty(CheckList.chlsDesc))
            {
                Value = true;
                return;
            }
            var checkList = new CheckList
            {
                id           = CheckList.id,
                chlsCodi     = CheckList.chlsCodi,
                chlsDesc     = CheckList.chlsDesc,
                chlsMnem     = CheckList.chlsMnem,
                chlsTipoCodi = CheckList.chlsTipoCodi,
                chlsTopoCodi = CheckList.chlsTopoCodi,
                chlsAtti     = CheckList.chlsAtti,
                chlsObbl     = CheckList.chlsObbl,
                chlsServCodi = CheckList.chlsServCodi,
                chlsVali     = CheckList.chlsVali,
                chlsVisi     = CheckList.chlsVisi
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

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

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

                return;
            }
            Value = false;
            CheckListViewModel.GetInstance().Update(checkList);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "CheckList Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void EditService()
        {
            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(Ambulatory.code) || string.IsNullOrEmpty(Ambulatory.description))
            {
                Value = true;
                return;
            }
            var _ambulatory = new Ambulatory
            {
                id          = Service.ambulatory.id,
                code        = Service.ambulatory.code,
                description = Service.ambulatory.description,
                zipCode     = Service.ambulatory.zipCode,
                domicile    = Service.ambulatory.domicile,
                residence   = Service.ambulatory.residence,
                phone       = Service.ambulatory.phone,
                tvaCode     = Service.ambulatory.tvaCode
            };
            var _service = new ServiceUpdate
            {
                ambulatory   = _ambulatory,
                usresWrapper = Service.usresWrapper
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

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

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            ServiceViewModel.GetInstance().Update(_ambulatory);
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Service Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void GetPrice()
        {
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }

            if (Supplier == null)
            {
                _searchRequest = new SearchPriceProduct
                {
                    supplierList   = list1.Select(x => x.id).ToList(),
                    validationTime = ValidationTime
                };
            }
            else
            {
                List <int> list2 = new List <int>();
                list2.Add(Supplier.id);
                _searchRequest = new SearchPriceProduct
                {
                    supplierList   = list2,
                    validationTime = ValidationTime
                };
            }
            var response = await apiService.PostPrice <PriceProduct>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/product/prices",
                _searchRequest);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            productList = (List <PriceProduct>)response.Result;
            Product     = new ObservableCollection <PriceProduct>(productList);
            if (Product.Count() == 0)
            {
                IsVisible = true;
            }
            else
            {
                IsVisible = false;
            }
        }
        public async void EditSupplier()
        {
            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(Supplier.code) || string.IsNullOrEmpty(Supplier.description))
            {
                Value = true;
                return;
            }
            if (Supplier.container == null || Supplier.customsDuty == null)
            {
                Value = true;
                return;
            }

            var supplier = new Supplier
            {
                id          = Supplier.id,
                code        = Supplier.code,
                description = Supplier.description,
                country     = Supplier.country,
                container   = Supplier.container,
                customsDuty = Supplier.customsDuty,
                note        = Supplier.note,
                european    = Supplier.european,
                exporter    = Supplier.exporter,
                dutyFree    = Supplier.dutyFree
            };
            var response = await apiService.Put <Supplier>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/supplier",
                supplier);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            SuppliersViewModel.GetInstance().Update(supplier);

            DependencyService.Get <INotification>().CreateNotification("Medial", "Supplier Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #19
0
        public async void AddNewService()
        {
            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(Code) || string.IsNullOrEmpty(Description) || string.IsNullOrEmpty(ZipCode) || string.IsNullOrEmpty(Domicile))
            {
                Value = true;
                return;
            }
            var _ambulatory = new AddAmbulatory
            {
                code        = Code,
                description = Description,
                zipCode     = ZipCode,
                domicile    = Domicile,
                residence   = Residence,
                phone       = Phone,
                tvaCode     = TVACode,
                birthDate   = System.DateTime.Today
            };
            var _service = new Service
            {
                ambulatory   = _ambulatory,
                usresWrapper = SelectedUser
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <Service>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/ambulatory/save",
                res,
                _service);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Service Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #20
0
        public async void EditAddress()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

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

                return;
            }
            var emailPattern = "^[a-z0-9._-]+@[a-z0-9._-]+\\.[a-z]{2,6}$";

            if (string.IsNullOrEmpty(Addresses.addressMail))
            {
                Value = true;
                return;
            }
            if (!String.IsNullOrWhiteSpace(Addresses.addressMail) && !(Regex.IsMatch(Addresses.addressMail, emailPattern)))
            {
                Value = true;
                return;
            }
            var address = new Addresses
            {
                id          = Addresses.id,
                code        = Addresses.code,
                addressMail = Addresses.addressMail
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <Addresses>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/mailSender/updateAddress",
                res,
                address);

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

                return;
            }
            Value = false;

            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Email Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void AddConvention()
        {
            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(SocialReason) || string.IsNullOrEmpty(Discount.ToString()))
            {
                Value = true;
                return;
            }
            if (TVA == null)
            {
                Value = true;
                await Application.Current.MainPage.DisplayAlert("Alert", "TVA is Required", "ok");

                return;
            }
            var convention = new AddConvention
            {
                socialReason       = SocialReason,
                tva                = TVA,
                status             = "AC",
                startValidation    = StartValidation,
                endValidation      = EndValidation,
                discount           = Discount,
                collaboratorNumber = 0
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            await apiService.Save <AddConvention>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/convention/save",
                res,
                convention);

            /* if (!response.IsSuccess)
             * {
             *   await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");
             *   return;
             * }*/
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Convention Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void GetComponent()
        {
            //IsVisible = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }

            var response = await apiService.GetComponentProduct <Product>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/product",
                Product.id,
                "/components");

            if (!response.IsSuccess)
            {
                IsVisible = true;
                //  await Application.Current.MainPage.DisplayAlert("Warning", "List is Empty", "ok");
                return;
            }
            productList = (List <Product>)response.Result;
            ProductObservableCollection = new ObservableCollection <Product>(productList);
            IsVisible = false;

            if (ProductObservableCollection.Count() == 0)
            {
                IsVisible = true;
            }
            else
            {
                IsVisible = false;
            }
        }
Example #23
0
        public async void GetConsentDocument()
        {
            IsRefreshing = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }
            var cookie   = Settings.Cookie; //.Split(11, 33)
            var res      = cookie.Substring(11, 32);
            var response = await apiService.GetListWithCoockie <ConsentDocumentTrue>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/repository/searchSavedDocument?sortedBy=code&order=asc&patientId=" + Patient.id,
                res);

            if (!response.IsSuccess)
            {
                IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            consentDocumentList = (List <ConsentDocumentTrue>)response.Result;
            ConsentDocument     = new ObservableCollection <ConsentDocumentTrue>(consentDocumentList);
            IsRefreshing        = false;
            if (ConsentDocument.Count() == 0)
            {
                IsVisible = true;
            }
            else
            {
                IsVisible = false;
            }
        }
Example #24
0
        public async void AddNewSIAPEC()
        {
            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(Code) || string.IsNullOrEmpty(Description))
            {
                Value = true;
                return;
            }
            if (Branch == null)
            {
                Value = true;
                await Application.Current.MainPage.DisplayAlert("Warning", "Branch is required", "ok");

                return;
            }
            var _icdo = new AddSiapec
            {
                code        = Code,
                description = Description,
                branch      = Branch,
                codRL       = CodRL
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <AddSiapec>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/siapec/save",
                res,
                _icdo);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "SIAPEC Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #25
0
        public async void NewSymptoms()
        {
            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(Description) || string.IsNullOrEmpty(Code))
            {
                Value = true;
                return;
            }
            var symptoms = new AddSymptoms
            {
                esitCodi     = Code,
                esitDesc     = Description,
                esitPtnm     = PTNMN,
                esitOrdi     = Order,
                esitLive     = Level,
                esitSucc     = HasSuccessor,
                esitEspr     = Preselected,
                esitTipoCodi = Branch,
                esitTest     = "<!DOCTYPE html>↵<html>↵<head>↵</head>↵<body>↵<p>" + Template + "</p>↵</body>↵</html>"
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <AddSymptoms>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/diagnosis/saveRootEsit?checklistId=14",
                res,
                symptoms);

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

                return;
            }
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Symptoms Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #26
0
        public async void AddNewInstrument()
        {
            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(Name) || string.IsNullOrEmpty(Description))
            {
                Value = true;
                return;
            }
            if (SelectedType.Key == null)
            {
                await Application.Current.MainPage.DisplayAlert("Error", "Please Select Type", "ok");

                return;
            }
            var _instrument = new AddInstrument
            {
                active      = Active,
                name        = Name,
                description = Description,
                type        = SelectedType.Key
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Save <AddInstrument>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/instrument/save",
                res,
                _instrument);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Instrument Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void EditOffer()
        {
            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(Offer.supplyCondition) || string.IsNullOrEmpty(Offer.paymentCondition) || string.IsNullOrEmpty(Offer.note))
            {
                Value = true;
                return;
            }
            if (Offer.client == null)
            {
                Value = true;
                return;
            }

            var offer = new Offer
            {
                id               = Offer.id,
                number           = Offer.number,
                client           = Offer.client,
                supplyCondition  = Offer.supplyCondition,
                paymentCondition = Offer.paymentCondition,
                date             = Offer.date,
                note             = Offer.note
            };
            var response = await apiService.Put <Offer>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/offer",
                offer);

            /* if (!response.IsSuccess)
             * {
             *   await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");
             *   return;
             * }*/
            Value = false;
            OfferViewModel.GetInstance().Update(offer);

            DependencyService.Get <INotification>().CreateNotification("Medial", "Offer Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void AddUser()
        {
            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(Username) || string.IsNullOrEmpty(Password))
            {
                Value = true;
                return;
            }
            if (SelectedRole == null)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Warning,
                    "Role is required",
                    Languages.Ok);

                return;
            }

            var user = new AddUser
            {
                username = Username,
                password = Password,
                roles    = SelectedRole
            };
            var response = await apiService.Save <AddUser>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/user",
                user);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }

            Value = false;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("Medial", "User Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Example #29
0
        public async void EditIllnessEvent()
        {
            HasError = true;
            var connection = await apiService.CheckConnection();

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

                return;
            }
            if (string.IsNullOrEmpty(IllnessEvent.code) || string.IsNullOrEmpty(IllnessEvent.description))
            {
                HasError = true;
                return;
            }
            else
            {
                HasError = false;
            }
            var icdo = new IllnessEvent
            {
                id          = IllnessEvent.id,
                code        = IllnessEvent.code,
                description = IllnessEvent.description
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

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

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

                return;
            }
            HasError = false;
            IllnessEventViewModel.GetInstance().Update(icdo);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Illness Event Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
        public async void GetAttachmentRestrict()
        {
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    "Error",
                    connection.Message,
                    "Ok");

                await Application.Current.MainPage.Navigation.PopAsync();

                return;
            }

            var cookie   = Settings.Cookie; //.Split(11, 33)
            var res      = cookie.Substring(11, 32);
            var response = await apiService.GetAttachmentWithCoockie <AttachmentListRestrict>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/request/getAttachmentListRestrict?requestId=" + Attachment.requests.Select(r => r.id).FirstOrDefault() + "&clientId=" + Attachment.requests.Select(r => r.client.id).FirstOrDefault(),
                res);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Attachments = (AttachmentListRestrict)response.Result;
            if (Attachments.attachments.Count() == 0)
            {
                IsVisibleStatus = true;
            }
            else
            {
                IsVisibleStatus = false;
            }
        }