コード例 #1
0
        internal async void ScanDeliveredOD(string orderid, string orderedID)
        {
            Boolean status = false;

            if (orderid == orderedID)
            {
                var        patientid   = MealDeliveredCollection.FirstOrDefault(x => x.OrderedID.ToString() == orderid);
                var        mealtime_id = SelectedMealTime.ID;
                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_QRVERIFIED + "/" + patientid.pateint_id + "/" + orderid + "/" + mealtime_id + "/" + format_date);

                //HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, URL + "/" + Library.METHODE_QRVERIFIED + "/" + patientid + "/" + tagid + "/" + mealtime_id + "/" + format_date);
                HttpResponseMessage response = await httpClient.SendAsync(request);

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

                //dynamic data = JsonConvert.DeserializeObject<dynamic>(await response.Content.ReadAsStringAsync());

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

                var list = JsonConvert.DeserializeObject <List <Scan_verify> >(data);

                if (list.Count > 0)
                {
                    status = list[0].is_verifed;
                }

                //status = Convert.ToBoolean(data.is_verifed);

                //status = data.is_verifed;

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

                if (status)
                {
                    await GetMealDeliveredData();
                }
            }
            else
            {
                await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("scanned_orderid_not_match", AppResources.Culture), "OK");
            }
        }
コード例 #2
0
        public async Task SendDelivered_request()
        {
            //bool status = false;
            try
            {
                for (int i = 0; i < MealDeliveredCollection.Count; i++)
                {
                    mstr_mealdelivered mealdelivered = MealDeliveredCollection.ElementAt(i);
                    if (mealdelivered.is_checked)
                    {
                        string order_id  = mealdelivered.OrderedID.ToString();
                        string mealtime  = mealdelivered.MealTime;
                        string nullvalue = "";

                        string meatype   = mealtime;
                        string meal_time = "";
                        if (meatype.ToLowerInvariant() == "Breakfast".ToLowerInvariant())
                        {
                            meal_time = "BF";
                        }
                        else if (meatype.ToLowerInvariant() == "Lunch".ToLowerInvariant())
                        {
                            meal_time = "LH";
                        }
                        else if (meatype.ToLowerInvariant() == "Dinner".ToLowerInvariant())
                        {
                            meal_time = "DN";
                        }
                        else
                        {
                            meal_time = meatype;
                        }
                        // String url = Gloabal.URL + Gloabal.METHODE_SETDELIVEREDSTATUS + "/" + orderid + "/" + Uri.encode(mealtime) + "/" + mealtimeid + "/" + paymentmode_id + "/" + Uri.encode(payment_remark);

                        //--------POST-----------
                        dynamic p = new JObject();
                        p.MealTime        = meal_time;
                        p.meal_time_id    = Convert.ToString(SelectedMealTime.ID);
                        p.mode_of_payment = 0;
                        p.orderId         = order_id;
                        p.payment_remark  = nullvalue;
                        // var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(p));
                        string stringPayload = 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");

                        // 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();

                            httpResponse = await httpClient.PostAsync(Library.URL + "/" + Library.METHODE_SETDELIVEREDSTATUS, httpContent);

                            if (httpResponse.Content != null)
                            {
                                var responseContent = await httpResponse.Content.ReadAsStringAsync();

                                success = true;
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                await PageDialog.DisplayAlertAsync("Alert!!", exp.Message, "OK");

                //await DisplayAlert("", AppResources.ResourceManager.GetString(excp.Message, CultureInfo.CurrentCulture), "OK");
            }
        }
コード例 #3
0
        private async void UpdateOrder()
        {
            bool ischecked = false;

            if (IsCareGiver)
            {
                if (MealDeliveredCollection.Where(x => x.is_checked).Count() == 0)
                {
                    await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("yc", CultureInfo.CurrentCulture), "OK");

                    return;
                }

                if (MealDeliveredCollection.Where(x => x.is_checked).Count() > 1)
                {
                    await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("yc", CultureInfo.CurrentCulture), "OK");

                    return;
                }

                SelectedOrderDetail          = MealDeliveredCollection.FirstOrDefault(x => x.is_checked);
                SelectedOrderDetail.ward_bed = SelectedOrderDetail.Ward + "-" + SelectedOrderDetail.Bed;

                // displaying patient information on caregiver popup


                if (IsCareGiver)
                {
                    await GetCaregiverData();

                    var ui = new CaregiverODPopup(caregiver_details.FirstOrDefault(), this);
                    ui.BindingContext = SelectedOrderDetail;
                    await _iNavigation.PushPopupAsync(ui, false);
                }
                else
                {
                    await PageDialog.DisplayAlertAsync("Alert", "Please select record first.", "Ok");
                }
            }
            else
            {
                for (int i = 0; i < MealDeliveredCollection.Count; i++)
                {
                    mstr_mealdelivered mealdelivered = MealDeliveredCollection.ElementAt(i);
                    if (mealdelivered.is_checked)
                    {
                        ischecked = true;
                        break;
                    }
                }

                if (ischecked)
                {
                    await SendDelivered_request();

                    if (success)
                    {
                        await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("delivered_message", AppResources.Culture), "OK");
                    }

                    await GetMealDeliveredData();

                    //await PageDialog.DisplayAlertAsync("Alert!!", AppResources.ResourceManager.GetString("delivered_message", CultureInfo.CurrentCulture), "OK");

                    //await DisplayAlert(AppResources.ResourceManager.GetString("alert", CultureInfo.CurrentCulture), AppResources.ResourceManager.GetString("delivered_message", CultureInfo.CurrentCulture), "OK");
                }
                else
                {
                    await PageDialog.DisplayAlertAsync("Alert", "Please select record first.", "Ok");
                }

                //}
            }
        }