示例#1
0
        internal async void GetPatientInfo(string value)
        {
            PatientName = value;
            var temp = new List <string>();

            if (CrossConnectivity.Current.IsConnected == true)
            {
                try
                {
                    HttpClient httpClient = new System.Net.Http.HttpClient();

                    dynamic p = new JObject();
                    p.Patient_Name = value;
                    p.Site_Code    = Library.KEY_USER_SiteCode;

                    string stringPayload = JsonConvert.SerializeObject(p);

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

                    HttpResponseMessage response = await httpClient.PostAsync(Library.URL + "/Searchpatient", httpContent);

                    // HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Library.URL + "/Searchpatient/" + value + "/" + Library.KEY_USER_SiteCode);
                    // HttpResponseMessage response = await httpClient.SendAsync(request);

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

                    var namelist = JsonConvert.DeserializeObject <ObservableCollection <dynamic> >(data);

                    foreach (var item in namelist)
                    {
                        string name = item.Patient_Name;
                        temp.Add(name);
                    }
                    PatientDatas = new List <string>(temp);

                    if (!PatientDatas.Any())
                    {
                        PatientDatas = new List <string> {
                            "No Results"
                        }
                    }
                    ;
                }
                catch (Exception)
                {
                }
            }
            else
            {
                var data = _patientRepo.QueryTable().Where(x => x.Patientname.ToLower().Contains(value.ToLower()));
                foreach (var item in data)
                {
                    PatientDatas.Add(item.Patientname);
                }
            }
        }
        private void AssignPatientInfo(mstr_patient_info patient)
        {
            Library.KEY_PATIENT_IS_HALAL = patient.ishalal_tab;
            Library.KEY_PATIENT_IS_VEG   = patient.isveg_tab;
            Library.KEY_ORDER_DATE       = SelectedDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
            Library.KEY_CHECK_ORDER_DATE = SelectedDate.ToString("dd-MM-yyyy", CultureInfo.InvariantCulture);

            var id = Convert.ToInt32(patient.Ward_ID);

            Library.KEY_PATIENT_WARD_TYPE_ID = _mstrWardRepo.QueryTable().FirstOrDefault(x => x.ID == id).ward_type;
        }
        internal async void GetPatientInfo(string value)
        {
            PatientName = value;
            var temp = new List <string>();

            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                try
                {
                    HttpClient httpClient = new System.Net.Http.HttpClient();

                    dynamic p = new JObject();
                    p.Patient_Name = value;
                    p.Site_Code    = Library.KEY_USER_SiteCode;


                    var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(p));

                    // Wrap our JSON inside a StringContent which then can be used by the HttpClient class
                    var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");

                    var response = await httpClient.PostAsync($"{Library.URL}/Searchpatient", httpContent);

                    //HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Library.URL + "/Searchpatient/" + value + "/" + Library.KEY_USER_SiteCode);
                    //HttpResponseMessage response = await httpClient.SendAsync(request);

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

                    JArray jarray = JArray.Parse(data);

                    var namelist = JsonConvert.DeserializeObject <ObservableCollection <dynamic> >(data);

                    for (int i = 0; i < jarray.Count; i++)
                    {
                        temp.Add(jarray[i].Value <string>("Patient_Name"));
                    }

                    PatientDatas = new List <object>(temp);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                var data = _patientRepo.QueryTable().Where(x => x.Patientname.ToLower().Contains(value.ToLower()));

                foreach (var item in data)
                {
                    PatientDatas.Add(item.Patientname);
                }
            }
        }
        private void InitializeMealType(mstr_patient_info patient)
        {
            var mealTypes = _mealTypeRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.meal_type_name);

            foreach (var mealType in mealTypes)
            {
                if (Convert.ToBoolean(patient.ishalal) && mealType.ID == 1)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(SelectedPatient.Meal_Type))
                {
                    var _mealTypesname = SelectedPatient.Meal_Type.Split(',');
                    foreach (var _mealTypename in _mealTypesname)
                    {
                        if (mealType.meal_type_name == _mealTypename)
                        {
                            mealType.IsChecked = true;
                        }
                    }
                }

                Cuisines.Add(mealType);
            }
        }
        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;
            }
        }
示例#6
0
        private void InitializeMealType(mstr_patient_info patient)
        {
            var tempMealTypes = new List <mstr_meal_type>();
            var mealTypes     = _mealTypeRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.meal_type_name);

            foreach (var mealType in mealTypes)
            {
                if (!string.IsNullOrEmpty(SelectedPatient.Meal_Type))
                {
                    var _mealTypesname = SelectedPatient.Meal_Type.Split(',');
                    foreach (var _mealTypename in _mealTypesname)
                    {
                        if (mealType.meal_type_name == _mealTypename)
                        {
                            mealType.IsChecked = true;
                        }
                    }
                }

                tempMealTypes.Add(mealType);
            }
            Device.BeginInvokeOnMainThread(() =>
            {
                Cuisines = new ObservableCollection <mstr_meal_type>(tempMealTypes);
            });
        }
 private void PopulateBedData(mstr_ward_details SelectedWard)
 {
     BedDetails = new ObservableCollection <mstr_bed_details>
                  (
         _mstrBedRepo.QueryTable().Where(x => x.ward_id == SelectedWard.ID && x.status_id == 1)
                  );
     BedDetails.Insert(0, new mstr_bed_details {
         bed_no = "All"
     });
     SelectedBed = BedDetails.First();;
 }
        public override void Initialize(INavigationParameters parameters)
        {
            base.Initialize(parameters);


            if (parameters.ContainsKey("PatientInfo"))
            {
                OthersRadio   = new ObservableCollection <mstr_others_master>();
                OthersChecBox = new ObservableCollection <mstr_others_master>();
                Allergies     = new ObservableCollection <mstr_allergies_master>();
                Ingredients   = new ObservableCollection <mstr_ingredient>();
                Therapeutics  = new ObservableCollection <mstr_therapeutic>();
                DietTextures  = new ObservableCollection <mstr_diet_texture>();
                Cuisines      = new ObservableCollection <mstr_meal_type>();


                SelectedPatient = parameters["PatientInfo"] as mstr_patient_info;
                var fluids = new ObservableCollection <mstr_fluid_master>(_fluidmasterRepo.QueryTable().Where(x => x.status_id == 1).ToList());
                fluids.Insert(0, new mstr_fluid_master {
                    ID = 0, fluid_name = "No"
                });

                FluidList     = new ObservableCollection <mstr_fluid_master>(fluids);
                SelectedFluid = string.IsNullOrEmpty(SelectedPatient.FluidInfo) ? FluidList.First() : FluidList.Where(x => x.fluid_name == SelectedPatient.FluidInfo).First();



                SelectedPatient.PropertyChanged += SelectedPatient_PropertyChanged;

                if (string.IsNullOrEmpty(SelectedPatient.Allergies) || SelectedPatient.Allergies == "NA" || SelectedPatient.Allergies == "0")
                {
                    IsFAGeneral = RadioButtonList[1];
                }
                else
                {
                    IsFAGeneral = RadioButtonList[0];
                }

                var Others = _OthersRepo.QueryTable().OrderBy(x => x.others_name);
                foreach (var other in Others.Where(x => x.status_id == 0).Take(8))
                {
                    other.PropertyChanged += Other_PropertyChanged;
                    OthersRadio.Add(other);
                }

                foreach (var item in Others.Where(x => x.status_id == 1))
                {
                    OthersChecBox.Add(item);
                }

                var allergies = _AllergyRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.allergies_name);
                foreach (var item in allergies)
                {
                    if (!string.IsNullOrEmpty(SelectedPatient.Allergies))
                    {
                        var foodAllergies = SelectedPatient.Allergies.Split(',');
                        foreach (var id in foodAllergies)
                        {
                            var allergyID = Convert.ToInt32(id);
                            if (item.ID == allergyID)
                            {
                                item.IsChecked = true;
                            }
                        }
                    }
                    Allergies.Add(item);
                }



                var ingredients = _ingredientRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.ingredient_name);
                foreach (var item in ingredients)
                {
                    if (!string.IsNullOrEmpty(SelectedPatient.Ingredient))
                    {
                        var _Ingredient = SelectedPatient.Ingredient.Split(',');
                        foreach (var name in _Ingredient)
                        {
                            if (item.ingredient_name == name)
                            {
                                item.IsChecked = true;
                            }
                        }
                    }
                    Ingredients.Add(item);
                }

                var therapeutics = _therapeuticsRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.TH_code);
                foreach (var therapeutic in therapeutics)
                {
                    if (!string.IsNullOrEmpty(SelectedPatient.Therapeutic))
                    {
                        var _Therapeutics = SelectedPatient.Therapeutic.Split(',');
                        foreach (var th_code in _Therapeutics)
                        {
                            if (therapeutic.TH_code == th_code)
                            {
                                therapeutic.IsChecked = true;
                            }
                        }
                    }
                    therapeutic.PropertyChanged += Therapeutic_PropertyChanged;
                    Therapeutics.Add(therapeutic);
                }

                var textures = _dietTextureRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.diet_texture_name);
                foreach (var item in textures)
                {
                    if (!string.IsNullOrEmpty(SelectedPatient.Diet_Texture))
                    {
                        var _textures = SelectedPatient.Diet_Texture.Split(',');
                        foreach (var name in _textures)
                        {
                            if (item.diet_texture_name == name)
                            {
                                item.IsChecked = true;
                            }
                        }
                    }
                    DietTextures.Add(item);
                }

                InitializeMealType(SelectedPatient);
            }
        }
