Пример #1
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Type"), 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Description"), 170);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Balance"), 65, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Bank Number"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Inactive"), 70);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow      row;
            List <Account> listAccounts = Accounts.GetDeepCopy(false);

            for (int i = 0; i < listAccounts.Count; i++)
            {
                if (!checkInactive.Checked && listAccounts[i].Inactive)
                {
                    continue;
                }
                row = new ODGridRow();
                row.Cells.Add(Lan.g("enumAccountType", listAccounts[i].AcctType.ToString()));
                row.Cells.Add(listAccounts[i].Description);
                if (listAccounts[i].AcctType == AccountType.Asset)
                {
                    row.Cells.Add(Accounts.GetBalance(listAccounts[i].AccountNum, listAccounts[i].AcctType).ToString("n"));
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(listAccounts[i].BankNumber);
                if (listAccounts[i].Inactive)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                if (i < listAccounts.Count - 1 &&        //if not the last row
                    listAccounts[i].AcctType != listAccounts[i + 1].AcctType)
                {
                    row.ColorLborder = Color.Black;
                }
                row.Tag        = listAccounts[i].Clone();
                row.ColorBackG = listAccounts[i].AccountColor;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }