Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using EpicCars;
- namespace SalesStaff
- {
- public partial class frmEpicCars : Form
- {
- public frmEpicCars()
- {
- InitializeComponent();
- }
- private void selectCarBTN_Click(object sender, EventArgs e)
- {
- // Select Image to display in picture box
- openFD.ShowDialog();
- carPicBox.ImageLocation = openFD.FileName;
- }
- private void frmEpicCars_Load(object sender, EventArgs e)
- {
- PopulateFormWithAutomobile();
- }
- private void submitBTN_Click(object sender, EventArgs e)
- {
- SaveAutomobileFromForm();
- }
- private void refreshBTN_Click(object sender, EventArgs e)
- {
- }
- void PopulateFormWithAutomobile()
- {
- var svc = new AutomobileService();
- var automobile = svc.GetAutomobiles();
- if (automobile == null)
- return;
- colorTB.Text = automobile.Color;
- makeTB.Text = automobile.Make;
- modelTB.Text = automobile.Model;
- yearTB.Text = automobile.Year.ToString();
- }
- void SaveAutomobileFromForm()
- {
- var automobile = new Automobiles();
- automobile.Color = colorTB.Text;
- automobile.Make = makeTB.Text;
- automobile.Model = modelTB.Text;
- int year;
- if (int.TryParse(yearTB.Text , out year))
- automobile.Year = year;
- int amount;
- if (int.TryParse(startingBidTB.Text, out amount))
- automobile.Amount = amount;
- var svc = new AutomobileService();
- svc.SaveAutomobiles(automobile);
- //if (int.TryParse(startingBidTB.Text, out bid))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment