// get dummy records private Collection <RepairOrder> GetDummyRecords(ImportFile importFile) { int j = _Model.MaxPreview == 0 ? 50 : _Model.MaxPreview; var items = new Collection <RepairOrder>(); for (int i = 0; i < j; i++) { Thread.Sleep(100); var item = new RepairOrder( importFile, 60932, string.Format("Lorem ipsum dolor sit amet {0:000}", i + 1), 67661, "Y", 5, (i + 1), "Ea", "USD", 100003628 ); item.SerialNumber = "EM1234567"; items.Add(item); } importFile._LoadedAll = true; importFile.RefreshStatus(); return(items); }
// get the import files internal Collection<ImportFile> GetImportFileList() { Collection<ImportFile> result = new Collection<ImportFile>(); if (_Model.InDesignMode) { for (int i = 1; i < 50; i++) { string name = string.Format("Repair_Orders_{0:000}.csv", i); ImportFile file; file = new ImportFile(_Model, i, name, name, name); switch (i) { case 1: file._JobStatus = ImportFile.JobStatus.Load; break; case 2: file._JobStatus = ImportFile.JobStatus.Loaded; AddDummyRecords(file); break; case 3: file._JobStatus = ImportFile.JobStatus.ParseError; break; case 4: file._JobStatus = ImportFile.JobStatus.Loading; break; case 5: file._JobStatus = ImportFile.JobStatus.Importing; file.ProgressPercent = 50; break; case 6: file._JobStatus = ImportFile.JobStatus.Done; file.ProgressPercent = 100; break; case 7: file._JobStatus = ImportFile.JobStatus.DoneError; file.ProgressPercent = 100; break; case 8: file._JobStatus = ImportFile.JobStatus.AllDone; file.ProgressPercent = 100; break; case 9: file._JobStatus = ImportFile.JobStatus.AllDoneError; file.ProgressPercent = 100; break; default: break; } file.RefreshStatus(); result.Add(file); } } else if (_Model.InDemo) { for (int i = 1; i <= 50; i++) { string name = string.Format("Repair_Orders_{0:000}.csv", i); string description = name; if (i % 5 == 0) description += " {70}"; if (i % 7 == 0) description += " {75}"; var file = new ImportFile(_Model, i, name, name, description); result.Add(file); } } else if (null != _Addin && null != _Addin._Incident) { foreach (var f in _Addin._Incident.FAttach2) { if (isValid(f)) { string name = String.IsNullOrWhiteSpace(f.Name) ? f.UserFName : f.Name; var impf = new ImportFile(_Model, f.ID, f.UserFName, name, f.Descr ); result.Add(impf); } } } return result; }
// get dummy records private Collection<RepairOrder> GetDummyRecords(ImportFile importFile) { int j = _Model.MaxPreview == 0 ? 50 : _Model.MaxPreview; var items = new Collection<RepairOrder>(); for (int i = 0; i < j; i++) { Thread.Sleep(100); var item = new RepairOrder( importFile, 60932, string.Format("Lorem ipsum dolor sit amet {0:000}", i + 1), 67661, "Y", 5, (i+1), "Ea", "USD", 100003628 ); item.SerialNumber = "EM1234567"; items.Add(item); } importFile._LoadedAll = true; importFile.RefreshStatus(); return items; }
// get the import files internal Collection <ImportFile> GetImportFileList() { Collection <ImportFile> result = new Collection <ImportFile>(); if (_Model.InDesignMode) { for (int i = 1; i < 50; i++) { string name = string.Format("Repair_Orders_{0:000}.csv", i); ImportFile file; file = new ImportFile(_Model, i, name, name, name); switch (i) { case 1: file._JobStatus = ImportFile.JobStatus.Load; break; case 2: file._JobStatus = ImportFile.JobStatus.Loaded; AddDummyRecords(file); break; case 3: file._JobStatus = ImportFile.JobStatus.ParseError; break; case 4: file._JobStatus = ImportFile.JobStatus.Loading; break; case 5: file._JobStatus = ImportFile.JobStatus.Importing; file.ProgressPercent = 50; break; case 6: file._JobStatus = ImportFile.JobStatus.Done; file.ProgressPercent = 100; break; case 7: file._JobStatus = ImportFile.JobStatus.DoneError; file.ProgressPercent = 100; break; case 8: file._JobStatus = ImportFile.JobStatus.AllDone; file.ProgressPercent = 100; break; case 9: file._JobStatus = ImportFile.JobStatus.AllDoneError; file.ProgressPercent = 100; break; default: break; } file.RefreshStatus(); result.Add(file); } } else if (_Model.InDemo) { for (int i = 1; i <= 50; i++) { string name = string.Format("Repair_Orders_{0:000}.csv", i); string description = name; if (i % 5 == 0) { description += " {70}"; } if (i % 7 == 0) { description += " {75}"; } var file = new ImportFile(_Model, i, name, name, description); result.Add(file); } } else if (null != _Addin && null != _Addin._Incident) { foreach (var f in _Addin._Incident.FAttach2) { if (isValid(f)) { string name = String.IsNullOrWhiteSpace(f.Name) ? f.UserFName : f.Name; var impf = new ImportFile(_Model, f.ID, f.UserFName, name, f.Descr); result.Add(impf); } } } return(result); }