Exemple #1
0
        public async Task GetData()
        {
            try
            {
                var Wait = UserDialogs.Instance.Loading("Wait...", Cancel(), "Cancel", true, MaskType.Black);
                Wait.Show();
                JObject result = await _IAllDataServices.GetAllLadger();

                if (result != null)
                {
                    var type = (int)result["Type"];
                    if (type == 1)
                    {
                        _List = JsonConvert.DeserializeObject <ObservableCollection <Ladger_Class> >(result["Result"].ToString()).ToList();
                        Old_Ladger_ClassList = JsonConvert.DeserializeObject <ObservableCollection <Ladger_Class> >(result["Result"].ToString());
                        if (_List.Count == 0)
                        {
                            await App.Current.MainPage.DisplayAlert("Oops!", "Record Not Found", "Ok");

                            _Request_List = false;
                        }
                        else
                        {
                            _Request_List = true;
                            //Old_Ladger_ClassList = new ObservableCollection<Use_Ladger_Class>();
                            //foreach (var ad in Store_Ladger_ClassList)
                            //{
                            //    Use_Ladger_Class ap = new Use_Ladger_Class();
                            //    if (!string.IsNullOrEmpty(ad.transactionDate))
                            //    {
                            //        ap.Credit = 0;
                            //        ap.Date = Convert.ToDateTime(ad.transactionDate);
                            //        ap.Debit = ad.Debit;
                            //        ap.OutstandingAmount = ad.OutstandingAmount;
                            //        ap.Type = "Transaction";
                            //    }
                            //    else
                            //    {
                            //        ap.Credit = ad.Credit;
                            //        ap.Date = Convert.ToDateTime(ad.createdDate);
                            //        ap.Debit = 0;
                            //        ap.OutstandingAmount = ad.OutstandingAmount;
                            //        ap.Type = "Order";
                            //    }
                            //    Old_Ladger_ClassList.Add(ap);
                            //}
                        }
                    }
                    else
                    {
                        await App.Current.MainPage.DisplayAlert("Error!", (string)result["ResponseMessage"], "Ok");
                    }
                    Wait.Hide();
                }
            }
            catch (Exception ee)
            {
                await App.Current.MainPage.DisplayAlert("Error!", ee.Message, "Ok");
            }
        }