private string load_CLB() { string strRetMsg = "Load CheckListBox failed. Ready."; //fill TREE cbo with current unique trees List <DTO.cboItem> lstUTrees = DAL.get_Unique_Trees(); if (lstUTrees.Count() < 1) { lstUTrees.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs = new BindingSource(); bs.DataSource = lstUTrees; clbTreesToMerge.DataSource = bs; clbTreesToMerge.DisplayMember = "Name"; clbTreesToMerge.ValueMember = "Id"; strRetMsg = "Load CheckListBox succeeded. Ready."; return(strRetMsg); }
private void fill_Cbo() { //fill TREE cbo with current unique trees List <DTO.cboItem> lstUTrees = DAL.get_Unique_Trees(); if (lstUTrees.Count() > 0) { lstUTrees.Insert(0, new DTO.cboItem("Please select a Tree", "0")); } else { lstUTrees.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs = new BindingSource(); bs.DataSource = lstUTrees; cboUTrees.DataSource = bs; cboUTrees.DisplayMember = "Name"; cboUTrees.ValueMember = "Id"; //cboUTrees.SelectionChanged += new SelectionChangedEventHandler(cboUTrees_SelectionChanged); }
private void fill_Cbo() { try { //fill TREE cbo with current unique trees List <DTO.cboItem> lstUTrees = DAL.get_Unique_Trees(); if (lstUTrees.Count() > 0) { lstUTrees.Insert(0, new DTO.cboItem("Please select a Tree to get TreeId", "0")); } else { lstUTrees.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs = new BindingSource(); bs.DataSource = lstUTrees; cboUTrees.DataSource = bs; cboUTrees.DisplayMember = "Name"; cboUTrees.ValueMember = "Id"; //cboUTrees.SelectionChanged += new SelectionChangedEventHandler(cboUTrees_SelectionChanged); //fill CATEGORY cbo with unique categories from DB List <DTO.cboItem> lstUCats = DAL.get_Unique_Leaf_Categories(); if (lstUCats.Count() > 0) { lstUCats.Insert(0, new DTO.cboItem("Please select a Category", "0")); } else { lstUCats.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs2 = new BindingSource(); bs2.DataSource = lstUCats; cboLeafCategory.DataSource = bs2; cboLeafCategory.DisplayMember = "Name"; cboLeafCategory.ValueMember = "Id"; //fill SUB-CATEGORY cbo with unique sub-categories from DB List <DTO.cboItem> lstUSubCats = DAL.get_Unique_Sub_Categories(); if (lstUSubCats.Count() > 0) { lstUSubCats.Insert(0, new DTO.cboItem("Please select a Sub-Category", "0")); } else { lstUSubCats.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs3 = new BindingSource(); bs3.DataSource = lstUSubCats; cboLeafSubCat.DataSource = bs3; cboLeafSubCat.DisplayMember = "Name"; cboLeafSubCat.ValueMember = "Id"; //fill LEAF TYPE cbo with unique leaf Types from DB List <DTO.cboItem> lstLeafTypes = DAL.get_Unique_Leaf_Types(); if (lstLeafTypes.Count() > 0) { lstLeafTypes.Insert(0, new DTO.cboItem("Please select a Leaf Type", "0")); } else { lstLeafTypes.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs4 = new BindingSource(); bs4.DataSource = lstLeafTypes; cboLeafType.DataSource = bs4; cboLeafType.DisplayMember = "Name"; cboLeafType.ValueMember = "Id"; //fill SEARCH cbo with unique leaf NAME from DB List <DTO.cboItem> lstLeafNames = DAL.get_Unique_Leaf_Names(); if (lstLeafNames.Count() > 0) { lstLeafNames.Insert(0, new DTO.cboItem("Please select a Leaf Name", "0")); } else { lstLeafNames.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs5 = new BindingSource(); bs5.DataSource = lstLeafNames; cboSearchName.DisplayMember = "Name"; cboSearchName.ValueMember = "Id"; cboSearchName.DataSource = bs5; //fill SEARCH cbo with unique leaf CATEGORY from DB List <DTO.cboItem> lstLeafCategory = DAL.get_Unique_Leaf_Categories(); if (lstLeafCategory.Count() > 0) { lstLeafCategory.Insert(0, new DTO.cboItem("Please select a Leaf Category", "0")); } else { lstLeafCategory.Insert(0, new DTO.cboItem("None", "0")); } BindingSource bs6 = new BindingSource(); bs6.DataSource = lstLeafCategory; cboSearchCategory.DisplayMember = "Name"; cboSearchCategory.ValueMember = "Id"; cboSearchCategory.DataSource = bs6; } catch (Exception ex) { string crap = "yup"; } txtTreeId.Text = ""; }