Exemplo n.º 1
0
    protected void GrdFlight_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (GrdFlight.Rows.Count > 1)
            {
                DataTable dtFlight = CreateDtFlight();;

                DataRow dr = null;

                foreach (GridViewRow grFlt in GrdFlight.Rows)
                {
                    dr = dtFlight.NewRow();

                    dr["ID"]            = GrdFlight.DataKeys[grFlt.RowIndex].Values["ID"].ToString();
                    dr["Flight"]        = (grFlt.FindControl("txtFlight") as TextBox).Text;
                    dr["From"]          = (grFlt.FindControl("txtFrom") as TextBox).Text;
                    dr["To"]            = (grFlt.FindControl("txtTo") as TextBox).Text;
                    dr["FlightStatus"]  = (grFlt.FindControl("cmbFlightStatus") as DropDownList).SelectedValue;
                    dr["DepartureDate"] = (grFlt.FindControl("txtDeparureDate") as TextBox).Text;
                    dr["DepHour"]       = (grFlt.FindControl("cmbDepHours") as DropDownList).SelectedItem.Value;
                    dr["DepMin"]        = (grFlt.FindControl("cmbDepMins") as DropDownList).SelectedItem.Value;
                    dr["ArrivalDate"]   = (grFlt.FindControl("txtArrivalDate") as TextBox).Text;
                    dr["ArrHour"]       = (grFlt.FindControl("cmbArrHours") as DropDownList).SelectedItem.Value;
                    dr["ArrMin"]        = (grFlt.FindControl("cmbArrMins") as DropDownList).SelectedItem.Value;
                    dr["Locator"]       = (grFlt.FindControl("txtAirlineLocator") as TextBox).Text;
                    dr["Remarks"]       = (grFlt.FindControl("txtFlightRemark") as TextBox).Text;
                    dr["TravelClass"]   = (grFlt.FindControl("cmbTravelClass") as DropDownList).SelectedValue;

                    dtFlight.Rows.Add(dr);
                }

                dr = dtFlight.Rows.Find(e.Keys["ID"].ToString());

                if (dr != null)
                {
                    if (!dr["id"].ToString().Contains("-"))
                    {
                        BLL_TRV_QuoteRequest qr = new BLL_TRV_QuoteRequest();
                        qr.DeleteQuoteFlight(Convert.ToInt32(dr["id"]), Convert.ToInt32(Session["USERID"].ToString()));
                    }
                    dtFlight.Rows.Remove(dr);
                }

                GrdFlight.DataSource = dtFlight;
                GrdFlight.DataBind();
            }
            //ViewState["DataTable"] = dtFlight;
        }
        catch { }
    }
Exemplo n.º 2
0
    protected void rptChild_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int id;

        try
        {
            if (e.CommandName == "removeflight")
            {
                BLL_TRV_QuoteRequest qr = new BLL_TRV_QuoteRequest();
                id = Convert.ToInt32(e.CommandArgument);
                qr.DeleteQuoteFlight(id, Convert.ToInt32(Session["USERID"].ToString()));
                qr = null;
                GetQuotations();
            }
        }
        catch { }
    }