예제 #1
0
        async Task UploadResponse()
        {
            //Add global fields
            _response.User_ID        = UserSettings.UserId;
            _response.Farm_ID        = App.SelectedFarm.ID;
            _response.Survey_Version = App.LatestSurvey.Version;

            var serviceResponse = await ApiManager.UploadResponse(_response);

            if (!serviceResponse.IsSuccessStatusCode)
            {
                PageDialog.Alert("Unable to upload the assessment currently!", "Error", "OK");
            }
            else
            {
                PageDialog.Toast("Assessment Saved");
                //Reshuffle assessment data
                if (App.LatestSurveyResponse != null)
                {
                    App.PreviousSurveyResponse = App.LatestSurveyResponse;
                }
                App.LatestSurveyResponse = _response;

                //Empty MonkeyCache.
                Barrel.Current.Empty(key: "GetResponseByFarmId" + App.SelectedFarm.ID);
            }
        }
예제 #2
0
        private async Task GetUser(string userToken)
        {
            try
            {
                var apiresponse = await ApiManager.GetUserByToken(userToken);

                if (apiresponse.IsSuccessStatusCode || (apiresponse.StatusCode.Equals(HttpStatusCode.NotModified)))
                {
                    var response = await apiresponse.Content.ReadAsStringAsync();

                    var json = await Task.Run(() => JsonConvert.DeserializeObject <UserDto>(response));

                    User = json;
                }
                else
                {
                    await PageDialog.AlertAsync("Unable to retrieve user data", "Error", "OK");
                }
            }
            catch (Exception ex)
            {
                MetricsManager.TrackException("Error getting cowstatus data", ex);
                await PageDialog.AlertAsync("Unable to retrieve user data", "Error", "OK");
            }
        }
예제 #3
0
        public async Task Login(bool isLDap = false)
        {
            bool isInternetConnected = NetworkInterface.GetIsNetworkAvailable();

            // checking if user name and password are not blank
            if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
            {
                try
                {
                    if (Connectivity.NetworkAccess == NetworkAccess.Internet)
                    {
                        await checkLogin(isLDap);
                    }
                    else
                    {
                        await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("msg10", AppResources.Culture), "OK");
                    }
                }
                catch (Exception ex)
                {
                    ErrorText = ex.Message;
                }
            }
            else
            {
                ErrorText = "Please enter user name and password.";
            }
        }
        internal async void NavigateToInfoPage(mstr_patient_info patient)
        {
            IsPageEnabled = true;

            if (patient.is_care_giver == "true")
            {
                IsPageEnabled = false;
                return;
            }


            if (Library.KEY_USER_ROLE == "FSA")
            {
                if (!String.IsNullOrEmpty(patient.Last_Order_by))
                {
                    AssignPatientInfo(patient);
                }
                else
                {
                    IsPageEnabled = false;
                    await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("msg6", AppResources.Culture), "OK");

                    return;
                }
            }
            else
            {
                AssignPatientInfo(patient);
            }

            await NavigationService.NavigateAsync("PatientInformationPage", new NavigationParameters { { "PatientInfo", patient } });

            IsPageEnabled = false;
        }
