Example #1
0
        // mechanism to get default values for dropdowns
        public async Task <ObservableCollection <AppValues> > GetDefaultValuesAsync(string Category, string parentKey = "")
        {
            // grab data from database
            DbAccessor db     = new DbAccessor();
            var        Source = UtilHelper.ConvertToObservable <AppValues>(db.GetTableItemsObservable <AppValues>().Where(x => x.CatType == Category).ToList());

            // filter list if we just need root parent values.
            if (!string.IsNullOrEmpty(parentKey))
            {
                Source = UtilHelper.ConvertToObservable <AppValues>(Source.Where(x => x.ParentKey == parentKey).ToList());
            }



            // grab the current culture here and set the value field
            var cult = this.GetCurrentCulture();

            if (cult == "ar")
            {
                foreach (var item in Source)
                {
                    item.Value = item.Arabic;
                }
            }
            else
            {
                foreach (var item in Source)
                {
                    item.Value = item.English;
                }
            }

            return(Source);
        }
Example #2
0
        private async void GetDropdownValues()
        {
            // pull from db then pre-populate
            ApiServiceIndividual api = new ApiServiceIndividual();

            _MainList = await api.GetDefaultValuesAsync("Complaints");

            // set root list here
            Cat1List = UtilHelper.ConvertToObservable <AppValues>(_MainList.Where(x => x.ParentKey == "0").ToList());
        }
Example #3
0
        public async Task <ObservableCollection <ComplaintRaised> > GetComplaintsAsync()
        {
            // grab data from database
            DbAccessor db     = new DbAccessor();
            var        Source = db.GetTableItemsObservable <ComplaintRaised>();

            // order by date asc so we see latest first
            var newsource = UtilHelper.ConvertToObservable <ComplaintRaised>(Source.OrderByDescending(x => x.CreateDateCast).ToList());

            return(newsource);
        }