public ComboSource(CategoryCollections collection)
 {
     ProjectTypeCombo    = new ObservableCollection <Item>();
     ChurchDistrictCombo = new ObservableCollection <string>(collection.ChurchDistrict);
     SignFilterCombo     = new ObservableCollection <string>();
     FillOtheCombos(collection);
 }
Пример #2
0
        public void BindCategory()
        {
            CategoryController  controller = new CategoryController();
            CategoryCollections collection = controller.GetCategoryList();

            ddlCategory.DisplayMember = "CategoryName";
            ddlCategory.ValueMember   = "CategoryID";
            ddlCategory.DataSource    = collection;
            ddlCategory.SelectedIndex = 0;
        }
        private void FillOtheCombos(CategoryCollections collection)
        {
            foreach (var item in collection.ProjectType)
            {
                ProjectTypeCombo.Add(new Item(item));
            }

            SignFilterCombo.Add("=");
            SignFilterCombo.Add(">");
            SignFilterCombo.Add(">=");
            SignFilterCombo.Add("<");
            SignFilterCombo.Add("<=");
        }
        public CategoryCollections GetCategoryList()
        {
            CategoryCollections collection = new CategoryCollections();
            IDataReader         reader     = DataAccess.SelectList();

            Category cat = new Category();

            cat.CategoryID   = 0;
            cat.CategoryName = "Select Category";
            collection.Add(cat);

            while (reader.Read())
            {
                Category category = new Category();
                category.CategoryID   = Convert.ToInt32(reader["category_id"]);
                category.CategoryName = Convert.ToString(reader["category_name"]);

                collection.Add(category);
            }
            return(collection);
        }