예제 #5
0
        private async Task InserOrderLocal(mstr_meal_order_local p)
        {
            try
            {
                var db = DependencyService.Get <IDBInterface>().GetConnection();


                db.RunInTransaction(() =>
                {
                    db.Insert(p);
                });
                MessagingCenter.Send <App, string>((App)Xamarin.Forms.Application.Current, "LocalOrder", "lorder");

                var action = await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("yoff", AppResources.Culture), "Yes", "No");

                if (action)
                {
                    await NavigationService.GoBackAsync(new NavigationParameters { { "NewOrder", "order" } });
                }
                else
                {
                    await NavigationService.NavigateAsync("../../../");
                }
            }
            catch (Exception)
            {
            }
        }
        async Task GetSurvey()
        {
            var surveyResponse = await ApiManager.GetLatestSurvey();

            if (surveyResponse.IsSuccessStatusCode || surveyResponse.StatusCode == HttpStatusCode.NotModified)
            {
                try
                {
                    var content = await surveyResponse.Content.ReadAsStringAsync();

                    var survey = await Task.Run(() => JsonConvert.DeserializeObject <SurveyDto>(content));

                    if (survey != null && (App.LatestSurvey == null || App.LatestSurvey.Version < survey.Version))
                    {
                        var fileHelper = new FileHelper();
                        App.LatestSurvey = survey;
                        // Save the survey to the local filesystem
                        await fileHelper.SaveAsync(Config.SurveyFileName, survey);
                    }
                }
                catch (Exception ex)
                {
                    MetricsManager.TrackException("Error reading survey json", ex);
                }
            }
            else
            {
                await PageDialog.AlertAsync("Unable to retrieve survey data", "Error", "OK");
            }
        }
 internal async void GetPatientsList(string param)
 {
     Patients = new ObservableCollection <mstr_patient_info>();
     if (Connectivity.NetworkAccess == NetworkAccess.Internet)
     {
         if (param.Equals("WardNo"))
         {
             await GetPatientsFromServer();
         }
         else
         {
             if (string.IsNullOrEmpty(PatientName))
             {
                 await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("mss1", AppResources.Culture), "OK");
             }
             else
             {
                 DisplayPatientListOnPatientsearch();
             }
         }
     }
     else
     {
         GetOfflinePatients(param);
     }
 }
예제 #8
0
        private void FrameTapped()
        {
            if (Image.FullPath != "user_picture.png") //if it's different to the default image
            {
                bool   reportCreated = true;
                Report report        = new Report()
                {
                    Location    = Location,
                    Title       = Title,
                    Subtitle    = Subtitle,
                    Image       = Image.FullPath,
                    Description = Description
                };
                reportList.Add(report);

                PageDialog.DisplayAlertAsync("El reporte ha sido creado exitosamente.",
                                             "", "Ok");

                //Wiping out the elements of the Report view:
                Title       = "";
                Subtitle    = "";
                Description = "";

                NavigationParameters parameters = new NavigationParameters();
                parameters.Add("report", report);
                parameters.Add("reportCreated", reportCreated);

                NavigationService.GoBackAsync(parameters);
            }
            else
            {
                PageDialog.DisplayAlertAsync("No se puede completar el reporte",
                                             "Debe de agregar una imagen", "Ok");
            }
        }
        /// <summary>
        /// Get the information when the user presses the button
        /// </summary>
        private async void OnGetAPICommand()
        {
            if (this.IsBusy)
            {
                return;
            }
            this.IsBusy = true;

            PageDialog.ShowLoading("Comprobando Datos");

            var NameApi = await ApiManager.NameOfEndPoint();

            if (!NameApi.IsSuccessStatusCode)
            {
                await PageDialog.AlertAsync("No se pudo obtener los datos", "Error", "Aceptar");

                this.IsBusy = false;
                this.PageDialog.HideLoading();
                return;
            }
            var jsonNameResponse = await NameApi.Content.ReadAsStringAsync();

            var NameResponse = await Task.Run(() => JsonConvert.DeserializeObject <GetApiViewModel>(jsonNameResponse));

            this.PageDialog.HideLoading();
            this.IsBusy = false;
        }
        private async void DoSaveFarm()
        {
            //Add Farmtype from picker and user id from UserSettings
            if (SelectedType != null)
            {
                _currentFarm.FarmType_ID = SelectedType.ID;
            }
            _currentFarm.User_ID = UserSettings.UserId;

            FarmValidator    validator = new FarmValidator();
            ValidationResult result    = validator.Validate(_currentFarm);

            if (result.IsValid)
            {
                try
                {
                    if (!Config.TestMode)
                    {
                        await RunSafe(SaveFarm());
                    }
                    await NavigationService.GoBackAsync();
                }
                catch (Exception ex)
                {
                    await PageDialog.AlertAsync("Unable to save farm data", "Error", "OK");

                    MetricsManager.TrackException("Error saving farm details", ex);
                }
            }
            else
            {
                ValidationErrorMessage = result.Errors[0].ErrorMessage;
                ShowValidationErrors   = true;
            }
        }
        public async Task GetCaregiverData()
        {
            try
            {
                if (Connectivity.NetworkAccess == NetworkAccess.Internet)
                {
                    //string URL = Library.KEY_http + Library.KEY_SERVER_IP + "/" + Library.KEY_SERVER_LOCATION + "/sodexo.svc";
                    try
                    {
                        //start progessring
                        IsPageEnabled     = true;
                        caregiver_details = new ObservableCollection <mstr_caregiver_mealorder_details>();

                        HttpClient httpClient = new System.Net.Http.HttpClient();

                        DateTime dt = SelectedDate;

                        string format_date = dt.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture);

                        HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Library.URL + "/" + Library.METHODE_CAREGIVERMENUITEMS + "/" +
                                                                            SelectedOrderDetail.pateint_id + "/" + SelectedMealTime.ID + "/" + SelectedOrderDetail.OrderedID + "/" + format_date);
                        HttpResponseMessage response = await httpClient.SendAsync(request);

                        var data = await response.Content.ReadAsStringAsync();

                        // JArray jarray = JArray.Parse(data);

                        caregiver_details = JsonConvert.DeserializeObject <ObservableCollection <mstr_caregiver_mealorder_details> >(data);
                        //meal_delivered= JsonConvert.DeserializeObject<mstr_mealdelivered>(data);

                        var paymentmode = 0;

                        foreach (var item in caregiver_details)
                        {
                            TotalAmount          = TotalAmount + Convert.ToDouble(item.amount);
                            paymentmode          = item.mode_of_payment;
                            item.paymentmodename = _displayPaymentModeDetails.QueryTable().First(x => x.ID == item.mode_of_payment).payment_mode_name;
                        }
                        IsPageEnabled = false;
                    }
                    catch (Exception excp)
                    {
                        // stop progressring
                        IsPageEnabled = false;
                    }
                    IsPageEnabled = false;
                }
                else
                {
                    await PageDialog.DisplayAlertAsync("Alert!!", "Server is not accessible, please check internet connection.", "OK");

                    IsPageEnabled = false;
                }
            }
            catch (Exception excp)
            {
                // stop progressring
                IsPageEnabled = false;
            }
        }
