Exemplo n.º 1
0
        public void addAccountBtn_Click(object sender, EventArgs e)
        {
            _view = (ChartofAccountsForm)((Button)sender).FindForm();
            int row = _view.Grid().Rows.Count;


            if (!System.Text.RegularExpressions.Regex.IsMatch(_view.Name, "^[a-zA-Z0-9]"))
            {
                _view.showErrorMessage("Invalid group name");
            }

            else
            {
                var parentGroup = systemModel.Groups.Find(Convert.ToInt32(_view.getGroupID()));

                MasterAccount account = new MasterAccount();
                account.name          = _view.getMasterAccountName();
                account.openingAmount = _view.openingAmount;
                account.closingAmount = 0;
                account.Group         = parentGroup;


                systemModel.MasterAccounts.Add(account);
                systemModel.SaveChanges();


                _view.addRow(row, account.ID, account.name, (double)account.openingAmount, (double)account.closingAmount, parentGroup.ID);
            }
        }
Exemplo n.º 2
0
        public void ChartofAccounts_Load(object sender, EventArgs e)
        {
            _view = (ChartofAccountsForm)sender;
            int row = 0;

            var ComboBoxGridDatabase = new List <Group>();
            var ComboBoxListDatabase = new List <Group>();

            foreach (var group in systemModel.Groups)
            {
                ComboBoxGridDatabase.Add(new Group()
                {
                    ID = group.ID, name = group.name
                });
                ComboBoxListDatabase.Add(new Group()
                {
                    ID = group.ID, name = group.name
                });
            }

            _view.ComboBoxGrid(ComboBoxGridDatabase);
            _view.ComboBoxList(ComboBoxListDatabase);

            foreach (var account in systemModel.MasterAccounts)
            {
                _view.addRow(row, account.ID, account.name, (double)account.openingAmount, (double)account.closingAmount, account.Group.ID);
                row++;
            }
        }