예제 #1
0
    protected void imgbtndeleteFlight_Click(object s, EventArgs e)
    {
        GridViewRow grdlt = (GridViewRow)(s as ImageButton).Parent.Parent;


        DataTable dtFlight = CreateDtFlight();

        DataRow dr = null;

        if (GrdFlight.Rows.Count > 1)
        {
            foreach (GridViewRow gr in GrdFlight.Rows)
            {
                if (grdlt.RowIndex != gr.RowIndex)
                {
                    UserControl_ctlAirPortList txtFrom1 = (gr.FindControl("txtFrom1") as UserControl_ctlAirPortList);
                    UserControl_ctlAirPortList txtTo1   = (gr.FindControl("txtTo1") as UserControl_ctlAirPortList);
                    dr = dtFlight.NewRow();
                    dr["travelOrigin"]      = txtFrom1.Text;
                    dr["travelDestination"] = txtTo1.Text;
                    dr["departureDate"]     = (gr.FindControl("txtDepDate1") as TextBox).Text;
                    dr["PrefDephours"]      = (gr.FindControl("cmbDepHours1") as DropDownList).SelectedValue;
                    dr["PrefDepmins"]       = (gr.FindControl("cmbDepMins1") as DropDownList).SelectedValue;
                    dtFlight.Rows.Add(dr);
                }
                GrdFlight.DataSource = dtFlight;
                GrdFlight.DataBind();
            }
        }
    }
예제 #2
0
    protected void rdoReturn_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (GrdFlight.Rows.Count < 5)
        {
            RadioButtonList objsender = (RadioButtonList)sender;
            DataTable       dtFlight = CreateDtFlight();
            string          strFrom = "", strTo = "";

            DataRow dr = null;
            foreach (GridViewRow gr in GrdFlight.Rows)
            {
                UserControl_ctlAirPortList txtFrom1 = (gr.FindControl("txtFrom1") as UserControl_ctlAirPortList);
                UserControl_ctlAirPortList txtTo1   = (gr.FindControl("txtTo1") as UserControl_ctlAirPortList);
                dr = dtFlight.NewRow();
                dr["travelOrigin"]      = txtFrom1.Text;
                dr["travelDestination"] = txtTo1.Text;
                dr["departureDate"]     = (gr.FindControl("txtDepDate1") as TextBox).Text;
                dr["PrefDephours"]      = (gr.FindControl("cmbDepHours1") as DropDownList).SelectedValue;
                dr["PrefDepmins"]       = (gr.FindControl("cmbDepMins1") as DropDownList).SelectedValue;
                dtFlight.Rows.Add(dr);
                strFrom = txtFrom1.Text;
                strTo   = txtTo1.Text;
            }

            dr = dtFlight.NewRow();
            if (objsender != null)
            {
                if (objsender.SelectedValue == "1")
                {
                    if (strTo != "")
                    {
                        dr["travelOrigin"] = strTo;
                    }
                    if (strFrom != "")
                    {
                        dr["travelDestination"] = strFrom;
                    }
                }
            }

            dtFlight.Rows.Add(dr);

            GrdFlight.DataSource = dtFlight;
            GrdFlight.DataBind();
        }
    }
예제 #3
0
    protected void cmdSaveRequest_Click(object sender, EventArgs e)
    {
        if (UDFLib.ConvertToInteger(Vessel_List.SelectedValue) > 0)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["Request_ID"]))
            {
                CheckForChangesInRequest();
            }
            string isReturn;
            int    CreatedBy, isSeaman;
            int    VoyageID = UDFLib.ConvertToInteger(Request.QueryString["VoyageID"]);
            int    EventID  = UDFLib.ConvertToInteger(Request.QueryString["EventID"]);


            if (chkSeaman.Checked)
            {
                isSeaman = 1;
            }
            else
            {
                isSeaman = 0;
            }

            if (chkReturn.Checked)
            {
                isReturn = "RETURN";
            }
            else
            {
                isReturn = "ONEWAY";
            }

            DataTable dtPax = (DataTable)ViewState["DataTable"];

            if (dtPax.Rows.Count > 0)
            {
                BLL_TRV_TravelRequest TReq          = new BLL_TRV_TravelRequest();
                TRV_Request           ReqProperties = new TRV_Request();
                try
                {
                    int i, requestid = 0; Boolean Issavingpax = true;
                    CreatedBy = Convert.ToInt32(Session["USERID"].ToString());


                    foreach (GridViewRow gr in GrdFlight.Rows)
                    {
                        UserControl_ctlAirPortList txtFrom1 = (gr.FindControl("txtFrom1") as UserControl_ctlAirPortList);
                        UserControl_ctlAirPortList txtTo1   = (gr.FindControl("txtTo1") as UserControl_ctlAirPortList);
                        TextBox      txtDepDate1            = (gr.FindControl("txtDepDate1") as TextBox);
                        DropDownList cmbDepHours1           = (gr.FindControl("cmbDepHours1") as DropDownList);
                        DropDownList cmbDepMins1            = (gr.FindControl("cmbDepMins1") as DropDownList);

                        if (string.IsNullOrEmpty(txtFrom1.Text))
                        {
                            string js = "alert('Please select from !');";
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "txtFrom1", js, true);

                            return;
                        }


                        if (string.IsNullOrEmpty(txtTo1.Text))
                        {
                            string js = "alert('Please select To !');";
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "txtTo1", js, true);

                            return;
                        }



                        if (txtFrom1.Text.Trim() != "" && txtTo1.Text.Trim() != "" && Issavingpax)  // save pax and first segment
                        {
                            Issavingpax = false;

                            for (i = 0; i < dtPax.Rows.Count; i++)
                            {
                                //to add all pax to the request after the default one, i.e. first / lead pax
                                if (i == 0)
                                {
                                    StringBuilder sbMainChanges_Remark = new StringBuilder("");
                                    if (Changes_Remark.ToString() != "")
                                    {
                                        sbMainChanges_Remark.Append("<div style='font-size:11px;font-family:Tahoma'>");
                                        sbMainChanges_Remark.Append(Changes_Remark.ToString());
                                        sbMainChanges_Remark.Append("</div>");
                                    }

                                    ReqProperties.StaffID = Convert.ToInt32(dtPax.Rows[i]["id"].ToString());

                                    ReqProperties.Travel_Class     = cmbTravelClass.SelectedValue;
                                    ReqProperties.Is_Seaman_Ticket = isSeaman;
                                    ReqProperties.Travel_Type      = isReturn;


                                    ReqProperties.isPersonal_Ticket = 0;

                                    ReqProperties.Travel_Origin      = txtFrom1.Text;
                                    ReqProperties.Departure_Date     = txtDepDate1.Text;
                                    ReqProperties.Travel_Destination = txtTo1.Text;
                                    //ReqProperties.Return_Date = txtArrDate1.Text;
                                    //ReqProperties.Preferred_Airline = txtPrefAirline1.Text;
                                    //ReqProperties.Preferred_Departure_Time = txtPrefTime1.Text;
                                    ReqProperties.Created_By = CreatedBy;
                                    ReqProperties.Remarks    = txtRequestRemarks.Text;

                                    ReqProperties.PrefDepMin = cmbDepMins1.SelectedItem.Text;
                                    ReqProperties.PrefDepHrs = cmbDepHours1.SelectedItem.Text;

                                    requestid = TReq.CreateTravelRequest(ReqProperties, UDFLib.ConvertToInteger(Vessel_List.SelectedValue), UDFLib.ConvertToInteger(Request.QueryString["Request_ID"])
                                                                         , sbMainChanges_Remark.ToString());
                                }
                                else
                                {
                                    TReq.AddPaxToTravelRequest(requestid, Convert.ToInt32(dtPax.Rows[i]["id"].ToString()), CreatedBy, VoyageID, EventID);
                                }
                            }
                        }

                        else if (txtFrom1.Text.Trim() != "" && txtTo1.Text.Trim() != "")  //ADDING from  SECOND segment  DETAIL IF VALID
                        {
                            ReqProperties.Travel_Class     = cmbTravelClass.SelectedValue;
                            ReqProperties.Is_Seaman_Ticket = isSeaman;
                            ReqProperties.Travel_Type      = isReturn;

                            ReqProperties.isPersonal_Ticket = 0;

                            ReqProperties.Travel_Origin      = txtFrom1.Text;
                            ReqProperties.Departure_Date     = txtDepDate1.Text;
                            ReqProperties.Travel_Destination = txtTo1.Text;
                            //ReqProperties.Return_Date = txtArrDate2.Text;
                            //ReqProperties.Preferred_Airline = txtPrefAirline2.Text;
                            //ReqProperties.Preferred_Departure_Time = txtPrefTime2.Text;
                            ReqProperties.Created_By = CreatedBy;
                            ReqProperties.Remarks    = txtRequestRemarks.Text;
                            ReqProperties.PrefDepMin = cmbDepMins1.SelectedItem.Text;
                            ReqProperties.PrefDepHrs = cmbDepHours1.SelectedItem.Text;


                            //ONLY LEADPAX DETAIL HAS TO BE SAVED
                            ReqProperties.StaffID = Convert.ToInt32(dtPax.Rows[0]["id"].ToString());

                            TReq.AddFlightToTravelRequest(requestid, ReqProperties);
                        }
                    }


                    if (!string.IsNullOrEmpty(Request.QueryString["Request_ID"]))
                    {
                        string js = "window.opener.location.href='RequestList.aspx';window.open('','_self');window.close();";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "msg2", js, true);
                    }
                    else
                    {
                        Response.Redirect("RequestList.aspx");
                    }
                }
                catch { throw; }
                finally { TReq = null; ReqProperties = null; }
            }

            else
            {
                string msgPax = "alert('Add at least 1 Pax !');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "msgPax", msgPax, true);
            }
        }
        else
        {
            string js = "alert('Please select vessel !');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msgvsl", js, true);
        }
    }