예제 #12
0
 private async void GetPatientsList(string param)
 {
     Patients = new ObservableCollection <mstr_patient_info>();
     if (CrossConnectivity.Current.IsConnected)
     {
         if (param.Equals("WardNo"))
         {
             await GetPatientsFromServer();
         }
         else
         {
             if (string.IsNullOrEmpty(PatientName))
             {
                 await PageDialog.DisplayAlertAsync("Alert!!", "Please select patient name from suggestions first", "OK");
             }
             else
             {
                 DisplayPatientListOnPatientsearch();
             }
         }
     }
     else
     {
         GetOfflinePatients(param);
     }
 }
예제 #13
0
        private async Task InserOrderLocal(mstr_meal_order_local p)
        {
            try
            {
                var db = DependencyService.Get <IDBInterface>().GetConnection();


                db.RunInTransaction(() =>
                {
                    db.Insert(p);
                });
                MessagingCenter.Send <App, string>((App)Xamarin.Forms.Application.Current, "LocalOrder", "lorder");

                var action = await PageDialog.DisplayAlertAsync("Alert!!", " Your order is Saved Locally ,it will be confirmed when Internet is available and syncing from menu bar. Do you want to place order for same patient?", "Yes", "No");

                if (action)
                {
                    await NavigationService.GoBackAsync(new NavigationParameters { { "NewOrder", "order" } });
                }
                else
                {
                    await NavigationService.NavigateAsync("../../../");
                }
            }
            catch (Exception)
            {
            }
        }
        private async void Therapeutic_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "IsChecked")
            {
                var checkedTH = sender as mstr_therapeutic;
                if (checkedTH.IsChecked)
                {
                    var checkedQuery = Therapeutics.Where(x => x.IsChecked == true && !string.IsNullOrEmpty(x.TH_Condition) &&
                                                          x.TH_Condition == checkedTH.TH_Condition && x.TH_code != checkedTH.TH_code);

                    if (checkedQuery.Any())
                    {
                        var str1 = $"You have already selected {checkedQuery.First().TH_Condition} option , Do you want to remove {checkedQuery.FirstOrDefault().TH_code} option.";

                        var response = await PageDialog.DisplayAlertAsync("Alert!!", str1, "YES", "NO");

                        if (response)
                        {
                            var previous = Therapeutics.Where(x => x.TH_code == checkedQuery.FirstOrDefault().TH_code).FirstOrDefault();
                            previous.IsChecked = false;
                        }
                        else
                        {
                            checkedTH.IsChecked = false;
                        }
                    }
                }
            }
        }
        private async Task UpdatePatientInfo()
        {
            IsPageEnabled = true;

            string isAllergy         = string.Empty;
            var    selectedAllergies = Allergies.Where(x => x.IsChecked);

            foreach (var item in selectedAllergies)
            {
                isAllergy += item.ID + ",";
            }

            isAllergy = isAllergy.TrimEnd(',');

            dynamic p = new JObject();

            p.halal       = SelectedPatient.ishalal  ? 1 : 0;
            p.isallergies = isAllergy;
            p.isdiabetic  = 1;
            p.isveg       = SelectedPatient.isveg  ? 1 : 0;
            p.patientid   = SelectedPatient.ID.ToString();

            string stringPayload = JsonConvert.SerializeObject(p);

            var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");


            using (var httpClient = new System.Net.Http.HttpClient())
            {
                var httpResponse = new System.Net.Http.HttpResponseMessage();
                // Do the actual request and await the response


                // httpResponse = new Uri(URL + "/" + Library.METHODE_UPDATE_ORDER); //replace your Url
                httpResponse = await httpClient.PostAsync(Library.URL + "/setpatientprofile", httpContent);


                // display a message jason conversion
                //var message2 = new MessageDialog(httpResponse.ToString());
                //await message2.ShowAsync();
                //var httpResponse = await httpClient.PostAsync(URL + "/" + Library.METHODE_SAVEORDER, httpContent);

                // If the response contains content we want to read it!
                if (httpResponse.Content != null)
                {
                    var responseContent = await httpResponse.Content.ReadAsStringAsync();

                    if (responseContent == "true")
                    {
                        await PageDialog.DisplayAlertAsync("Alert!!", "Updated Patient Information", "OK");

                        await NavigationService.GoBackAsync();
                    }
                }
            }

            IsPageEnabled = false;
        }
