Exemplo n.º 1
0
        private void ModifyPackageBtn_Click(object sender, EventArgs e)
        {
            /**/
            // get the key of the current package in the data grid view
            int rowNum = packagesDataGridView.CurrentCell.RowIndex;                             // index of the current row
            int packID = (int)packagesDataGridView["dataGridViewTextBoxColumn1", rowNum].Value; // Column for PackageID

            Package currentPackage;

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

            AddModifyPackage secondForm = new AddModifyPackage();

            secondForm.isAdd          = false;                             // it Modify
            secondForm.currentPackage = currentPackage;
            DialogResult result = secondForm.ShowDialog();                 // display second form modal

            if (result == DialogResult.OK || result == DialogResult.Retry) // successful update or concurrency exception
            {
                RefreshGridView();
            }
        }
Exemplo n.º 2
0
        private void fullPackageDetailBtn_Click(object sender, EventArgs e)
        {
            int     rowNum    = packagesDataGridView.CurrentCell.RowIndex;
            int     packageID = (int)packagesDataGridView["dataGridViewTextBoxColumn1", rowNum].Value;
            Package currentPackage;

            using (PackageDataContext dbContext = new PackageDataContext())
            {
                currentPackage = (from p in dbContext.Packages
                                  where p.PackageId == packageID
                                  select p).Single();
            }
            AddModifyPackage amf = new AddModifyPackage();

            amf.ReadOnly = true;
            //apf.currentPackage = PackageList[rowNum];
            amf.currentPackage = currentPackage;
            DialogResult result = amf.ShowDialog();

            if (result == DialogResult.OK)
            {
                RefreshGridView();
            }
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 3
0
        private void AddPackageBtn_Click(object sender, EventArgs e)
        {
            AddModifyPackage secondForm = new AddModifyPackage();

            secondForm.isAdd          = true;
            secondForm.currentPackage = null;              // no current product when inserting
            DialogResult result = secondForm.ShowDialog(); // display second form modal

            if (result == DialogResult.OK)                 // new row got inserted
            {
                RefreshGridView();
            }
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 4
0
        private void AddFullPackageBtn_Click(object sender, EventArgs e)
        {
            Package currentPackage = null;

            AddModifyPackage amf = new AddModifyPackage();

            amf.isAddFullPackage = true;
            //apf.currentPackage = PackageList[rowNum];
            amf.currentPackage = currentPackage;
            DialogResult result = amf.ShowDialog();

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