private void listAccountGroup(int lvl) { try { grdList.Rows.Clear(); AccountGroupDB agdb = new AccountGroupDB(); List <accountgroup> agroup = agdb.getAccountGroupDetails(lvl); int i = 1; foreach (accountgroup cg in agroup) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["LineNo"].Value = i; grdList.Rows[grdList.RowCount - 1].Cells["GroupCode"].Value = cg.GroupCode; grdList.Rows[grdList.RowCount - 1].Cells["GroupDescription"].Value = cg.GroupDescription; grdList.Rows[grdList.RowCount - 1].Cells["CreateTime"].Value = cg.CreateTime; grdList.Rows[grdList.RowCount - 1].Cells["Creator"].Value = cg.CreateUser; i++; } } catch (Exception ex) { MessageBox.Show("Error in Account Group Listing"); } try { enableBottomButtons(); pnlList.Visible = true; btnNew.Visible = false; } catch (Exception ex) { } }
public string getGroupCode() { string gc = ""; AccountGroupDB adb = new AccountGroupDB(); List <accountgroup> LCGroup = adb.getAccountGroupDetails(lvl); SortedSet <string> set = new SortedSet <string>(); try { foreach (accountgroup cg in LCGroup) { set.Add(cg.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()); }