예제 #16
0
        private async Task GetMakupsAsync()
        {
            var makeUpModels = new ObservableCollection <MakeUpModel>();
            List <MakeUpModel> makeUpsResponse = await makeupLocalDbService.GetMakeupLocalDataAsync();

            if (makeUpsResponse is null || makeUpsResponse.Count == 0)
            {
                await PageDialog.AlertAsync("Unable to get data", "Error", "Ok");
            }
예제 #17
0
        public void LoadData()
        {
            MstrWards = new List <mstr_ward_details>(_mstrWardRepo.QueryTable().Where(x => x.ward_type_name != "Staff" && x.status_id == 1).OrderBy(y => y.ID));

            if (string.IsNullOrEmpty(Library.KEY_SYNC_NOTIFICATION))
            {
                PageDialog.DisplayAlertAsync("Alert!!", "Please sync 'Sync Masters' and 'Sync Menu Items' from drawer menu to proceed further.", "OK");
                Library.KEY_SYNC_NOTIFICATION = "1";
            }
        }
        /// <summary>
        /// Nos redirije a la lista de usuarios
        /// </summary>
        /// <param name="obj"></param>
        private async void OnListUsersCommand(object obj)
        {
            if (GlobalSetting.GetInstance().Users == null)
            {
                await PageDialog.AlertAsync("No fue posible acceder sin datos, recarga otra vez la pagina", "Error", "Aceptar");

                return;
            }
            await _navigationService.NavigateTo($"///users");
        }
        private async void CancelBtn_Clicked(object sender, EventArgs e)
        {
            var selectedRecord = (sender as Button).BindingContext as mstr_meal_history;

            if (string.IsNullOrEmpty(selectedRecord.remarks))
            {
                var msg = Library.KEY_USER_LANGUAGE == "Thai" ? "กรุณาใส่ข้อสังเกต" : "Please Enter Remarks";
                await PageDialog.DisplayAlertAsync("Error!!", msg, "OK");

                return;
            }
            else
            {
                dynamic p = new JObject();
                p.Id              = selectedRecord.Id;//id;
                p.createdby       = selectedRecord.createdby;
                p.meal_detail_id  = selectedRecord.meal_detail_id;
                p.mealtimeid      = selectedRecord.mealtimeid;
                p.mealtimename    = selectedRecord.mealtimename;
                p.orderdate       = selectedRecord.orderdate;
                p.remark          = selectedRecord.remarks;
                p.ward_bed        = "";
                p.wardid          = "";
                p.work_station_IP = DependencyService.Get <ILocalize>().GetIpAddress();
                p.system_module   = DependencyService.Get <ILocalize>().GetDeviceName();//GetMachineNameFromIPAddress(p.work_station_IP);

                string json = JsonConvert.SerializeObject(p);

                var httpClient = new HttpClient();

                var result = await httpClient.PostAsync($"{Library.URL}/OrderCanceled", new StringContent(json, Encoding.UTF8, "application/json"));

                var contents = await result.Content.ReadAsStringAsync();


                if (contents == "true")
                {
                    await PageDialog.DisplayAlertAsync("Alertt!!", AppResources.ResourceManager.GetString("ml1", AppResources.Culture), "OK");

                    HistoryList.ItemsSource = new List <mstr_meal_history>();
                    PatientMealHistoryList.Remove(selectedRecord);
                    HistoryList.ItemsSource = PatientMealHistoryList;
                    IsChanged = true;
                }
                else
                {
                    await DisplayAlert("", AppResources.ResourceManager.GetString("ml12", AppResources.Culture), "OK");
                }

                if (!PatientMealHistoryList.Any())
                {
                    await Navigation.PopAllPopupAsync();
                }
            }
        }
        public async void SearchMethod()
        {
            if (SelectedBed == null || SelectedMealTime == null)
            {
                await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("selbedmeal", AppResources.Culture), "OK");

                return;
            }

            await GetMealDeliveredData();
        }
예제 #21
0
 async Task TakePhotoAsync()
 {
     if (MediaPicker.IsCaptureSupported)
     {
         Image = await MediaPicker.CapturePhotoAsync();
     }
     else
     {
         await PageDialog.DisplayAlertAsync("ERROR", "Dispositivo no tiene camara disponible", "OK");
     }
 }
예제 #22
0
        private async Task GetMealOrderStatus()
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected == true)
                {
                    try
                    {
                        MealOrderStatusCollection = new ObservableCollection <meal_order_status>();


                        HttpClient httpClient = new System.Net.Http.HttpClient();

                        DateTime dt = SelectedDate;

                        string format_date             = dt.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture);
                        var    SelectedMealStatusIndex = StatusList.IndexOf(StatusList.First(x => x == SelectedMealStatus));

                        HttpRequestMessage  request  = new HttpRequestMessage(HttpMethod.Get, Library.URL + "/" + Library.METHODE_GETMEALORDERSTATUS + "/" + SelectedWard.ID + "/" + format_date + "/" + SelectedMealTime.ID + "/" + SelectedMealStatusIndex.ToString() + "/" + Library.KEY_USER_SiteCode);
                        HttpResponseMessage response = await httpClient.SendAsync(request);

                        var data = await response.Content.ReadAsStringAsync();

                        MealOrderStatusCollection = JsonConvert.DeserializeObject <ObservableCollection <meal_order_status> >(data);
                        if (!MealOrderStatusCollection.Any())
                        {
                            IsPageEnabled = false;
                            DependencyService.Get <INotify>().ShowToast("No records found!!");
                            return;
                        }

                        int srNo = 1;
                        foreach (var item in MealOrderStatusCollection)
                        {
                            item.SrNo = srNo++;
                        }

                        // stop
                    }
                    catch (Exception excp)
                    {
                        // stop progressring
                    }
                }
                else
                {
                    await PageDialog.DisplayAlertAsync("Alert!!", "Server is not accessible, please check internet connection.", "OK");
                }
            }
            catch (Exception excp)
            {
                // stop progressring
            }
        }
        public async void SearchMethod()
        {
            if (SelectedBed == null || SelectedMealTime == null)
            {
                await PageDialog.DisplayAlertAsync("Alert!!", "Please select Bed & MealTime to continue..", "OK");

                return;
            }

            await GetMealDeliveredData();
        }
