Example #1
0
        protected void OnRowEditing(object sender, GridViewEditEventArgs e)
        {
            string         departureCity = GridView.Rows[e.NewEditIndex].Cells[1].Text;
            string         arrivalCity   = GridView.Rows[e.NewEditIndex].Cells[2].Text;
            FlightsService service       = Service.getInstanse().flightService;

            if (service.GetFlightPriceId(departureCity, arrivalCity, out idFlightPrice))
            {
                GridView.EditIndex = e.NewEditIndex;
                UpdateAllTable();
            }
        }
Example #2
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int id = IdTickets[e.RowIndex];

            FlightsService service   = Service.getInstanse().flightService;
            string         departure = e.NewValues[0].ToString();
            string         arrival   = e.NewValues[1].ToString();
            int            price     = Convert.ToInt32(e.NewValues[2].ToString());
            string         name      = e.NewValues[3].ToString();
            string         surname   = e.NewValues[4].ToString();

            int idFlightPriceId;

            if (service.GetFlightPriceId(departure, arrival, out idFlightPriceId))
            {
                if (service.UpdateTicket(id, idFlightPriceId, name, surname))
                {
                    GridView.EditIndex = -1;
                    LoadData();
                }
            }
        }