private void btnImport_Click(object sender, EventArgs e) { if (cbxInputFormat.SelectedItem != null) { switch (cbxInputFormat.SelectedItem.ToString()) { case "EXCEL": { try { IHelper excelHelper = new ExcelHelper(tbsRepository); string filePath = System.IO.Path.Combine(Environment.CurrentDirectory, "TwinkleBookStoreExcelData.xlsx"); excelHelper.ImportData(filePath); MessageBox.Show("Excel Data imported successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Excel Data imported failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; case "CSV": { try { IHelper csvHelper = new CSVHelper(tbsRepository); string customersFile = System.IO.Path.Combine(Environment.CurrentDirectory, "TwinkleBookStore_CustomersCsv.csv"); string booksFile = System.IO.Path.Combine(Environment.CurrentDirectory, "TwinkleBookStore_BooksCsv.csv"); string purHistoryFile = System.IO.Path.Combine(Environment.CurrentDirectory, "TwinkleBookStore_PurchasehistoryCsv.csv"); csvHelper.ImportData(customersFile); csvHelper.ImportData(booksFile); csvHelper.ImportData(purHistoryFile); MessageBox.Show("CSV Data imported successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("CSV Data imported failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; case "XML": { try { MessageBox.Show("To be implemented", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //IHelper xmlHelper = new XMLHelper(tbsRepository); //xmlHelper.ImportData(@"C:\1_Lavanya\Workspace\ABBAsignment\Files\TwinkleBookStoreRecord1.xml"); //MessageBox.Show("XML Data imported successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("XML Data imported failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; case "JSON": { try { MessageBox.Show("To be implemented", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //IHelper jsonHelper = new JSONHelper(tbsRepository); //jsonHelper.ImportData(@"C:\1_Lavanya\Workspace\ABBAsignment\Files\TwinkleBookStoreRecord1.json"); //MessageBox.Show("JSON Data imported successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("JSON Data imported failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; case "TEXT": { try { MessageBox.Show("To be implemented", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //IHelper textHelper = new TextHelper(tbsRepository); //textHelper.ImportData(@"C:\1_Lavanya\Workspace\ABBAsignment\Files\TwinkleBookStoreRecord.txt"); //MessageBox.Show("Text Data imported successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Text Data imported failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; default: break; } } }