예제 #24
0
        private async Task ConfirmPlaceOrder()
        {
            var action = await PageDialog.DisplayAlertAsync(AppResources.ResourceManager.GetString("mlc", AppResources.Culture), AppResources.ResourceManager.GetString("mlc2", AppResources.Culture), "Yes", "No");

            if (action)
            {
                IsPageEnabled = true;
                await InsertIntoMealOrder();

                IsPageEnabled = false;
            }
        }
예제 #25
0
        private void ShowDialog(string title, string content, string redoButtonText, Action buttonRedoAction, MaterialDesignThemes.Wpf.PackIconKind icon)
        {
            PageDialog dialog = new PageDialog();

            dialog.InfoTitle           = title;
            dialog.InfoContent         = content;
            dialog.Icon                = icon;
            dialog.Tab                 = currentTab;
            dialog.Button_Redo.Content = redoButtonText;
            dialog.ButtonRedoAction    = buttonRedoAction;
            ((MainWindow)App.Current.MainWindow).ConnectionTabHelper.ShowDialogOnReceiveWindow(currentTab, dialog.PopupDialog);
        }
예제 #26
0
        private async Task GenerateMealHistory(int ID, string mealtype)
        {
            try
            {
                mstr_meal_history meal = null;
                ObservableCollection <mstr_meal_history> dataList = new ObservableCollection <mstr_meal_history>();

                string     URL        = Library.URL + "/" + Library.METHODE_SHOWPATIENTMEALDETAILSBYID + "/" + Convert.ToInt32(ID) + "/" + mealtype + "/" + Library.KEY_USER_ccode + "/" + Library.KEY_USER_regcode + "/" + Library.KEY_USER_siteid;
                var        uri        = new Uri(URL);
                HttpClient httpClient = new System.Net.Http.HttpClient();
                // HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Library.URL + "/" + Library.METHODE_SHOWPATIENTMEALDETAILSBYID + "/" + Convert.ToInt32(ID) + "/" + mealtype + "/" + Library.KEY_USER_ccode + "/" + Library.KEY_USER_regcode + "/" + Library.KEY_USER_siteid);
                // HttpResponseMessage response = await httpClient.SendAsync(request);

                // var data = await response.Content.ReadAsStringAsync();

                var data = await httpClient.GetStringAsync(uri);

                JArray jarray = JArray.Parse(data);
                if (jarray.Count == 0)
                {
                    await PageDialog.DisplayAlertAsync("Alert!!", "There is no meal history for this patient.", "OK");

                    IsPageEnabled = false;
                    return;
                }

                for (int i = 0; i < jarray.Count; i++)
                {
                    JObject row = JObject.Parse(jarray[i].ToString());
                    meal = new mstr_meal_history
                    {
                        beveragesid  = string.IsNullOrEmpty(row["beveragesid"].ToString())? "NA": row["beveragesid"].ToString(),
                        dessertid    = string.IsNullOrEmpty(row["dessertid"].ToString()) ? "NA" : row["dessertid"].ToString(),
                        entreeid     = string.IsNullOrEmpty(row["entreeid"].ToString()) ? "NA" : row["entreeid"].ToString(),
                        juiceid      = string.IsNullOrEmpty(row["juiceid"].ToString()) ? "NA" : row["juiceid"].ToString(),
                        orderdate    = row["orderdate"].ToString(),
                        remarkid     = string.IsNullOrEmpty(row["remarkid"].ToString()) ? "NA" : row["remarkid"].ToString(),
                        soupid       = string.IsNullOrEmpty(row["soupid"].ToString()) ? "NA" : row["soupid"].ToString(),
                        status       = string.IsNullOrEmpty(row["status"].ToString()) ? "NA" : row["status"].ToString(),
                        addonid      = string.IsNullOrEmpty(row["addonid"].ToString()) ? "NA" : row["addonid"].ToString(),
                        mealoptionid = string.IsNullOrEmpty(row["mealoptionid"].ToString()) ? "NA" : row["mealoptionid"].ToString()
                    };
                    dataList.Add(meal);
                }
                PatientMealHistoryList = new List <mstr_meal_history>(dataList);
                IsPageEnabled          = false;
                await navigation.PushPopupAsync(new MealInfoPopUp(dataList, mealtype));
            }
            catch (Exception)
            {
                IsPageEnabled = false;
            }
        }
 private async void FillMealTime()
 {
     try
     {
         var db = DependencyService.Get <IDBInterface>().GetConnection();
         MealTimeList = new ObservableCollection <mstr_meal_time>(db.Query <mstr_meal_time>("Select * From mstr_meal_time where status_id ='1' order by ID"));
     }
     catch (Exception exp)
     {
         await PageDialog.DisplayAlertAsync("Alert!!", exp.Message, "OK");
     }
 }
        public void LoadData()
        {
            MstrWards = new List <mstr_ward_details>(_mstrWardRepo.QueryTable().Where(x => x.ward_type_name != "Staff" && x.status_id == 1).OrderBy(y => y.ID));



            if (string.IsNullOrEmpty(Library.KEY_SYNC_NOTIFICATION))
            {
                PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("msg4", AppResources.Culture), "OK");
                Library.KEY_SYNC_NOTIFICATION = "1";
            }
        }
