Пример #1
0
        // 畅销榜
        protected void SalesData()
        {
            DB     db  = new DB();
            string sql = "select top 10 序号 = row_number() over(order by Sales desc), Id, Name, Price from Book";

            db.LoadExecuteData(sql);
            SalesDataList.DataSource   = db.MyDataSet.Tables[0].DefaultView;
            SalesDataList.DataKeyField = "Id";
            SalesDataList.DataBind();
            db.OffData();
        }
Пример #2
0
        private async Task DeleteSalesDataCommandHandler(SalesDataViewModel salesVm)
        {
            try
            {
                await _salesStatisticsRepository.DeleteItem(salesVm.SalesData);

                SalesDataList.Remove(salesVm);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Пример #3
0
        private async Task GetSalesDataCommandHandler()
        {
            try
            {
                SalesDataList.Clear();
                var predicate = PredicateBuilder.True <SalesData>();
                if (SelectedClassifierType1ViewModel != null)
                {
                    predicate = predicate.And(i => i.Type1_ClassifierId == SelectedClassifierType1ViewModel.Id);
                }

                if (SelectedClassifierType2ViewModel != null)
                {
                    predicate = predicate.And(i => i.Type2_ClassifierId == SelectedClassifierType2ViewModel.Id);
                }

                if (SelectedClassifierType3ViewModel != null)
                {
                    predicate = predicate.And(i => i.Type2_ClassifierId == SelectedClassifierType2ViewModel.Id);
                }

                if (SelectedClassifierType4ViewModel != null)
                {
                    predicate = predicate.And(i => i.Type2_ClassifierId == SelectedClassifierType2ViewModel.Id);
                }

                var data = await _salesStatisticsRepository.GetAll(predicate);


                foreach (var item in data)
                {
                    SalesDataList.Add(new SalesDataViewModel(item));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }