Exemple #1
0
        private void btnNewApplication_Click(object sender, EventArgs e)
        {
            bool hasTheSaveButtonPressed = false;

            App app = new App();

            frmAddOrUpdateApplication _frmAddOrUpdateApplication = new frmAddOrUpdateApplication(app);

            _frmAddOrUpdateApplication.TopMost       = true;
            _frmAddOrUpdateApplication.StartPosition = FormStartPosition.CenterParent;
            _frmAddOrUpdateApplication.ShowDialog();

            hasTheSaveButtonPressed = _frmAddOrUpdateApplication.hasTheSaveButtonPressed;

            if (hasTheSaveButtonPressed == true)
            {
                Validation.LocalDatabaseConfig(true);
                //databaseViewModel = Services.GetDataFromDatabase();
                applicationList = loadApplications();
            }

            dgvApplications.ClearSelection();
            txtSearchApplication.Clear();
            btnEditApplication.Enabled   = false;
            btnDeleteApplication.Enabled = false;

            _frmAddOrUpdateApplication.Dispose();
        }
Exemple #2
0
        private void btnEditApplication_Click(object sender, EventArgs e)
        {
            if ((dgvApplications.Rows.Count > 0))
            {
                App  app = new App();
                bool hasTheSaveButtonPressed = false;

                app.ApplicationId   = Convert.ToInt32(dgvApplications.CurrentRow.Cells[0].Value.ToString());
                app.ApplicationName = dgvApplications.CurrentRow.Cells[1].Value.ToString();

                frmAddOrUpdateApplication _frmAddOrUpdateApplication = new frmAddOrUpdateApplication(app);
                this.TopMost = false;
                _frmAddOrUpdateApplication.StartPosition = FormStartPosition.CenterParent;
                _frmAddOrUpdateApplication.ShowDialog();

                hasTheSaveButtonPressed = _frmAddOrUpdateApplication.hasTheSaveButtonPressed;

                if (hasTheSaveButtonPressed == true)
                {
                    Validation.LocalDatabaseConfig(true);
                    //databaseViewModel = Services.GetDataFromDatabase();
                    applicationList = loadApplications();
                }

                dgvApplications.ClearSelection();
                txtSearchApplication.Clear();
                btnEditApplication.Enabled   = false;
                btnDeleteApplication.Enabled = false;

                _frmAddOrUpdateApplication.Dispose();
            }
        }