예제 #29
0
        private async Task ConfirmPlaceOrder()
        {
            var action = await PageDialog.DisplayAlertAsync("Meal confirmation!", "Do you want to confirm order?", "Yes", "No");

            if (action)
            {
                IsPageEnabled = true;
                await InsertIntoMealOrder();

                IsPageEnabled = false;
            }
        }
예제 #30
0
        private async Task UpdatePatientInfo()
        {
            IsPageEnabled = true;

            string isAllergy         = string.Empty;
            var    selectedAllergies = Allergies.Where(x => x.IsChecked);

            foreach (var item in selectedAllergies)
            {
                isAllergy += item.ID + ",";
            }

            isAllergy = isAllergy.TrimEnd(',');

            dynamic p = new JObject();

            p.halal       = SelectedPatient.ishalal == "True" ? 1 : 0;
            p.isallergies = isAllergy;
            p.isdiabetic  = 1;
            p.isveg       = SelectedPatient.isveg == "True" ? 1 : 0;
            p.patientid   = SelectedPatient.ID.ToString();

            string stringPayload = JsonConvert.SerializeObject(p);

            var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");


            using (var httpClient = new System.Net.Http.HttpClient())
            {
                // Do the actual request and await the response

                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, $"{Library.URL}/setpatientprofile/{p.patientid}/{p.isveg}/{p.halal}/{p.isallergies}/{p.isdiabetic}");

                HttpResponseMessage response = await httpClient.SendAsync(request);


                // If the response contains content we want to read it!
                if (response.Content != null)
                {
                    var responseContent = await response.Content.ReadAsStringAsync();

                    if (responseContent == "true")
                    {
                        await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("pio", AppResources.Culture), "OK");

                        await NavigationService.GoBackAsync();
                    }
                }
            }

            IsPageEnabled = false;
        }