protected void uiLinkButtonSave_Click(object sender, EventArgs e) { TicketInfo Ticket = new TicketInfo(); TicketHistory History = new TicketHistory(); int seatno = 0; decimal actualprice, finalprice, addedvalue, addedpercentage = 0; History.AddNew(); if (CurrentTicket == null) { Ticket.AddNew(); Ticket.CreatedDate = DateTime.Now; } else { Ticket = CurrentTicket; } Ticket.From_AirportID = History.From_AirportID = Convert.ToInt32(uiDropDownListFrom.SelectedValue); Ticket.To_AirportID = History.To_AirportID = Convert.ToInt32(uiDropDownListTo.SelectedValue); Ticket.AirLineID = History.AirLineID = Convert.ToInt32(uiDropDownListAirLine.SelectedValue); Ticket.PassengerID = Convert.ToInt32(uiDropDownListCustomer.SelectedValue); Ticket.CreditCardID = Convert.ToInt32(uiDropDownListCreditCard.SelectedValue); Ticket.TicketNo = uiTextBoxTicketNo.Text; Ticket.FlightNo = History.FlightNo = uiTextBoxFlightNo.Text; int.TryParse(uiTextBoxSeatNo.Text, out seatno); Ticket.SeatNo = History.SeatNo = seatno; Ticket.Cabin_type = History.Cabin_type = uiDropDownListCabinType.SelectedItem.Text; decimal.TryParse(uiTextBoxFinalPrice.Text, out finalprice); decimal.TryParse(uiTextBoxActualPrice.Text, out actualprice); decimal.TryParse(uiTextBoxAddedValue.Text, out addedvalue); decimal.TryParse(uiTextBoxAddedPercentage.Text, out addedpercentage); Ticket.ActualPrice = History.ActualPrice = actualprice; Ticket.FinalPrice = History.FinalPrice = finalprice; Ticket.AddedValue = History.AddedValue = addedvalue; Ticket.AddedPercentage = History.AddedPercentage = addedpercentage; Ticket.TicketStatusID = History.TicketStatusID = Convert.ToInt32(uiDropDownListStatus.SelectedValue); Ticket.FromDate = History.FromDate = DateTime.ParseExact(uiTextBoxFromDate.Text, "MM/dd/yyyy hh:mm", null); Ticket.Save(); if (Ticket.TicketStatusID == 2) // confirmed { SendSMS(Ticket); } History.TicketID = Ticket.TicketID; History.UpdatedDate = DateTime.Now; History.Save(); LoadAllTickets(); uiPanelAll.Visible = true; uiPanelEdit.Visible = false; ClearFields(); CurrentTicket = null; }