private void button1_Click(object sender, EventArgs e) { if (!this.FillEntity()) { return; } Ticket ticket = new Ticket(); ticket.CustomerName = this.txtName.Text; ticket.CustomerPhone = this.txtPhnNumber.Text; ticket.JourneyDate = MainControl.cashierJourneyDate; ticket.SeatNo = MainControl.booking.Seats; ticket.ScheduleId = MainControl.booking.ScheduleId; ticket.Fare = TicketRepo.GetFare(ticket.ScheduleId); ticket.TotalFare = (int.Parse(ticket.Fare) * MainControl.selectedSeatCount).ToString(); this.booking = MainControl.booking; try { BookingRepo.Save(this.booking); } catch (Exception save) { MessageBox.Show("Can not save into Booking Table" + save.Message); } try { TicketRepo.Insert(ticket); this.SaveSalesAmount(ticket.ScheduleId); frmPrintedTicket printT = new frmPrintedTicket(); printT.Phone = this.txtPhnNumber.Text; printT.Show(); this.ClearUserInput(); } catch (Exception save) { MessageBox.Show("Can not save into Ticket Table" + save.Message); } }