//Group Mapping public static ListView getListViewForStockGroup(int lvl) { ListView lv = new ListView(); try { lv.View = View.Details; lv.LabelEdit = true; lv.AllowColumnReorder = true; lv.CheckBoxes = true; lv.FullRowSelect = true; lv.GridLines = true; lv.Sorting = System.Windows.Forms.SortOrder.Ascending; lv.Columns.Add("Select", -2, HorizontalAlignment.Left); lv.Columns.Add("Group Code", -2, HorizontalAlignment.Left); lv.Columns.Add("Group Name", -2, HorizontalAlignment.Left); StockGroupDB sdb = new StockGroupDB(); List <stockgroup> groups = sdb.getStockGroupDetails(lvl); foreach (stockgroup sg in groups) { ListViewItem item = new ListViewItem(); item.Checked = false; item.SubItems.Add(sg.GroupCode.ToString()); item.SubItems.Add(sg.GroupDescription); lv.Items.Add(item); } } catch (Exception ex) { } return(lv); }
public static void fillGroupValueCombo(System.Windows.Forms.ComboBox cmb, int level) { cmb.Items.Clear(); try { StockGroupDB sgdb = new StockGroupDB(); List <stockgroup> ValueList = sgdb.getStockGroupDetails(level); foreach (stockgroup sg in ValueList) { cmb.Items.Add(sg.GroupCode + "-" + sg.GroupDescription); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }