Exemplo n.º 1
0
        private void GetSeries()
        {
            ListOfSeries = new ObservableCollection <ComboBox>();
            //if (ProjectBLL.IsSupportedUniversalSelection(JCHVRF.Model.Project.GetProjectInstance))
            //{
            //    dtSeries = pbll.GetOduSeries(JCHVRF.Model.Project.CurrentProject.BrandCode, JCHVRF.Model.Project.CurrentProject.SubRegionCode);
            //}
            //else
            //{
            //    dtSeries = pbll.GetProductTypeData(JCHVRF.Model.Project.CurrentProject.BrandCode, JCHVRF.Model.Project.CurrentProject.SubRegionCode);
            //}

            //foreach (DataRow rowView in dtSeries.Rows)
            //{
            //    ListOfSeries.Add(new ComboBox { DisplayName = Convert.ToString(rowView["ODU_Series"]), Value = Convert.ToString(rowView["ODU_Series"]) });

            //}
            if (CurrentSystem != null)
            {
                DataTable dtSeries = bll.GetOutdoorListStd(CurrentSystem.ProductCategory);

                ListOfSeries = new ObservableCollection <ComboBox>();
                var distinctSeries = dtSeries.AsEnumerable()
                                     .Select(row => new
                {
                    DisplayName = row.Field <string>("ProductSeries"),
                    Value       = row.Field <string>("ProductSeries")
                })
                                     .Distinct();

                foreach (var rowView in distinctSeries)
                {
                    ListOfSeries.Add(new ComboBox {
                        DisplayName = rowView.DisplayName, Value = rowView.Value
                    });
                }

                if (CurrentSystem != null && CurrentSystem.Series != null)
                {
                    this.SelectedSeries = CurrentSystem.Series;
                    if (CurrentSystem.OutdoorItem != null && CurrentSystem.OutdoorItem.Model != null && CurrentSystem.Series != null)
                    {
                        this.SelectedProductSeries = GetProductSeriesByOdu(CurrentSystem.OutdoorItem.Model, CurrentSystem.Series);
                    }
                    else
                    {
                        this.SelectedProductSeries = CurrentSystem.ProductSeries;
                    }
                }
                else
                {
                    if (ListOfSeries != null && ListOfSeries.Count > 0)
                    {
                        this.SelectedSeries = GetSeriesByProductSeriesAndProductCategory(ListOfSeries[0].Value.ToString(), CurrentSystem.ProductCategory);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void GetProductCategory()
        {
            ListProductCategory = new ObservableCollection <string>();
            DataTable dtProductCategory = bll.GetOutdoorListStd();

            foreach (DataRow productcategoryeRow in dtProductCategory.Rows)
            {
                if (!string.IsNullOrEmpty(CommonBLL.StringConversion(productcategoryeRow["ProductCategory"])))
                {
                    if (!this.ListProductCategory.Contains(CommonBLL.StringConversion(productcategoryeRow["ProductCategory"])))
                    {
                        this.ListProductCategory.Add(CommonBLL.StringConversion(productcategoryeRow["ProductCategory"]));
                    }
                }
            }
        }