Пример #1
0
        public void SetPopupFilters(string[] excludedcols, DataTable dt)
        {
            try
            {
                foreach (string colname in excludedcols)
                {
                    if (!DictFilterPopup.ContainsKey(colname))
                    {
                        DictFilterPopup.Add(colname, new FilterPopupModel()
                        {
                            ColumnName = colname, Caption = dt.Columns[colname].Caption, IsApplied = false
                        });
                    }

                    FilterPopupModel s       = new FilterPopupModel();
                    bool             success = DictFilterPopup.TryGetValue(colname, out s);

                    foreach (DataRow dr in dt.Rows)
                    {
                        if (s.FilterData.Count(x => x.Description == dr[colname].ToString()) == 0)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = dr[colname].ToString(), IsChecked = true
                            });
                        }
                    }
                    s.IsApplied = false;
                }
            }
            catch { }
        }
Пример #2
0
        private void InitializePopupFilters()
        {
            try
            {
                foreach (string colname in Constants.MasterProjectsPopupList)
                {
                    if (!DictFilterPopup.ContainsKey(colname))
                    {
                        DictFilterPopup.Add(colname, new FilterPopupModel()
                        {
                            ColumnName = colname, Caption = SalesFunnel.Columns[colname].Caption, IsApplied = false
                        });
                    }

                    FilterPopupModel s       = new FilterPopupModel();
                    bool             success = DictFilterPopup.TryGetValue(colname, out s);

                    if (colname == "SalesDivision")
                    {
                        foreach (ModelBaseVM ev in BusinessUnits)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = (ev.Name == "PT")
                            });
                        }
                        s.IsApplied = true;
                    }
                    else
                    if (colname == "IndustrySegment")
                    {
                        FullyObservableCollection <IndustrySegmentModel> mktsegs = GetIndustrySegments();
                        foreach (IndustrySegmentModel ev in mktsegs)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "KPM")
                    {
                        s.FilterData.Add(new FilterPopupDataModel()
                        {
                            Description = "Yes", IsChecked = true
                        });
                        s.FilterData.Add(new FilterPopupDataModel()
                        {
                            Description = "No", IsChecked = true
                        });
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "DifferentiatedTechnology")
                    {
                        s.FilterData.Add(new FilterPopupDataModel()
                        {
                            Description = "Yes", IsChecked = true
                        });
                        s.FilterData.Add(new FilterPopupDataModel()
                        {
                            Description = "No", IsChecked = true
                        });
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "Application")
                    {
                        FullyObservableCollection <ApplicationModel> appcats = GetApplications();

                        foreach (ApplicationModel ev in appcats)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "ProjectStatus")
                    {
                        FullyObservableCollection <ModelBaseVM> salesstatuses = GetSalesStatuses();

                        foreach (ModelBaseVM ev in salesstatuses)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = Config.DefaultSalesStatuses.Contains(ev.ID.ToString()) ? true : false
                            });
                        }
                        s.IsApplied = true;
                    }
                    else
                    if (colname == "ProjectType")
                    {
                        foreach (ProjectTypeModel ev in ProjectTypes)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "SMCode")
                    {
                        FullyObservableCollection <SMCodeModel> smcodes = GetSMCodes();

                        foreach (SMCodeModel ev in smcodes)
                        {
                            if (s.FilterData.Count(x => x.Description == ev.Name) == 0)
                            {
                                s.FilterData.Add(new FilterPopupDataModel()
                                {
                                    Description = ev.Name, IsChecked = true
                                });
                            }
                        }
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "SalesFunnelStage")
                    {
                        foreach (ActivityStatusCodesModel ev in ActivityStatusCodes)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.PlaybookDescription, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "NewBusinessCategory")
                    {
                        FullyObservableCollection <ModelBaseVM> newbusinesscategories = GetNewBusinessCategories();
                        foreach (ModelBaseVM ev in newbusinesscategories)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    //else
                    //if (colname == "Priority")
                    //{
                    //    FullyObservableCollection<ModelBaseVM> priorities = GetPriorities();

                    //    foreach (ModelBaseVM ev in priorities)
                    //        s.FilterData.Add(new FilterPopupDataModel() { Description = ev.Name, IsChecked = true });
                    //    s.IsApplied = false;
                    //}
                    else
                    {
                        if (colname == "Customer" || colname == "UserName")
                        {
                            foreach (DataRow dr in SalesFunnel.Rows)
                            {
                                if (s.FilterData.Count(x => x.Description == dr[colname].ToString()) == 0 && !string.IsNullOrEmpty(dr[colname].ToString()))
                                {
                                    s.FilterData.Add(new FilterPopupDataModel()
                                    {
                                        Description = dr[colname].ToString(), IsChecked = true
                                    });
                                }
                            }
                            s.IsApplied = false;
                        }
                    }
                }
            }
            catch {
            }
        }
        private void InitializePopupFilters()
        {
            try
            {
                foreach (string colname in Constants.StatusReportPopupList)
                {
                    if (!DictFilterPopup.ContainsKey(colname))
                    {
                        DictFilterPopup.Add(colname, new FilterPopupModel()
                        {
                            ColumnName = colname, Caption = Data.Columns[colname].Caption, IsApplied = false
                        });
                    }

                    FilterPopupModel s       = new FilterPopupModel();
                    bool             success = DictFilterPopup.TryGetValue(colname, out s);

                    if (colname == "SalesDivision")
                    {
                        foreach (ModelBaseVM ev in BusinessUnits)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = (ev.Name == "PT")
                            });
                        }
                        s.IsApplied = true;
                    }
                    else
                    if (colname == "KPM")
                    {
                        s.FilterData.Add(new FilterPopupDataModel()
                        {
                            Description = "Yes", IsChecked = true
                        });
                        s.FilterData.Add(new FilterPopupDataModel()
                        {
                            Description = "No", IsChecked = true
                        });
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "ProjectStatus")
                    {
                        foreach (EnumValue ev in EnumerationLists.ProjectStatusTypesList)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Description, IsChecked = (ev.Description == "Active")
                            });
                        }
                        s.IsApplied = true;
                    }
                    else
                    if (colname == "ProjectType")
                    {
                        foreach (ProjectTypeModel ev in ProjectTypes)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.Name, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    else
                    if (colname == "SalesFunnelStage")
                    {
                        foreach (ActivityStatusCodesModel ev in ActivityStatusCodes)
                        {
                            s.FilterData.Add(new FilterPopupDataModel()
                            {
                                Description = ev.PlaybookDescription, IsChecked = true
                            });
                        }
                        s.IsApplied = false;
                    }
                    else
                    {
                        if (colname == "Customer" || colname == "UserName")
                        {
                            foreach (DataRow dr in Data.Rows)
                            {
                                if (s.FilterData.Count(x => x.Description == dr[colname].ToString()) == 0 && !string.IsNullOrEmpty(dr[colname].ToString()))
                                {
                                    s.FilterData.Add(new FilterPopupDataModel()
                                    {
                                        Description = dr[colname].ToString(), IsChecked = true
                                    });
                                }
                            }
                            s.IsApplied = false;
                        }
                    }
                }
            }
            catch { }
        }