Esempio n. 1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            //find column and row location of ID
            int rowNum = packageDataGridView.CurrentCell.RowIndex;
            int packID = (int)packageDataGridView["dataGridViewTextBoxColumn1", rowNum].Value;

            //Select ID
            Package currentPackage;

            using (TravelExpertsDataContext dbContext = new TravelExpertsDataContext())
            {
                currentPackage = (from pack in dbContext.Packages
                                  where pack.PackageId == packID
                                  select pack).Single();
            }

            //Open new form to view products by package ID
            frmPackageAddModify secondForm = new frmPackageAddModify();

            secondForm.currentPackage = currentPackage;
            DialogResult result = secondForm.ShowDialog();

            if (result == DialogResult.OK || result == DialogResult.Retry)
            {
                RefreshGridView();
            }
        }
Esempio n. 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmPackageAddModify secondform = new frmPackageAddModify();

            secondform.isAdd          = true;
            secondform.currentPackage = null;
            DialogResult result = secondform.ShowDialog();

            if (result == DialogResult.OK)
            {
                RefreshGridView();
            }
        }