Use the supplied solution, search for TODO then write the co…
Questions
Use the supplied sоlutiоn, seаrch fоr TODO then write the code аnd test the аpplication. Remember to Download the XXX and unzip. Open VehicleRepair.sln in Visual Studio 2022. Right-click on the RepairUI project and ensure it is 'Set as StartUp Project'. Answer as many questions as possible, partial credit will be granted. Run the application to perform testing as needed. When complete use File Explorer, WinZip or 7-Zip to .zip the directory with application files. Upload the .zip file as your answer to the last essay question. You are developing an application that allows users to capture details for vehicle repair program. The user must select a repair type. Next click details to enter the repair details, click OK will display repair details and click Close will close form. Finally click the cost button to display repair cost. Given the solution, which is a 3-tier application and uses class inheritance with a RepairBO base class, follow comments and write code to meet requirements: The user must select vehicle type for Details button click to open Details screen. When the user clicks Details, open the Details screen as modal. Should be able to change repair details until clicking OK and Close on Details screen. When the user enters details and clicks OK: Validate numeric values and display any errors using a message box. Populate values from screen into the business object. Display values from business object on the Main screen. When the user clicks Cost, use business object to determine and display the repair cost. 'Affirmation of Authorship: 'Name: 'Date: 'I affirm that this program was created by me. It is solely my work and does not include anyone else work. public partial class frmMain : Form{ // TODO #1: Public class variable objRepair for RepairBO (1 point) // TODO #2: Create class variable for Details form (1 point) public frmMain() { InitializeComponent(); } // Check to determine cost for repairs private void btnCost_Click(object sender, EventArgs e) { try { // Define and initialize dblCost variable double dblCost = 0.00; // TODO #3: Populate dblCost by calling objRepair Cost() function (1 point) // Display message based on cost if (dblCost > 0) { // TODO #4: Populate lblResult to indicate repair cost (1 point) } else { // TODO #5: Populate lblResult to indicate details needed (1 point) } } catch (Exception ex) { // TODO #6: Populate lblResult with error message (1 point) } } private void MainForm_Load(object sender, EventArgs e) { // TODO #7: Clear lblDetails and lblResults (1 point) // TODO #8: Add the vehicle types to the combobox using Types() from the RepairBO business object (1 point) } private void btnDetails_Click(object sender, EventArgs e) { // Edit to ensure a repair type is selected if (!string.IsNullOrEmpty(cboRepairType.Text)) { // TODO #9: Clear lblResults (1 point) // TODO #10: Show the details form as dialog (1 point) } else { // Display message for user to select a repair type MessageBox.Show("Please select a repair type."); } } } public partial class frmDetails : Form{ private frmMain objFrmMain; // Dimension private class variable for repair type private string strRepairType; // TODO #11: Dimension public class variables for EngineRepairBO (1 point) // TODO #12: Dimension public class variables for BodyRepairBO (1 point) public frmDetails(frmMain objFrm) { objFrmMain = objFrm; InitializeComponent(); } private void btnOK_Click(object sender, EventArgs e) { try { // TODO #13: Call PopulateValues() method (1 point) // Based on the specific repair type selected on MainForm, // Populate MainForm public objRepair from DetailForm either objEngine or objBody // and MainForm lblDetails from DetailForm objEngine or objBody .ToString() switch (strRepairType ?? "") { case "Body": { // TODO #14: Populate MainForm public objRepair from DetailForm objBody (1 point) // TODO #15: Populate MainForm lblDetails from DetailForm objBody .ToString() (1 point) break; } case "Engine": { // TODO #16: Populate MainForm public objRepair from DetailForm objEngine (1 point) // TODO #17: Populate MainForm lblDetails from DetailForm objEngine .ToString() (1 point) break; } } } catch (RepairException vx) { // Display message and exception number if RepairException occurs MessageBox.Show(vx.Message + " - Code=" + vx.ExceptionNumber.ToString()); } catch (Exception ex) { // Display message if Exception occurs MessageBox.Show("Please check all input fields. " + ex.Message); } } private void btnCancel_Click(object sender, EventArgs e) { // TODO #18: Hide the details form (1 point) } private void PopulateValues() { // Based on the specific vehicle type selected on MainForm, // populate properties in BodyRepairBO or EngineRepairBO switch (strRepairType ?? "") { case "Body": { // Populate objBody properties from DetailsForm screen values // TODO #19: objBody.ID (1 point) // TODO #20: objBody.Make (1 point) // TODO #21: objBody.Model (1 point) // TODO #22: objBody.Color (1 point) // TODO #23: objBody.NumDoors (1 point) // TODO #24: objBody.Sunroof (1 point) break; } case "Engine": { // Populate objEngine properties from DetailsForm screen values // TODO #25: objEngine.ID (1 point) // TODO #26: objEngine.Make (1 point) // TODO #27: objEngine.Model (1 point) // TODO #20: objEngine.Color (1 point) // TODO #29: objEngine.NumCylinders (1 point) // TODO #30: objEngine.Hybrid (1 point) break; } } } private void frmDetails_Load(object sender, EventArgs e) { // Set class variable for strVehicleType from MainForm cboRepairType strRepairType = objFrmMain.cboRepairType.Text; // Based on the specific vehicle type selected on MainForm, // show appropriate groupbox and hide all other grouboxes switch (strRepairType ?? "") { case "Engine": { gbEngineRepair.Show(); gbBodyRepair.Hide(); break; } case "Body": { gbEngineRepair.Hide(); gbBodyRepair.Show(); break; } } }}