示例#9
0
        public void OfflineOrderCount()
        {
            var localOrder = _orderlocalRepo.QueryTable();

            OrderCount = localOrder.Count();
        }
示例#10
0
 public TableQuery <mstr_meal_order_local> GetTable()
 {
     return(_orderLocalRepo.QueryTable());
 }
示例#11
0
        public async static Task SyncNow(IGenericRepo <mstr_meal_order_local> orderlocalRepo, IGenericRepo <mstr_meal_time> mealtimeRepo, IPageDialogService pageDialog)
        {
            Library library = new Library();
            //string URL = Library.KEY_http + Library.KEY_SERVER_IP + "/" + Library.KEY_SERVER_LOCATION + "/sodexo.svc";
            var localOrders = orderlocalRepo.QueryTable();

            foreach (var item in localOrders)
            {
                var mealtime = mealtimeRepo.QueryTable().FirstOrDefault(x => x.ID == item.meal_time_id && x.status_id == 1);

                string time = DateTime.Now.ToString("HH:mm");
                //DateTime lateformat= DateTime.ParseExact(late_cut_off, "HH:mm",
                //                                    CultureInfo.InvariantCulture);
                DateTime lateformat = Convert.ToDateTime(mealtime.late_cut_off_start_time, CultureInfo.InvariantCulture);
                DateTime dtFromDate = DateTime.ParseExact(mealtime.cut_off_start_time, "HH:mm", CultureInfo.InvariantCulture);
                DateTime dtToDate   = DateTime.ParseExact(time, "HH:mm", CultureInfo.InvariantCulture);

                var parameterDate = DateTime.ParseExact(item.order_date, "dd/MM/yyyy", CultureInfo.InvariantCulture);

                var todaysDate = DateTime.Today;

                if ((dtToDate > lateformat && DateTime.Now.Date.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) == item.order_date) || parameterDate < todaysDate)
                {
                    orderlocalRepo.Delete(item.autoid.ToString());
                }
                else
                {
                    bool Check_order_result = await getfirstorder(item.P_id);

                    if (Check_order_result || Library.KEY_USER_ROLE == "Nurse" || Library.KEY_USER_ROLE == "Nurse+FSA")
                    {
                        await CheckOrder(item.order_date, item.P_id);

                        if (!string.IsNullOrEmpty(rid))// delete it if it is blank
                        {
                            int  id       = Convert.ToInt32(rid);
                            bool response = await Check_Order_Taken(item.order_date, item.P_id, mealtime.meal_name.Trim(), id);

                            if (!response)
                            {
                                item.order_id = id;
                                // Serialize our concrete class into a JSON String
                                var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(item));

                                // Wrap our JSON inside a StringContent which then can be used by the HttpClient class
                                var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");

                                // display a message jason conversion
                                //var message1 = new MessageDialog("Data is converted in json.");
                                //await message1.ShowAsync();

                                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 + "/" + Library.METHODE_UPDATE_ORDER, httpContent);



                                    // If the response contains content we want to read it!
                                    await CheckOrderReaponse(orderlocalRepo, item, httpResponse, pageDialog);
                                }
                            }
                            else
                            {
                                orderlocalRepo.Delete(item.autoid.ToString());
                            }
                        }
                        else
                        {
                            int id = String.IsNullOrEmpty(rid) ? 0 : Convert.ToInt32(rid);

                            bool response = await Check_Order_Taken(item.order_date, item.P_id, mealtime.meal_name.Trim(), id);

                            if (!response)
                            {
                                var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(item));

                                // Wrap our JSON inside a StringContent which then can be used by the HttpClient class
                                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 + "/" + Library.METHODE_SAVEORDER, httpContent);


                                    var orderResponse = await CheckOrderReaponse(orderlocalRepo, item, httpResponse, pageDialog);
                                }
                            }
                            else
                            {
                                orderlocalRepo.Delete(item.autoid.ToString());
                            }
                        }
                    }
                }
            }
        }
