private void handleFinishEdit(object sender, System.Collections.Specialized.OrderedDictionary e) { if (sender.Equals(this.addTicket)) { string code = e[Constants.codeField].ToString(); string spectacol = e[Constants.spectacolField].ToString(); int nrOfTickets = SpectacleBL.getNrOfTicketsForSpectacle(spectacol); if (nrOfTickets == 0) { MessageBox.Show("Cannot add more tickets"); return; } else if (nrOfTickets == -1) { MessageBox.Show("Bad request,please check fields"); return; } int rand = int.Parse(e[Constants.randField].ToString()); int numar = int.Parse(e[Constants.numarField].ToString()); OperationResult.opResult result = TicketBL.addTicketForSpectacle(code, spectacol, rand, numar); if (result == OperationResult.opResult.OperationInsertTicketDuplicate || result == OperationResult.opResult.OperationAddTicketFail) { MessageBox.Show("Cannot add ticket for this place"); return; } else { MessageBox.Show("Succes"); } } else if (sender.Equals(this.export)) { ExporterType type = (ExporterType)int.Parse(e["Export Type"].ToString()); Exporter exporter = ExportFactory.getExporter(type); string spectacol = e[Constants.spectacolField].ToString(); Array tickets = TicketBL.getAllTicketsForSpectacle(spectacol).ToArray(); string path = e["File Path"].ToString(); exporter.exportTickets(tickets.OfType <Ticket>().ToList(), path); } }
private void handlerTableEditRow(object sender, System.Collections.Specialized.OrderedDictionary e) { if (sender.Equals(spectalesTable)) { string titlu = e[Constants.titluField].ToString(); Array tickets = TicketBL.getAllTicketsForSpectacle(titlu).ToArray(); if (tickets == null || tickets.Length == 0) { MessageBox.Show("No tickets added for this spectacle"); return; } if (currentView != null) { currentView.dismissFromContainer(); } ticketsTable.drawInForm(this); ticketsTable.refreshWithData(tickets); currentView = ticketsTable; } }