예제 #1
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++;
            }
        }
예제 #2
0
        public void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView currentColumn = (DataGridView)sender;

            _view = (ChartofAccountsForm)((DataGridView)sender).FindForm();

            int    ID      = Convert.ToInt32(_view.Grid()[0, e.RowIndex].Value);
            String updated = _view.Grid()[e.ColumnIndex, e.RowIndex].Value.ToString();
            var    account = systemModel.MasterAccounts.Find(ID);

            account.name = updated;
            systemModel.SaveChanges();
        }
예제 #3
0
        public void changNameItem_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection theRow = _view.Grid().SelectedRows;
            int count = theRow.Count;

            if (count == 0)
            {
                _view.showErrorMessage("No rows selected");
            }
            else
            {
                _view = (ChartofAccountsForm)((ContextMenuStrip)(((ToolStripMenuItem)sender).Owner)).SourceControl.FindForm();
                _view.Grid().CurrentCell = theRow[0].Cells["name"];
                _view.Grid().BeginEdit(true);
            }
        }
예제 #4
0
        private iFINANCEModel systemModel = new iFINANCEModel(); // set the link to the model

        public void exitBtn_Click(object sender, EventArgs e)
        {
            _view = (ChartofAccountsForm)((Button)sender).FindForm();
            _view.Close();
        }
예제 #5
0
 public void addItem_Click(object sender, EventArgs e)
 {
     _view = (ChartofAccountsForm)((ContextMenuStrip)(((ToolStripMenuItem)sender).Owner)).SourceControl.FindForm();
     _view.setFocusAdd();
 }