Example #1
0
        protected override void OnAddStoredFile()
        {
            if (!File.Exists(FilePath))
            {
                ShowError(Resources.MSG_EXC_CANNOT_ACCESS_FILE);
                return;
            }

            try
            {
                WorkshopCardFile workshopCardFile = WorkshopCardFile.GetWorkshopCardFile(SelectedDate, Workshop, FilePath);
                StoredFiles.Add(workshopCardFile);
                WorkshopCardFilesRepository.Add(workshopCardFile.Clone <WorkshopCardFile>());

                IsReadFromCardEnabled = true;
                IsFormEnabled         = true;
                Workshop     = null;
                SelectedDate = DateTime.Now;
                FilePath     = null;
            }
            catch (Exception ex)
            {
                ShowError(Resources.EXC_UNABLE_ADD_WORKSHOP_CARD_FILE, ExceptionPolicy.HandleException(ContainerBootstrapper.Container, ex));
            }
        }
        protected override void OnDumpCompleted(object sender, DriverCardCompletedEventArgs e)
        {
            CardBeingRead = false;

            string[] cardDetails = DisplayWorkshopCardDetails(e.DumpFilePath);
            if (cardDetails != null)
            {
                WorkshopCardFile workshopCardFile = WorkshopCardFile.GetWorkshopCardFile(DateTime.Now, cardDetails[1], cardDetails[0]);
                WorkshopCardFilesRepository.Add(workshopCardFile.Clone <WorkshopCardFile>());

                SwitchReadButtonState(false);
                StatusText          = Resources.TXT_WORKSHOP_CARD_FILE_GENERATED;
                ReadFromCardContent = Resources.TXT_READ_FROM_CARD;
            }
            else
            {
                StatusText = Resources.TXT_UNABLE_GENERATE_WORKSHOP_CARD;
                MessageBoxHelper.ShowMessage(Resources.ERR_UNABLE_READ_SMART_CARD);
                SwitchReadButtonState(true);
            }
        }