public VinDecodeForm(DecodeType decodeType, MainForm frmMain) { _decodeType = decodeType; Load += VinDecodeForm_Load; InitializeComponent(); if (decodeType.Equals(DecodeType.Manual)) { rbVindecodeYear.Checked = true; } if (decodeType.Equals(DecodeType.VIN)) { rbDecodeVin.Checked = true; } this._frmMain = frmMain; }
void editWorker_DoWork(object sender, DoWorkEventArgs e) { var context = new CLDMSEntities(); var item = context.Inventories.FirstOrDefault(i => i.ListingID == listingID); var result = _decodeType.Equals(DecodeType.VIN) ? VinDecodeHelper.DecodeProcessingByVin(item.VINNumber) : VinDecodeHelper.GetVehicleInformationFromYearMakeModel(int.Parse(item.ModelYear), item.Make, item.Model); CombineWithCurrentData(result, listingID); BindingFormControl(result); if (result != null) { txtVin.Text = result.VinNumber; } lblMessage.Text = "Edit inventory"; Isbusy = false; }