Ejemplo n.º 1
0
    protected void cmdSave_Click(object sender, EventArgs e)
    {
        BLL_TRV_QuoteRequest Qr  = new BLL_TRV_QuoteRequest();
        IATAList             lst = new IATAList();
        int QuoteID = 0;;

        try
        {
            if (txtFare.Text.Trim() != "" && txtTax.Text.Trim() != "" && txtTicketDeadline.Text.Trim() != "" && txtGDSLocator.Text.Trim() != "")
            {
                if (!string.IsNullOrEmpty(Request.QueryString["QuoteID"]))
                {
                    QuoteID = Convert.ToInt32(Request.QueryString["QuoteID"]);
                }

                QuoteID = Qr.AddQuotation(RequestID, AgentID, txtGDSLocator.Text.Trim(),
                                          Convert.ToDateTime(txtTicketDeadline.Text.Trim()),
                                          Convert.ToDecimal(txtFare.Text.Trim()), Convert.ToDecimal(txtTax.Text.Trim()),
                                          txtPNRText.Text.Trim(), cmbCurrency.SelectedValue, Convert.ToInt32(Session["USERID"].ToString()),
                                          cmbHours.SelectedItem.Text, cmbMins.SelectedItem.Text, QuoteID,
                                          UDFLib.ConvertDecimalToNull(txtbaggageallowances.Text),
                                          UDFLib.ConvertDecimalToNull(txtDateChangeAllow.Text),
                                          UDFLib.ConvertDecimalToNull(txtCancellationCharge.Text));
                int cnt = 0;
                foreach (GridViewRow grFlt in GrdFlight.Rows)
                {
                    int Flight_ID = GrdFlight.DataKeys[grFlt.RowIndex].Values["ID"].ToString().Contains("-") ? 0 : Convert.ToInt32(GrdFlight.DataKeys[grFlt.RowIndex].Values["ID"].ToString());

                    Qr.AddQuotationFlights(QuoteID,
                                           (grFlt.FindControl("txtAirlineLocator") as TextBox).Text,
                                           (grFlt.FindControl("txtFrom") as TextBox).Text,
                                           (grFlt.FindControl("txtTo") as TextBox).Text,
                                           "",
                                           (grFlt.FindControl("txtFlight") as TextBox).Text,
                                           (grFlt.FindControl("cmbTravelClass") as DropDownList).SelectedValue,
                                           Convert.ToDateTime((grFlt.FindControl("txtDeparureDate") as TextBox).Text),
                                           Convert.ToDateTime((grFlt.FindControl("txtArrivalDate") as TextBox).Text),
                                           (grFlt.FindControl("cmbFlightStatus") as DropDownList).SelectedValue,
                                           (grFlt.FindControl("txtFlightRemark") as TextBox).Text,
                                           UDFLib.ConvertToInteger(Session["USERID"].ToString()),
                                           (grFlt.FindControl("cmbArrHours") as DropDownList).SelectedItem.Value,
                                           (grFlt.FindControl("cmbArrMins") as DropDownList).SelectedItem.Value,
                                           (grFlt.FindControl("cmbDepHours") as DropDownList).SelectedItem.Value,
                                           (grFlt.FindControl("cmbDepMins") as DropDownList).SelectedItem.Value,
                                           Flight_ID);



                    lst.fromIATA = (grFlt.FindControl("txtFrom") as TextBox).Text;
                    lst.toIATA   = (grFlt.FindControl("txtTo") as TextBox).Text;



                    cnt++;
                }
            }

            string js = "parent.newQuote_Closed();parent.hideModal('dvPopUp');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "closewindow", js, true);
        }
        catch { throw; }
        finally { Qr = null; }
    }