Example #1
0
        private void QueryResultGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            decimal Sum = 0;

            facade.QueryAdvEffect(QueryResultGrid.QueryCriteria as AdvEffectQueryFilter, e.PageSize, e.PageIndex, e.SortField, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                vmList = DynamicConverter <AdvEffectMonitorVM> .ConvertToVMList <List <AdvEffectMonitorVM> >(args.Result.Rows);// args.Result.Rows.conv;

                if (vmList != null && vmList.Count > 0)
                {
                    btnStatistics.IsEnabled = true;
                    decimal allTotalPrice   = 0;// vmList[0].TotalSOAmount.Value;
                    foreach (AdvEffectMonitorVM item in vmList)
                    {
                        if (item.SOAmount.HasValue)
                        {
                            Sum += item.SOAmount.Value;
                        }
                        if (item.TotalSOAmount > 0)
                        {
                            allTotalPrice = item.TotalSOAmount.Value;
                        }

                        decimal SOAmount = (item.SOAmount.HasValue ? item.SOAmount.Value : 0) - (item.RefundAmt.HasValue ? item.RefundAmt.Value : 0);
                        if (SOAmount == 0)
                        {
                            item.ShowSOAmtLevel = "Z";
                        }
                        else if (0 < SOAmount && SOAmount < 100)
                        {
                            item.ShowSOAmtLevel = "A";
                        }
                        else if (100 < SOAmount && SOAmount < 300)
                        {
                            item.ShowSOAmtLevel = "B";
                        }
                        else if (300 < SOAmount && SOAmount < 500)
                        {
                            item.ShowSOAmtLevel = "C";
                        }
                        else if (500 < SOAmount && SOAmount < 800)
                        {
                            item.ShowSOAmtLevel = "D";
                        }
                        else if (800 < SOAmount && SOAmount < 1000)
                        {
                            item.ShowSOAmtLevel = "E";
                        }
                        else if (1000 < SOAmount && SOAmount < 1500)
                        {
                            item.ShowSOAmtLevel = "F";
                        }
                        else if (1500 < SOAmount && SOAmount < 2000)
                        {
                            item.ShowSOAmtLevel = "G";
                        }
                        else if (2000 < SOAmount && SOAmount < 3000)
                        {
                            item.ShowSOAmtLevel = "H";
                        }
                        else if (3000 < SOAmount && SOAmount < 5000)
                        {
                            item.ShowSOAmtLevel = "I";
                        }
                        else if (5000 < SOAmount && SOAmount < 8000)
                        {
                            item.ShowSOAmtLevel = "J";
                        }
                        else if (8000 < SOAmount && SOAmount < 10000)
                        {
                            item.ShowSOAmtLevel = "K";
                        }
                        else
                        {
                            item.ShowSOAmtLevel = "L";
                        }
                    }
                    foreach (var item in vmList)
                    {
                        if (item.IsPhone == null)
                        {
                            item.IsPhone = NYNStatus.No;
                        }
                    }
                    QueryResultGrid.ItemsSource = vmList;
                    QueryResultGrid.TotalCount  = args.Result.TotalCount;
                    tips = string.Format(ResNewsInfo.Content_Statistics, Sum, allTotalPrice);
                }
                else
                {
                    QueryResultGrid.ItemsSource = vmList;
                    QueryResultGrid.TotalCount  = 0;
                    btnStatistics.IsEnabled     = false;
                }
            });
        }