예제 #4
0
    private void CheckForChangesInRequest()
    {
        DataTable dtFlight = (DataTable)ViewState["SegmentDetails_Original"];

        int    i             = 0;
        string strNewSegment = "";

        foreach (GridViewRow gr in GrdFlight.Rows)
        {
            UserControl_ctlAirPortList txtFrom1 = (gr.FindControl("txtFrom1") as UserControl_ctlAirPortList);
            UserControl_ctlAirPortList txtTo1   = (gr.FindControl("txtTo1") as UserControl_ctlAirPortList);
            TextBox      txtDepDate1            = (gr.FindControl("txtDepDate1") as TextBox);
            DropDownList cmbDepHours1           = (gr.FindControl("cmbDepHours1") as DropDownList);
            DropDownList cmbDepMins1            = (gr.FindControl("cmbDepMins1") as DropDownList);
            if (i < dtFlight.Rows.Count)
            {
                DataRow dr = dtFlight.Rows[i];

                StringBuilder sbEachSegment = new StringBuilder("");

                if (txtFrom1.Text.Trim() != dr["travelOrigin"].ToString().Trim())
                {
                    sbEachSegment.Append("&nbsp; Old From : " + dr["travelOrigin"].ToString() + "  ,  ");
                    sbEachSegment.Append("New From : " + txtFrom1.Text);
                }


                if (txtTo1.Text != dr["travelDestination"].ToString())
                {
                    sbEachSegment.Append("<br>&nbsp; Old To : " + dr["travelDestination"].ToString() + "  ,  ");
                    sbEachSegment.Append("New To : " + txtTo1.Text);
                }

                string Deptdt = "", DeptDT_old = "";
                string sMin = "", sMin_old = "";
                string sHour = "", sHour_old = "";
                if (txtDepDate1.Text != dr["departureDate"].ToString() || cmbDepMins1.SelectedValue != dr["PrefDepmins"].ToString() || cmbDepHours1.SelectedValue != dr["PrefDephours"].ToString())
                {
                    DeptDT_old = dr["departureDate"].ToString();
                    Deptdt     = txtDepDate1.Text;
                    sMin_old   = dr["PrefDepmins"].ToString();
                    sMin       = cmbDepMins1.Text;
                    sHour_old  = dr["PrefDephours"].ToString();
                    sHour      = cmbDepHours1.Text;
                    sbEachSegment.Append("<br>&nbsp; Old Dept Date : " + DeptDT_old + " : " + sHour_old + " : " + sMin_old + "  ,  New Date : " + Deptdt + " : " + sHour + " : " + sMin);
                }

                if (sbEachSegment.ToString() != "")
                {
                    Changes_Remark.Append("<br><br><b>Following changes in segment : " + (i + 1) + "</b><br><br> " + sbEachSegment.ToString());
                }
            }
            else
            {
                strNewSegment += txtFrom1.Text + "&nbsp;&nbsp;&nbsp;" + txtTo1.Text + "&nbsp;&nbsp;&nbsp;" + txtDepDate1.Text + " : " + cmbDepHours1.Text + " : " + cmbDepMins1.Text + "<br>";
            }

            i++;
        }

        if (strNewSegment != "")
        {
            Changes_Remark.Append("<br><b>Segment added : </b><br><br>" + strNewSegment);
        }
        string RemovedSegment = "";

        if (dtFlight.Rows.Count > GrdFlight.Rows.Count)
        {
            for (int iFlt = 0; iFlt < dtFlight.Rows.Count; iFlt++)
            {
                if (iFlt >= GrdFlight.Rows.Count)
                {
                    RemovedSegment += dtFlight.Rows[iFlt]["travelOrigin"].ToString() + "&nbsp;&nbsp;&nbsp;" + dtFlight.Rows[iFlt]["travelDestination"].ToString() + "&nbsp;&nbsp;&nbsp;" + dtFlight.Rows[iFlt]["departureDate"].ToString() + " : " + dtFlight.Rows[iFlt]["PrefDephours"].ToString() + " : " + dtFlight.Rows[iFlt]["PrefDepmins"].ToString() + "<br>";
                }
            }
        }

        if (RemovedSegment != "")
        {
            Changes_Remark.Append("<br><b>Removed segment : </b><br><br>" + RemovedSegment);
        }

        #region ------- check fot pax -------------

        DataTable dtPax_Original = (DataTable)ViewState["PaxDetails_Original"];
        DataTable dtPax          = (DataTable)ViewState["DataTable"];


        StringBuilder sbNewPax = new StringBuilder();
        foreach (DataRow drPax in dtPax.Rows)
        {
            if (!dtPax_Original.Rows.Contains(drPax["ID"]))
            {
                sbNewPax.Append("  " + drPax["Name"].ToString() + "<br>");
            }
        }
        if (sbNewPax.ToString().Trim().Length > 0)
        {
            Changes_Remark.Append("<br><br><b>New pax added :  </b><br><br> ");
            Changes_Remark.Append(sbNewPax.ToString());
        }



        StringBuilder sbDeletedpax = new StringBuilder();
        foreach (DataRow drPax in dtPax_Original.Rows)
        {
            if (!dtPax.Rows.Contains(drPax["ID"]))
            {
                sbDeletedpax.Append("  " + drPax["Name"].ToString() + "<br>");
            }
        }
        if (sbDeletedpax.ToString().Trim().Length > 0)
        {
            Changes_Remark.Append("<br><br><b>Pax removed :</b> <br><br> ");
            Changes_Remark.Append(sbDeletedpax.ToString());
        }

        #endregion check for pax
    }