private void listStockGroup(int lvl) { try { grdList.Rows.Clear(); StockGroupDB3 sgdb = new StockGroupDB3(); List <stockgroup3> sgroup = sgdb.getStockGroupDetails(lvl); int i = 1; foreach (stockgroup3 sg in sgroup) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["LineNo"].Value = i; grdList.Rows[grdList.RowCount - 1].Cells["GroupCode"].Value = sg.GroupCode; grdList.Rows[grdList.RowCount - 1].Cells["GroupDescription"].Value = sg.GroupDescription; grdList.Rows[grdList.RowCount - 1].Cells["CreateTime"].Value = sg.CreateTime; grdList.Rows[grdList.RowCount - 1].Cells["Creator"].Value = sg.CreateUser; i++; } } catch (Exception ex) { MessageBox.Show("Error in Stock Group Listing"); } try { enableBottomButtons(); pnlList.Visible = true; btnNew.Visible = false; } catch (Exception ex) { } }
public string getGroupCode() { string gc = ""; StockGroupDB3 sdb = new StockGroupDB3(); List <stockgroup3> LSGroup = sdb.getStockGroupDetails(lvl); SortedSet <string> set = new SortedSet <string>(); try { foreach (stockgroup3 sg in LSGroup) { set.Add(sg.GroupCode); } gc = set.Max; } catch (Exception ex) { } if (Convert.ToInt32(gc) == 0) { gc = "10";// group coe start with 10 } return((Convert.ToInt32(gc) + 1).ToString()); }