コード例 #1
0
        private async void NavigateToOrderPage(string obj)
        {
            IsPageEnabled = true;
            if (obj.Equals(AppResources.ResourceManager.GetString("btnupdateContent", AppResources.Culture)))
            {
                await UpdatePatientInfo();
            }
            else
            {
                IsPageEnabled = true;
                if (!Library.KEY_PATIENT_IS_VEG.ToLower().Equals(SelectedPatient.isveg.ToLower()) || !Library.KEY_PATIENT_IS_HALAL.ToLower().Equals(SelectedPatient.ishalal.ToLower()))
                {
                    var response = await PageDialog.DisplayAlertAsync("Meal Prefrence Changed!", "Do you want to Change the (Veg/Nonveg)/(Halal/Non-Halal) Status.", "Yes", "No");

                    if (response)
                    {
                        Library.KEY_PATIENT_IS_VEG   = SelectedPatient.isveg;
                        Library.KEY_PATIENT_IS_HALAL = SelectedPatient.ishalal;
                    }
                    else
                    {
                        IsPageEnabled = false;
                        return;
                    }
                }



                var navParam = new NavigationParameters();

                //navParam.Add("Patient", SelectedPatient);
                Library.patient = SelectedPatient;
                Library.others  = OthersRadio.Where(x => x.IsChecked).FirstOrDefault();
                navParam.Add("Cuisineslist", Cuisines);
                navParam.Add("Allergies", Allergies.Where(x => x.IsChecked).ToList());
                navParam.Add("Ingredients", Ingredients.Where(x => x.IsChecked).ToList());
                navParam.Add("Therapeutics", Therapeutics.Where(x => x.IsChecked).ToList());
                navParam.Add("Cuisines", Cuisines.Where(x => x.IsChecked).ToList());
                navParam.Add("Other", OthersRadio.Where(x => x.IsChecked).FirstOrDefault());
                navParam.Add("Othercheckbox", OthersChecBox.Where(x => x.IsChecked).ToList());

                await NavigationService.NavigateAsync("MealOrderPage", navParam);

                IsPageEnabled = false;
            }
        }
コード例 #2
0
        private void Other_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "IsChecked")
            {
                var checkedData = sender as mstr_others_master;
                if (checkedData.IsChecked)
                {
                    if (checkedData.others_name.Contains("NBM"))
                    {
                        IsNoMealEnable = false;
                    }
                    else
                    {
                        IsNoMealEnable = true;
                    }

                    var checkedQuery = OthersRadio.Where(x => x.IsChecked == true && x.others_name != checkedData.others_name);
                    if (checkedQuery.Any())
                    {
                        checkedQuery.First().IsChecked = false;
                    }
                }
            }
        }
コード例 #3
0
        private async void NavigateToOrderPage(string obj)
        {
            IsPageEnabled = true;
            if (obj.Equals("Update"))
            {
                await UpdatePatientInfo();
            }
            else
            {
                IsPageEnabled = true;


                if (!Library.KEY_PATIENT_IS_VEG.Equals(SelectedPatient.isveg) || !Library.KEY_PATIENT_IS_HALAL.Equals(SelectedPatient.ishalal))
                {
                    var response = await PageDialog.DisplayAlertAsync("Meal Prefrence Changed!", "Do you want to Change the (Veg/Nonveg)/(Halal/Non-Halal) Status.", "Yes", "No");

                    if (response)
                    {
                        Library.KEY_PATIENT_IS_VEG   = SelectedPatient.isveg;
                        Library.KEY_PATIENT_IS_HALAL = SelectedPatient.ishalal;
                    }
                    else
                    {
                        IsPageEnabled = false;
                        return;
                    }
                }

                #region Future_Order

                bool isChangeTher        = CompareStrings(string.IsNullOrEmpty(SelectedPatient.Therapeutic) ? string.Empty : SelectedPatient.Therapeutic, Therapeutics.Where(x => x.IsChecked).Select(x => x.TH_code).ToList());
                bool isChangeAllergy     = CompareStrings(SelectedPatient.Allergies == "0" ? string.Empty : SelectedPatient.Allergies, Allergies.Where(x => x.IsChecked).Select(x => x.ID.ToString()).ToList());
                bool isChangeIngredient  = CompareStrings(string.IsNullOrEmpty(SelectedPatient.Ingredient) ? string.Empty : SelectedPatient.Ingredient, Ingredients.Where(x => x.IsChecked).Select(x => x.ingredient_name).ToList());
                bool isChangeDietTexture = CompareStrings(string.IsNullOrEmpty(SelectedPatient.Diet_Texture) ? string.Empty : SelectedPatient.Diet_Texture, DietTextures.Where(x => x.IsChecked).Select(x => x.diet_texture_name).ToList());
                bool isChangeMealType    = CompareStrings(string.IsNullOrEmpty(SelectedPatient.Meal_Type) ? string.Empty : SelectedPatient.Meal_Type, Cuisines.Where(x => x.IsChecked).Select(x => x.meal_type_name).ToList());

                bool isChange = (isChangeTher || isChangeAllergy || isChangeIngredient || isChangeDietTexture || isChangeMealType);

                if (isChangeMealType && !isChangeTher && !isChangeAllergy && !isChangeIngredient && !isChangeDietTexture)
                {
                    bool resp = await PageDialog.DisplayAlertAsync("", $"Patient's cuisine choice has been changed, \npress OK to proceed", "OK", "Cancel");

                    if (!resp)
                    {
                        IsPageEnabled = false;
                        return;
                    }
                }
                else
                {
                    if (isChange)
                    {
                        if (CrossConnectivity.Current.IsConnected)
                        {
                            string check_order_date = Library.KEY_CHECK_ORDER_DATE;

                            HttpClient          httpClientGet = new System.Net.Http.HttpClient();
                            HttpRequestMessage  request       = new HttpRequestMessage(HttpMethod.Get, Library.URL + "/checkfutureorder/" + check_order_date + "/" + SelectedPatient.ID);
                            HttpResponseMessage response      = await httpClientGet.SendAsync(request);

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

                            if (data != "\"NULL\"" && data != string.Empty)
                            {
                                List <string> alertMsg = new List <string>();


                                if (isChangeTher)
                                {
                                    alertMsg.Add("Therapeutic Condition");
                                }
                                if (isChangeAllergy)
                                {
                                    alertMsg.Add("Allergic Condition");
                                }
                                if (isChangeIngredient)
                                {
                                    alertMsg.Add("Ingredient exclusion");
                                }

                                if (isChangeDietTexture)
                                {
                                    alertMsg.Add("Diet Texture");
                                }
                                if (isChangeMealType)
                                {
                                    alertMsg.Add("Cuisine Choice");
                                }

                                var msgArray = alertMsg.ToArray();
                                var msgStr   = string.Join(",", msgArray);
                                msgStr = msgStr.Replace(",", " and ");

                                var result = await DependencyService.Get <INotify>().ShowAlert("Preference Changed!!", $"Patient’s {msgStr} has been changed. Do you want to delete the future order of this patient?", "Yes", "No", "Cancel");

                                if (result == "Yes")
                                {
                                    dynamic p = new JObject();

                                    p.orderdetailsids = data.Replace("\"", "");
                                    p.system_module   = DependencyService.Get <ILocalize>().GetDeviceName();
                                    p.work_station_IP = DependencyService.Get <ILocalize>().GetIpAddress();

                                    string json = JsonConvert.SerializeObject(p);

                                    var httpClient = new HttpClient();

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

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

                                    if (!string.IsNullOrEmpty(contents))
                                    {
                                        await PageDialog.DisplayAlertAsync("Delete", $"Total Orders deleted : {contents}", "OK");
                                    }
                                }
                                else if (result == "Cancel")
                                {
                                    IsPageEnabled = false;
                                    return;
                                }
                            }
                        }
                        else
                        {
                            IsPageEnabled = false;
                            await PageDialog.DisplayAlertAsync("Error!!", "Unable to change patient settings during offline mode. Please undo the changes and try again", "OK");

                            return;
                        }
                    }
                }

                #endregion

                var navParam = new NavigationParameters();
                navParam.Add("Patient", SelectedPatient);
                navParam.Add("Allergies", Allergies.Where(x => x.IsChecked).ToList());
                navParam.Add("Ingredients", Ingredients.Where(x => x.IsChecked).ToList());
                navParam.Add("Therapeutics", Therapeutics.Where(x => x.IsChecked).ToList());
                navParam.Add("DietTextures", DietTextures.Where(x => x.IsChecked).ToList());
                navParam.Add("Cuisines", Cuisines.Where(x => x.IsChecked).ToList());
                navParam.Add("Other", OthersRadio.Where(x => x.IsChecked).FirstOrDefault());
                navParam.Add("Othercheckbox", OthersChecBox.Where(x => x.IsChecked).ToList());

                await NavigationService.NavigateAsync(nameof(MealOrderPage), navParam);

                IsPageEnabled = false;
            }
        }