示例#12
0
        public override void Initialize(INavigationParameters parameters)
        {
            base.Initialize(parameters);

            if (parameters.ContainsKey("PatientInfo"))
            {
                OthersRadio   = new ObservableCollection <mstr_others_master>();
                OthersChecBox = new ObservableCollection <mstr_others_master>();
                Allergies     = new ObservableCollection <mstr_allergies_master>();
                Ingredients   = new ObservableCollection <mstr_ingredient>();
                Therapeutics  = new ObservableCollection <mstr_therapeutic>();
                Cuisines      = new ObservableCollection <mstr_meal_type>();

                SelectedPatient = parameters["PatientInfo"] as mstr_patient_info;

                SelectedPatient.FluidInfo = string.IsNullOrEmpty(SelectedPatient.FluidInfo) ? "NA" : SelectedPatient.FluidInfo;


                var tempOthers = new List <mstr_others_master>();
                var Others     = _OthersRepo.QueryTable().Where(x => x.status_id == 0).OrderBy(x => x.ID);
                foreach (var other in Others)
                {
                    other.PropertyChanged += Other_PropertyChanged;
                    tempOthers.Add(other);
                }


                var TempOthersRadio = new ObservableCollection <mstr_others_master>(tempOthers);

                var naOther = new mstr_others_master
                {
                    ID          = 0,
                    others_name = "NA",
                };
                naOther.PropertyChanged += Other_PropertyChanged;

                TempOthersRadio.Add(naOther);
                OthersRadio = new ObservableCollection <mstr_others_master>(TempOthersRadio);

                foreach (var item in Others.Where(x => x.status_id == 1))
                {
                    OthersChecBox.Add(item);
                }

                //var tempAllergies = new List<mstr_allergies_master>();
                var allergies = _AllergyRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.allergies_name);
                //foreach (var item in allergies)
                //{
                //    if (!string.IsNullOrEmpty(SelectedPatient.Allergies))
                //    {
                //        var foodAllergies = SelectedPatient.Allergies.Split(',');
                //        foreach (var id in foodAllergies)
                //        {
                //            var allergyID = Convert.ToInt32(id);
                //            if (item.ID == allergyID)
                //            {
                //                item.IsChecked = true;
                //            }
                //        }
                //    }
                //    tempAllergies.Add(item);
                //}


                Allergies = new ObservableCollection <mstr_allergies_master>(allergies);



                var tempIngredients = new List <mstr_ingredient>();
                var ingredients     = _ingredientRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.ingredient_name);
                foreach (var item in ingredients)
                {
                    if (!string.IsNullOrEmpty(SelectedPatient.Ingredient))
                    {
                        var _Ingredient = SelectedPatient.Ingredient.Split(',');
                        foreach (var name in _Ingredient)
                        {
                            if (item.ingredient_name == name)
                            {
                                item.IsChecked = true;
                            }
                        }
                    }
                    tempIngredients.Add(item);
                }


                Ingredients = new ObservableCollection <mstr_ingredient>(tempIngredients);


                var tempTherapeutics = new List <mstr_therapeutic>();
                var therapeutics     = _therapeuticsRepo.QueryTable().Where(x => x.status_id == 1).OrderBy(y => y.TH_code);
                foreach (var therapeutic in therapeutics)
                {
                    if (!string.IsNullOrEmpty(SelectedPatient.Therapeutic))
                    {
                        var _Therapeutics = SelectedPatient.Therapeutic.Split(',');
                        foreach (var th_code in _Therapeutics)
                        {
                            if (therapeutic.TH_code == th_code)
                            {
                                therapeutic.IsChecked = true;
                            }
                        }
                    }
                    //therapeutic.PropertyChanged += Therapeutic_PropertyChanged;
                    tempTherapeutics.Add(therapeutic);
                }

                Therapeutics = new ObservableCollection <mstr_therapeutic>(tempTherapeutics);

                InitializeMealType(SelectedPatient);
            }
        }