Example #1
0
        private void BtnNew_Click()
        {
            DataRow customerRow = viewModel.DataSetSource.Tables["Customer"].NewRow();

            customerRow["Name"]      = "";
            customerRow["Longitude"] = "0";
            customerRow["Latitude"]  = "0";
            viewModel.DataSetSource.Tables["Customer"].Rows.Add(customerRow);

            viewModel.SelectedCustomer = new Model.Customer(customerRow);
            editForm = new CustomerDetailEdit()
            {
                viewModel = this.viewModel
            };
            editForm.Show();
        }
Example #2
0
        private void BtnEdit_Click()
        {
            if (dgvCustomerDetails.SelectedRows.Count == 0)
            {
                return;
            }

            int       rowIndex = dgvCustomerDetails.CurrentRow.Index;
            DataTable dt       = (DataTable)((BindingSource)dgvCustomerDetails.DataSource).DataSource;

            viewModel.SelectedCustomer = new Model.Customer(dt.Rows[rowIndex]);

            editForm = new CustomerDetailEdit()
            {
                viewModel = this.viewModel
            };
            editForm.Show();
        }