Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Advanced C# Using code- complete program using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using PayablesData; namespace

image text in transcribedimage text in transcribedAdvanced C#

Using code- complete program

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using PayablesData;

namespace VendorMaintenance { public partial class frmVendorMaintenance : Form { public frmVendorMaintenance() { InitializeComponent(); }

Vendor vendor;

private void btnGetVendor_Click(object sender, EventArgs e) { //Validate the Vendor ID entered into the TextBox control if (Validator.IsPresent(txtVendorID) && Validator.IsInt32(txtVendorID)) { int vendorID = Convert.ToInt32(txtVendorID.Text); //Call method that will reference the VendorDB database class this.GetVendor(vendorID); } }

private void GetVendor(int vendorID) { try { vendor = VendorDB.GetVendor(vendorID); if (vendor == null) { MessageBox.Show("No vendor found with this ID. " + "Please try again.", "Vendor Not Found"); txtVendorID.Focus(); txtVendorID.SelectAll(); } else this.DisplayVendor(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }

private void DisplayVendor() { txtName.Text = vendor.Name; txtAddress1.Text = vendor.Address1; txtAddress2.Text = vendor.Address2; txtCity.Text = vendor.City; txtState.Text = vendor.State; txtZipCode.Text = vendor.ZipCode; btnModify.Enabled = true; }

private void btnAdd_Click(object sender, EventArgs e) { ////Create an instance of the form that will be used to add a Vendor and set the addVendor boolean flag //frmAddModifyVendor addModifyVendorForm = new frmAddModifyVendor(); //addModifyVendorForm.addVendor = ?; ////Display the Vendor Maintenance form to user //DialogResult result = addModifyVendorForm.?;

////If user added a new Vendor then display the Vendor information ////on this form //if (result == DialogResult.OK) //{ // vendor = addModifyVendorForm.?; // txtVendorID.Text = vendor.VendorID.ToString(); // this.DisplayVendor(); //} }

private void btnModify_Click(object sender, EventArgs e) { ////create an instance of the frmAddModifyVendor form //frmAddModifyVendor addModifyVendorForm = new frmAddModifyVendor(); //addModifyVendorForm.addVendor = ?; //this is an update, not an add so set the addVendor boolean //addModifyVendorForm.vendor = ?;

////Display the form to modify a Vendor //DialogResult result = addModifyVendorForm.ShowDialog();

//if (result == DialogResult.OK) //{ // vendor = addModifyVendorForm.?; // this.DisplayVendor(); //} //else if (result == DialogResult.Retry) //{ // this.ClearControls(); // this.GetVendor(vendor.VendorID); //} }

private void ClearControls() { txtName.Text = ""; txtAddress1.Text = ""; txtAddress2.Text = ""; txtCity.Text = ""; txtState.Text = ""; txtZipCode.Text = ""; btnModify.Enabled = false; }

private void btnExit_Click(object sender, EventArgs e) { this.Close(); } } }

Cis 232 Practice Lab Problem #5-Chapter 7 Student: Total points 1. Open the solution from Chapter 7. Vendor Maintenance Vendor ID: Get vendor) Name: Address: City State: Zip code Exit 2. Add a button to the right of the Modify button and name it btnDelete. Also, set the Text property to Delete. 3. The Delete button should only be enabled (Enabled-true) just like the Modify button. There are two places where the Modify button's Enabled property is set to a value. Add the Delete button to the same two places. 4. Set the Tab order for all the controls on the form. Select 5. Add the following static method to the appropriate database 6. Copy the code from the Update Vendor method to the DeleteVendor View/Tab Order. class: public static bool DeleteVendor(Vendor vendor) method. Make the following changes to the DeleteVendor method: a. Replace the variable name updatestatement with deletestatement. b. Replace UPDATE Vendors SET clause with DELETE FROM Vendors. c. The Where clause should NOT BE changed since the Delete statement will use the same concurrency technique as the Update statement. d. Replace variable name updateCommand with deleteCommand. e. Delete all parameters that start with the @New. f. Keep all parameters that start with @old. Page 1 of 2 Cis 232 Practice Lab Problem #5-Chapter 7 Student: Total points 1. Open the solution from Chapter 7. Vendor Maintenance Vendor ID: Get vendor) Name: Address: City State: Zip code Exit 2. Add a button to the right of the Modify button and name it btnDelete. Also, set the Text property to Delete. 3. The Delete button should only be enabled (Enabled-true) just like the Modify button. There are two places where the Modify button's Enabled property is set to a value. Add the Delete button to the same two places. 4. Set the Tab order for all the controls on the form. Select 5. Add the following static method to the appropriate database 6. Copy the code from the Update Vendor method to the DeleteVendor View/Tab Order. class: public static bool DeleteVendor(Vendor vendor) method. Make the following changes to the DeleteVendor method: a. Replace the variable name updatestatement with deletestatement. b. Replace UPDATE Vendors SET clause with DELETE FROM Vendors. c. The Where clause should NOT BE changed since the Delete statement will use the same concurrency technique as the Update statement. d. Replace variable name updateCommand with deleteCommand. e. Delete all parameters that start with the @New. f. Keep all parameters that start with @old. Page 1 of 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

Analyse the various techniques of training and learning.

Answered: 1 week ago