protected void uoVendorType_Click(object sender, EventArgs e)
        {
            ViewState["PortAgenRequestVendor"] = null;

            PortBLL = new PortAgentBLL();

            List <PortAgenRequestVendor> lst = new List <PortAgenRequestVendor>();
            RadioButtonList r = (RadioButtonList)sender;

            if (r.Text == "Hotel")
            {
                lst = PortBLL.GetNonTurnporHotelProviderVendor(1, GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value), 0);
            }
            else if (r.Text == "Service Provider")
            {
                lst = PortBLL.GetNonTurnporHotelProviderVendor(0, GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value), 0);
            }

            if (lst.Count > 0)
            {
                uoVendorDropDownList.DataSource     = lst;
                uoVendorDropDownList.DataTextField  = "VendorName";
                uoVendorDropDownList.DataValueField = "VendorID";

                uoVendorDropDownList.DataBind();
                uoVendorDropDownList.Items.Insert(0, new ListItem("--Select Vendor--", "0"));
            }

            ViewState["PortAgenRequestVendor"] = lst;
        }
        /// -------------------------------------------------------------------
        /// Author:         Josephine Gad
        /// Date Created:   05/Mar/2014
        /// Descrption:     Bind Service Provider in DropDownList
        /// -------------------------------------------------------------------
        /// Modified By:    Josephine Gad
        /// Date Modified:  07/Jul/2014
        /// Descrption:     If Session is NULL go to BLL.GetPortAgentListByPortId
        /// -------------------------------------------------------------------
        private void BindPortAgent()
        {
            PortAgentBLL        BLL  = new PortAgentBLL();
            List <PortAgentDTO> list = new List <PortAgentDTO>();

            uoDropDownListPortAgent.Items.Clear();
            uoDropDownListPortAgent.Items.Add(new ListItem("--Select Service Provider--", "0"));

            if (Session["PortAgentDTO"] != null)
            {
                list = (List <PortAgentDTO>)Session["PortAgentDTO"];
            }
            else
            {
                list = BLL.GetPortAgentListByPortId(GlobalCode.Field2Int(uoDropDownListPortAgent.SelectedValue),
                                                    uoHiddenFieldUser.Value, uoHiddenFieldRole.Value);
                Session["PortAgentDTO"] = list;
            }
            uoDropDownListPortAgent.DataSource     = list;
            uoDropDownListPortAgent.DataTextField  = "PortAgentName";
            uoDropDownListPortAgent.DataValueField = "PortAgentID";
            uoDropDownListPortAgent.DataBind();

            if (list.Count == 1)
            {
                uoDropDownListPortAgent.SelectedValue = list[0].PortAgentID;
            }
            else if (uoDropDownListPortAgent.Items.FindByValue(uoHiddenFieldPortAgentID.Value) != null)
            {
                uoDropDownListPortAgent.SelectedValue = uoHiddenFieldPortAgentID.Value;
            }
            Session["PortAgentID"]         = uoDropDownListPortAgent.SelectedValue;
            uoHiddenFieldPortAgentID.Value = uoDropDownListPortAgent.SelectedValue;
        }
        protected void uoBtnSaveToExcel_Click(object sender, EventArgs e)
        {
            DataTable dt = null;

            try
            {
                PortAgentBLL PABLL = new PortAgentBLL();
                dt = PABLL.GetOKToBrazilExport(uoHiddenFieldUser.Value);
                if (dt.Rows.Count > 0)
                {
                    CreateFile(dt);
                }
                else
                {
                    AlertMessage("There is no record to export.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Author:         Josephine Gad
        /// Date Created:   10/Apr/2014
        /// Description:    Get the hotel to confirm from Non Turn Port Page
        /// </summary>
        private void GetHotelManifestToAdd()
        {
            bool     IsWithError = false;
            DateTime currentDate = CommonFunctions.GetCurrentDateTime();
            int      iPortID     = GlobalCode.Field2Int(uoHiddenFieldPortID.Value);

            BLL = new PortAgentBLL();
            BLL.PortAgentManifestGetConfirmHotelToAddFromNonTurn(iPortID, uoHiddenFieldUser.Value, uoHiddenFieldRole.Value,
                                                                 "Get Service Provider Hotel Manifest to confirm", "GetHotelToConfirm",
                                                                 Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now);
            List <PortAgentHotelManifestList> listHotel = new List <PortAgentHotelManifestList>();

            if (GlobalCode.Field2String(Session["PortAgentEmailVendor"]) == "")
            {
                IsWithError = true;
                AlertMessageNoRefresh("No assigned active Service Provider Vendor for Hotel Service!");
            }
            if (Session["PortAgentHotelManifestListToConfirmToAdd"] != null)
            {
                listHotel = (List <PortAgentHotelManifestList>)Session["PortAgentHotelManifestListToConfirmToAdd"];
            }
            if (listHotel.Count == 0)
            {
                IsWithError = true;
                AlertMessageNoRefresh("No record to process!");
            }
            if (!IsWithError)
            {
                BindCurrency();
                BindListViewManifest();
                BindRoomType();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Author:         Josephine Gad
        /// Date Created:   11/Apr/2014
        /// Description:    Get the vehicle to confirm from Non Turn Port Page
        /// =====================================================================
        /// Modified by:    Josephine Gad
        /// Date Modified:  14/May/2014
        /// Description:    Use Session["PortAgentDetails"] instead of Session["PortAgentEmailVendor"]
        ///                 in validating Service Provider
        /// </summary>
        private void GetVehicleManifestToAdd()
        {
            bool     IsWithError = false;
            DateTime currentDate = CommonFunctions.GetCurrentDateTime();
            int      iPortID     = GlobalCode.Field2Int(uoHiddenFieldPortID.Value);

            BLL = new PortAgentBLL();
            BLL.PortAgentManifestGetConfirmVehicleToAddFromNonTurn(iPortID, uoHiddenFieldUser.Value, uoHiddenFieldRole.Value,
                                                                   "Get Service Provider Vehicle Request to add", "GetVehicleManifestToAdd",
                                                                   Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now);

            List <PortAgentVehicleManifestList> listVehicle = new List <PortAgentVehicleManifestList>();

            List <PortAgentDTO> listPortAgent = new List <PortAgentDTO>();

            if (Session["PortAgentDetails"] != null)
            {
                listPortAgent = (List <PortAgentDTO>)Session["PortAgentDetails"];
            }
            if (listPortAgent.Count == 0)
            {
                IsWithError = true;
                AlertMessageNoRefresh("No assigned active Service Provider Vendor for Vehicle Service!");
            }

            if (Session["PortAgentVehicleManifestListToConfirmToAdd"] != null)
            {
                listVehicle = (List <PortAgentVehicleManifestList>)Session["PortAgentVehicleManifestListToConfirmToAdd"];
            }
            if (listVehicle.Count == 0)
            {
                IsWithError = true;
                AlertMessageNoRefresh("No record to process!");
            }
            if (!IsWithError)
            {
                BindCurrency();
                BindListViewManifest();
                BindRouteFromTo();
            }
        }
Beispiel #6
0
        /// <summary>
        /// Author:         Josephine Gad
        /// Date Created:   11/Apr/2014
        /// Description:    Get the vehicle to confirm using selected seafarers
        /// </summary>
        private void GetVehicleManifestToConfirm()
        {
            DataTable dt = null;

            try
            {
                string[] sAddCancelArr = Request.QueryString["AddCancel"].Split(",".ToCharArray());
                string[] sIDBigintArr  = Request.QueryString["RecLoc"].Split(",".ToCharArray());
                string[] sIDTReqArr    = Request.QueryString["TReqID"].Split(",".ToCharArray());
                string[] sIDTrans      = Request.QueryString["TransID"].Split(",".ToCharArray());

                int i      = 0;
                int iTotal = sAddCancelArr.Count();
                List <VehicleManifestToConfirm> list = new List <VehicleManifestToConfirm>();
                VehicleManifestToConfirm        item = new VehicleManifestToConfirm();

                if (iTotal > 0)
                {
                    for (i = 0; i < iTotal; i++)
                    {
                        //if (sAddCancelArr[i] == "Add")
                        //{
                        item           = new VehicleManifestToConfirm();
                        item.AddCancel = GlobalCode.Field2String(sAddCancelArr[i]);
                        item.IDBigint  = GlobalCode.Field2Int(sIDBigintArr[i]);
                        item.TReqID    = GlobalCode.Field2Int(sIDTReqArr[i]);
                        item.TransID   = GlobalCode.Field2Int(sIDTrans[i]);

                        list.Add(item);
                        //}
                    }
                    if (list.Count > 0)
                    {
                        dt = getDataTable(list);
                        DateTime currentDate = CommonFunctions.GetCurrentDateTime();

                        BLL = new PortAgentBLL();
                        BLL.PortAgentManifestGetConfirmVehicleToAdd(dt, uoHiddenFieldUser.Value, uoHiddenFieldRole.Value,
                                                                    "Get Service Provider Vehicle Manifest to confirm",
                                                                    "GetVehicleToConfirm", Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now);


                        BindCurrency();
                        BindListViewManifest();
                        BindRouteFromTo();
                    }
                    else
                    {
                        AlertMessage("No record to process!");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
        /// <summary>
        /// Author:         Muhallidin G Wali
        /// Date Created:   12/Apr/2015
        /// Description:    Get the hotel to confirm from Non Turn Port Page
        /// </summary>
        private void GetHotelManifestToAdd()
        {
            try
            {
                ViewState["PortAgenRequestVendor"] = null;
                DataTable table = new DataTable();

                table = CreateTable();

                string   dt       = GlobalCode.Field2String(Request.QueryString["dt"]);
                var      qRow     = Request.QueryString["qTravelReqID"];
                int      PortID   = GlobalCode.Field2Int(Request.QueryString["pID"]);
                int      row      = GlobalCode.Field2Int(Request.QueryString["pRow"]);
                int      PAID     = GlobalCode.Field2Int(Request.QueryString["paID"]);
                string   userID   = uoHiddenFieldUser.Value;
                string[] TableRow = null;

                if (qRow != null)
                {
                    TableRow = qRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                DataRow dr;
                int     c1 = 0; int c2 = 1; int c3 = 2; int c4 = 3;

                if (TableRow != null)
                {
                    for (var i = 0; i < row; i++)
                    {
                        dr = table.NewRow();

                        dr["TransHotelID"] = TableRow[c4];
                        dr["IDBigint"]     = TableRow[c1];
                        dr["TravelReqID"]  = TableRow[c2];
                        dr["SeqNoInt"]     = TableRow[c3];

                        dr["ReqDate"] = GlobalCode.Field2Time(dt);
                        dr["PortID"]  = PortID;
                        dr["UserID"]  = userID;
                        table.Rows.Add(dr);

                        c1 = c1 + 4;
                        c2 = c2 + 4;
                        c3 = c3 + 4;
                        c4 = c4 + 4;
                    }
                }
                uoHiddenFieldStatusID.Value = Request.QueryString["st"];

                PortBLL = new PortAgentBLL();
                List <NonTurnportGenericList> lst   = new List <NonTurnportGenericList>();
                lst = PortBLL.GetPortNonTurnHotelReques(0, GlobalCode.Field2Time(dt), PortID, GlobalCode.Field2Int(Request.QueryString["paID"]), userID, table);

                List <PortAgenRequestVendor> PAList = new List <PortAgenRequestVendor>();
                if (uoHiddenFieldStatusID.Value == "1" && uoHiddenFieldRole.Value == TravelMartVariable.RolePortSpecialist)
                {
                    PAList = lst[0].PortAgenRequestVendor.Where(n => n.VendorID == GlobalCode.Field2Int(Request.QueryString["paID"])).ToList();
                }
                else

                {
                    PAList = lst[0].PortAgenRequestVendor;;
                }



                uoVendorDropDownList.DataSource = PAList;

                uoVendorDropDownList.DataTextField  = "VendorName";
                uoVendorDropDownList.DataValueField = "VendorID";

                uoVendorDropDownList.DataBind();
                uoVendorDropDownList.Items.Insert(0, new ListItem("--Select Vendor--", "0"));


                uoVendorDropDownList.SelectedIndex = GlobalCode.GetselectedIndex(uoVendorDropDownList, GlobalCode.Field2Int(Request.QueryString["paID"]));


                uoDropDownListCurrency.DataSource = lst[0].Currency;



                uoDropDownListCurrency.DataTextField  = "Name";
                uoDropDownListCurrency.DataValueField = "ID";

                uoDropDownListCurrency.DataBind();
                uoDropDownListCurrency.Items.Insert(0, new ListItem("--Select Currency--", "0"));

                uoDropDownListRequestSource.DataSource     = lst[0].Requestor;
                uoDropDownListRequestSource.DataTextField  = "Name";
                uoDropDownListRequestSource.DataValueField = "ID";
                uoDropDownListRequestSource.DataBind();
                uoDropDownListRequestSource.Items.Insert(0, new ListItem("--Select Requestor--", "0"));

                uoDropDownListRequestSource.SelectedIndex = 2;

                ViewState["PortAgenRequestVendor"] = PAList; //lst[0].PortAgenRequestVendor;
                uolistviewHotelInfo.DataSource     = lst[0].NonTurnPortsLists;
                uolistviewHotelInfo.DataBind();

                var PortAgenRequest = PAList; // lst[0].PortAgenRequestVendor.Where(n => n.VendorID == GlobalCode.Field2Int(Request.QueryString["paID"])).ToList();
                if (PortAgenRequest.Count > 0)
                {
                    uoTextBoxHotelname.Text = uoVendorDropDownList.SelectedItem.Text;
                    uoTextBoxEmailAdd.Text  = PortAgenRequest[0].EmailTo;


                    uoTextBoxRateContract.Text = PortAgenRequest[0].DoubleRate.ToString();

                    uoTextBoxRateContractSingle.Text = PortAgenRequest[0].SingleRate.ToString();

                    uoTextBoxRateConfirmed.Text       = PortAgenRequest[0].DoubleRate.ToString();
                    uoTextBoxSingleRateConfirmed.Text = PortAgenRequest[0].SingleRate.ToString();

                    uoTextBoxCheckInDate.Text            = GlobalCode.Field2DateTime(Request.QueryString["dt"]).ToString();
                    uoDropDownListCurrency.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListCurrency, PortAgenRequest[0].CurrentID);
                    uoHiddenFieldContractID.Value        = PortAgenRequest[0].VendorContractID.ToString();
                    uoHiddenFieldVoucher.Value           = PortAgenRequest[0].Voucher.ToString();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        void insertHotelrequest(string spName, string status)
        {
            int?StatusID = null;

            List <NonTurnRequestBooking> PAH = new List <NonTurnRequestBooking>();

            foreach (ListViewDataItem item in uolistviewHotelInfo.Items)
            {
                if (status == "Cancel")
                {
                    StatusID = 5;
                }
                else
                {
                    StatusID = GlobalCode.Field2Int(((HiddenField)item.FindControl("uoHiddenFieldStatusID")).Value);
                }


                PAH.Add(new NonTurnRequestBooking
                {
                    TransHotelID  = GlobalCode.Field2Long(((HiddenField)item.FindControl("uoHiddenFieldTransHotelID")).Value),
                    TravelReqID   = GlobalCode.Field2Long(((HiddenField)item.FindControl("uoHiddenFieldListTRID")).Value),
                    SeafarerID    = GlobalCode.Field2Long(((Label)item.FindControl("uoLblSfID")).Text),
                    IdBigint      = GlobalCode.Field2Long(((HiddenField)item.FindControl("uoHiddenFieldListRecLocID")).Value),
                    RecordLocator = GlobalCode.Field2String(((Label)item.FindControl("uoLblRecLoc")).Text),
                    SeqNo         = GlobalCode.Field2Int(((HiddenField)item.FindControl("uoHiddenFieldSeqNo")).Value),
                    VendorID      = GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value),
                    RoomTypeID    = ((Label)item.FindControl("uoLblRoom")).Text == "double" ? 2 : 1,
                    CheckIn       = GlobalCode.Field2DateTime(uoTextBoxCheckInDate.Text),
                    CheckOut      = GlobalCode.Field2DateTime(((Label)item.FindControl("uoLblCheckOut")).Text),
                    Duration      = GlobalCode.Field2Int(((Label)item.FindControl("uoLblNites")).Text) <= 0 ? 1 : GlobalCode.Field2Int(((Label)item.FindControl("uoLblNites")).Text),
                    VoucherAmount = GlobalCode.Field2Double(uoHiddenFieldVoucher.Value),
                    ContractID    = GlobalCode.Field2Int(uoHiddenFieldContractID.Value),
                    ApprovedBy    = GlobalCode.Field2String(uoTextBoxConfirmedBy.Text),
                    ApprovedDate  = DateTime.Now.Date,
                    RoomCount     = GlobalCode.Field2Float((((Label)item.FindControl("uoLblRoom"))).Text == "double" ? 0.5 : 1.0),
                    HotelName     = GlobalCode.Field2String(uoTextBoxHotelname.Text),
                    //ConfirmRateMoney = GlobalCode.Field2Double(uoTextBoxRateConfirmed.Text),
                    //ContractedRateMoney = GlobalCode.Field2Double(uoTextBoxRateContract.Text),

                    ConfirmRateMoney    = GlobalCode.Field2Double(((TextBox)item.FindControl("txtContractedRate")).Text),
                    ContractedRateMoney = GlobalCode.Field2Double(((Label)item.FindControl("lblContractedRate")).Text),

                    EmailTo   = GlobalCode.Field2String(uoTextBoxEmailAdd.Text),
                    EmailCC   = GlobalCode.Field2String(uoTextBoxCopy.Text),
                    Comment   = GlobalCode.Field2String(uoTextBoxComment.Text),
                    Currency  = GlobalCode.Field2Int(uoDropDownListCurrency.SelectedItem.Value),
                    ConfirmBy = GlobalCode.Field2String(uoTextBoxConfirmedBy.Text),
                    StatusID  = StatusID,//GlobalCode.Field2Int(((HiddenField)item.FindControl("uoHiddenFieldStatusID")).Value),// == 1 ? 2 : 4 ,
                    IsMedical = GlobalCode.Field2Bool(((HiddenField)item.FindControl("uoHiddenFieldIsMedical")).Value),
                    UserID    = uoHiddenFieldUser.Value
                });
            }

            GlobalCode gc = new GlobalCode();
            DataTable  dt = new DataTable();

            dt = gc.getDataTable(PAH);

            PortBLL = new PortAgentBLL();
            PortBLL.InsertNonTurnTransactionRequestBooking(dt, spName, uoHiddenFieldUser.Value, uoTextBoxEmailAdd.Text, uoTextBoxCopy.Text);
        }
        protected void uoVendorType_Click(object sender, EventArgs e)
        {
            ViewState["NonTurnTransportation"] = null;
            PortAgentBLL PortBLL             = new PortAgentBLL();
            List <NonTurnTransportation> lst = new List <NonTurnTransportation>();
            RadioButtonList r = (RadioButtonList)sender;

            if (r.Text == "Transportation")
            {
                lst = PortBLL.GetNonTurnporTransportionVendor(1, GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value), 0);
            }
            else if (r.Text == "Service Provider")
            {
                lst = PortBLL.GetNonTurnporTransportionVendor(0, GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value), 0);
            }

            if (lst.Count > 0)
            {
                uoVendorDropDownList.DataSource     = lst;
                uoVendorDropDownList.DataTextField  = "VendorName";
                uoVendorDropDownList.DataValueField = "VendorID";
                uoVendorDropDownList.DataBind();
                uoVendorDropDownList.Items.Insert(0, new ListItem("--Select Vendor--", "0"));
            }

            Label       lblRoutFrom;
            Label       lblRoutTo;
            HiddenField uoHiddenFieldRouteFrom;
            HiddenField uoHiddenFieldRouteTo;

            HiddenField uoHiddenFieldAiportArr;

            HiddenField uoHiddenFieldHotel;
            HiddenField uoHiddenFieldSeaport;

            if (r.Text == "On")
            {
                uoDropDownListTFrom.SelectedIndex = 3;
                uoDropDownListTTo.SelectedIndex   = 2;
                foreach (ListViewDataItem item in uoListviewVehicleInfo.Items)
                {
                    lblRoutFrom = (Label)item.FindControl("lblRouteFrom");
                    lblRoutTo   = (Label)item.FindControl("lblRouteTo");

                    uoHiddenFieldRouteFrom = (HiddenField)item.FindControl("uoHiddenFieldRouteFrom");
                    uoHiddenFieldRouteTo   = (HiddenField)item.FindControl("uoHiddenFieldRouteTo");

                    uoHiddenFieldAiportArr = (HiddenField)item.FindControl("uoHiddenFieldAiportArr");
                    uoHiddenFieldHotel     = (HiddenField)item.FindControl("uoHiddenFieldHotel");


                    lblRoutFrom.Text = uoHiddenFieldAiportArr.Value;
                    lblRoutTo.Text   = uoHiddenFieldHotel.Value;

                    uoHiddenFieldRouteFrom.Value = uoHiddenFieldAiportArr.Value;
                    uoHiddenFieldRouteTo.Value   = uoHiddenFieldHotel.Value;
                }
            }
            else if (r.Text == "Off")
            {
                uoDropDownListTFrom.SelectedIndex = 1;
                uoDropDownListTTo.SelectedIndex   = 2;
                foreach (ListViewDataItem item in uoListviewVehicleInfo.Items)
                {
                    lblRoutFrom                  = (Label)item.FindControl("lblRouteFrom");
                    lblRoutTo                    = (Label)item.FindControl("lblRouteTo");
                    uoHiddenFieldRouteFrom       = (HiddenField)item.FindControl("uoHiddenFieldRouteFrom");
                    uoHiddenFieldRouteTo         = (HiddenField)item.FindControl("uoHiddenFieldRouteTo");
                    uoHiddenFieldHotel           = (HiddenField)item.FindControl("uoHiddenFieldHotel");
                    uoHiddenFieldSeaport         = (HiddenField)item.FindControl("uoHiddenFieldSeaport");
                    lblRoutFrom.Text             = uoHiddenFieldSeaport.Value;
                    lblRoutTo.Text               = uoHiddenFieldHotel.Value;
                    uoHiddenFieldRouteFrom.Value = uoHiddenFieldSeaport.Value;
                    uoHiddenFieldRouteTo.Value   = uoHiddenFieldHotel.Value;
                }
            }
            ViewState["NonTurnTransportation"] = lst;
        }
        /// <summary>
        /// Author:         Muhallidin G Wali
        /// Date Created:   12/Apr/2015
        /// Description:    Get the hotel to confirm from Non Turn Port Page
        /// </summary>
        private void GetVehicleManifestToConfirm()
        {
            try
            {
                ViewState["NonTurnTransportation"] = null;

                DataTable table = new DataTable();

                table = CreateTableCancelled();

                string dt = GlobalCode.Field2String(Request.QueryString["dt"]);

                var qRecLocRow  = Request.QueryString["RecLoc"];
                var qTReqIDRow  = Request.QueryString["TReqID"];
                var qTransIDRow = Request.QueryString["TransID"];

                int PortID      = GlobalCode.Field2Int(Request.QueryString["pID"]);
                int row         = GlobalCode.Field2Int(Request.QueryString["pRow"]);
                int PortAgentID = GlobalCode.Field2Int(Request.QueryString["pPAID"]);

                string   userID         = uoHiddenFieldUser.Value;
                string[] TRTableRow     = null;
                string[] ReclocTableRow = null;
                string[] TransTableRow  = null;

                if (qTReqIDRow != null)
                {
                    TRTableRow = qTReqIDRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }

                if (qRecLocRow != null)
                {
                    ReclocTableRow = qRecLocRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                if (qTransIDRow != null)
                {
                    TransTableRow = qTransIDRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }


                DataRow dr;


                //if (TRTableRow != null)
                //{
                for (var i = 0; i < row; i++)
                {
                    dr = table.NewRow();

                    dr["TransVehicleID"] = TransTableRow[i] == null ? 0 : GlobalCode.Field2Long(TransTableRow[i]);
                    dr["IDBigint"]       = ReclocTableRow[i] == null ? 0 : GlobalCode.Field2Long(ReclocTableRow[i]);
                    dr["TravelReqID"]    = TRTableRow[i] == null ? 0 : GlobalCode.Field2Long(TRTableRow[i]);


                    dr["SeqNoInt"] = 0;

                    dr["ReqDate"] = GlobalCode.Field2Time(dt);
                    dr["PortID"]  = PortID;
                    dr["UserID"]  = userID;
                    table.Rows.Add(dr);
                }



                PortAgentBLL PortBLL = new PortAgentBLL();
                List <NonTurnportGenericList> lst = new List <NonTurnportGenericList>();
                lst = PortBLL.GetPortNonTurnTransportationRequest(2, GlobalCode.Field2Time(dt), PortID, userID, table);

                uoVendorDropDownList.DataSource     = lst[0].NonTurnTransportation;
                uoVendorDropDownList.DataTextField  = "VendorName";
                uoVendorDropDownList.DataValueField = "VendorID";
                uoVendorDropDownList.DataBind();
                uoVendorDropDownList.Items.Insert(0, new ListItem("--Select Vendor--", "0"));


                uoVendorDropDownList.SelectedIndex = GlobalCode.GetselectedIndex(uoVendorDropDownList, PortAgentID);



                if (lst[0].NonTurnTransportation.Count > 0)
                {
                    var res = lst[0].NonTurnTransportation.Where(e => e.VendorID == PortAgentID).ToList();


                    if (res.Count > 0)
                    {
                        uoTextBoxEmailAdd.Text = res[0].Email.ToString();
                    }
                }



                uoDropDownListCurrency.DataSource     = lst[0].Currency;
                uoDropDownListCurrency.DataTextField  = "Name";
                uoDropDownListCurrency.DataValueField = "ID";
                uoDropDownListCurrency.DataBind();
                uoDropDownListCurrency.Items.Insert(0, new ListItem("--Select Currency--", "0"));



                uoDropDownListVehicleType.DataSource     = lst[0].VehicleType;
                uoDropDownListVehicleType.DataTextField  = "VehicleTypeName";
                uoDropDownListVehicleType.DataValueField = "VehicleTypeID";
                uoDropDownListVehicleType.DataBind();
                uoDropDownListVehicleType.Items.Insert(0, new ListItem("--Select Vehicle Type--", "0"));



                uoDropDownListRequestSource.DataSource     = lst[0].Requestor;
                uoDropDownListRequestSource.DataTextField  = "Name";
                uoDropDownListRequestSource.DataValueField = "ID";
                uoDropDownListRequestSource.DataBind();
                uoDropDownListRequestSource.Items.Insert(0, new ListItem("--Select Request Source--", "0"));
                uoDropDownListRequestSource.SelectedIndex = 2;

                ViewState["NonTurnTransportation"] = lst[0].NonTurnTransportation;

                uoListviewVehicleInfo.DataSource = lst[0].PortAgentVehicleManifestList;
                uoListviewVehicleInfo.DataBind();
                uoButtonEmail.Text = "Cancel";

                RadioButtonList1.Visible = false;

                if (lst[0].PortAgentVehicleManifestList.Count > 0)
                {
                    uoTextBoxPickupDate.Text   = GlobalCode.Field2Date(lst[0].PortAgentVehicleManifestList[0].PickupDate);
                    uoTextBoxPickupTime.Text   = GlobalCode.Field2String(lst[0].PortAgentVehicleManifestList[0].PickupTime);
                    uoTextBoxRateContract.Text = GlobalCode.Field2String(lst[0].PortAgentVehicleManifestList[0].RateContracted);


                    uoDropDownListTFrom.SelectedIndex    = GlobalCode.GetselectedIndex(uoDropDownListTFrom, lst[0].PortAgentVehicleManifestList[0].RouteFromID);
                    uoDropDownListTTo.SelectedIndex      = GlobalCode.GetselectedIndex(uoDropDownListTTo, lst[0].PortAgentVehicleManifestList[0].RouteToID);
                    uoDropDownListCurrency.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListCurrency, lst[0].PortAgentVehicleManifestList[0].CurrencyID);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Author:         Muhallidin G Wali
        /// Date Created:   12/Apr/2015
        /// Description:    Get the hotel to confirm from Non Turn Port Page
        /// </summary>
        private void GetVehicleManifestToAdd()
        {
            try
            {
                //ViewState["NonTurnTransportation"] = null;

                DataTable table = new DataTable();

                table = CreateTable();

                string dt          = GlobalCode.Field2String(Request.QueryString["dt"]);
                var    qRow        = Request.QueryString["qTravelReqID"];
                int    PortID      = GlobalCode.Field2Int(Request.QueryString["pID"]);
                int    PortAgentID = GlobalCode.Field2Int(Request.QueryString["paID"]);
                int    st          = GlobalCode.Field2Int(Request.QueryString["st"]);
                int    row         = GlobalCode.Field2Int(Request.QueryString["pRow"]);

                //document.getEl6ementById("uoNonTurnPageRoute").href = "../PortAgent/PortAgentVehicleEditor2.aspx?Action=Add&AddCancel=Add" +
                //    "&dt=" + chdate + "&qTravelReqID=" + mydata + "&pID=" + 0 + "&pRow=" + n + "&paID=" + getQuerystringData("PA") + "&st=" + getQuerystringData("st");
                //document.getElementById("uoNonTurnPageRoute").click();


                string   userID   = uoHiddenFieldUser.Value;
                string[] TableRow = null;

                if (qRow != null)
                {
                    TableRow = qRow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }
                DataRow dr;
                int     c1 = 0; int c2 = 1; int c3 = 2;  int c4 = 3;


                if (TableRow != null)
                {
                    for (var i = 0; i < row; i++)
                    {
                        dr = table.NewRow();


                        dr["TransVehicleID"] = TableRow[c4];
                        dr["IDBigint"]       = TableRow[c1];

                        dr["TravelReqID"] = TableRow[c2];
                        dr["SeqNo"]       = TableRow[c3];
                        dr["ReqDate"]     = GlobalCode.Field2Time(dt);
                        dr["PortID"]      = PortID;
                        dr["UserID"]      = userID;



                        table.Rows.Add(dr);

                        c1 = c1 + 4;
                        c2 = c2 + 4;
                        c3 = c3 + 4;
                        c4 = c4 + 4;
                    }
                }


                PortAgentBLL PortBLL = new PortAgentBLL();
                List <NonTurnportGenericList> lst = new List <NonTurnportGenericList>();
                lst = PortBLL.GetPortNonTurnTransportationRequest(0, GlobalCode.Field2Time(dt), PortID, PortAgentID, userID, table);


                //=======================

                uoVendorDropDownList.DataSource     = lst[0].NonTurnTransportation;
                uoVendorDropDownList.DataTextField  = "VendorName";
                uoVendorDropDownList.DataValueField = "VendorID";
                uoVendorDropDownList.DataBind();
                uoVendorDropDownList.Items.Insert(0, new ListItem("--Select Vendor--", "0"));


                uoVendorDropDownList.SelectedIndex = GlobalCode.GetselectedIndex(uoVendorDropDownList, PortAgentID);



                if (lst[0].NonTurnTransportation.Count > 0)
                {
                    var res = lst[0].NonTurnTransportation.Where(e => e.VendorID == PortAgentID).ToList();
                    if (res.Count > 0)
                    {
                        uoTextBoxEmailAdd.Text = res[0].Email.ToString();
                    }
                }



                uoDropDownListCurrency.DataSource     = lst[0].Currency;
                uoDropDownListCurrency.DataTextField  = "Name";
                uoDropDownListCurrency.DataValueField = "ID";
                uoDropDownListCurrency.DataBind();
                uoDropDownListCurrency.Items.Insert(0, new ListItem("--Select Currency--", "0"));



                uoDropDownListVehicleType.DataSource     = lst[0].VehicleType;
                uoDropDownListVehicleType.DataTextField  = "VehicleTypeName";
                uoDropDownListVehicleType.DataValueField = "VehicleTypeID";
                uoDropDownListVehicleType.DataBind();
                uoDropDownListVehicleType.Items.Insert(0, new ListItem("--Select Vehicle Type--", "0"));



                uoDropDownListRequestSource.DataSource     = lst[0].Requestor;
                uoDropDownListRequestSource.DataTextField  = "Name";
                uoDropDownListRequestSource.DataValueField = "ID";
                uoDropDownListRequestSource.DataBind();
                uoDropDownListRequestSource.Items.Insert(0, new ListItem("--Select Request Source--", "0"));
                uoDropDownListRequestSource.SelectedIndex = 2;

                ViewState["NonTurnTransportation"] = lst[0].NonTurnTransportation;

                uoListviewVehicleInfo.DataSource = lst[0].PortAgentVehicleManifestList;
                uoListviewVehicleInfo.DataBind();

                RadioButtonList1.Visible = false;

                if (lst[0].PortAgentVehicleManifestList.Count > 0)
                {
                    uoTextBoxPickupDate.Text   = GlobalCode.Field2Date(lst[0].PortAgentVehicleManifestList[0].PickupDate);
                    uoTextBoxPickupTime.Text   = GlobalCode.Field2String(lst[0].PortAgentVehicleManifestList[0].PickupTime);
                    uoTextBoxRateContract.Text = GlobalCode.Field2String(lst[0].PortAgentVehicleManifestList[0].RateContracted);

                    uoDropDownListTFrom.SelectedIndex    = GlobalCode.GetselectedIndex(uoDropDownListTFrom, lst[0].PortAgentVehicleManifestList[0].RouteFromID);
                    uoDropDownListTTo.SelectedIndex      = GlobalCode.GetselectedIndex(uoDropDownListTTo, lst[0].PortAgentVehicleManifestList[0].RouteToID);
                    uoDropDownListCurrency.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListCurrency, lst[0].PortAgentVehicleManifestList[0].CurrencyID);
                }



                //ViewState["NonTurnTransportation"] = lst[0].NonTurnTransportation;
                uoListviewVehicleInfo.DataSource = lst[0].PortAgentVehicleManifestList;

                uoListviewVehicleInfo.DataBind();
            }
            catch
            {
            }
        }
        void insertTransportationCancel(string spName)
        {
            Label       uoLblSfID;
            Label       uoLabelLast;
            LinkButton  SeafarerLinkButton;
            Label       uoLblCheckOut;
            Label       uoLblNites;
            Label       uoLblRoom;
            Label       uoLblVessel;
            Label       uoLblRank;
            Label       uoLblCostCenter;
            Label       uoLblRecLoc;
            HiddenField RecLocID;
            HiddenField TravelReqID;
            HiddenField SeqNo;
            Label       lblSFStatus;
            Label       lblRoutFrom;
            Label       lblRoutTo;
            HiddenField TransID;
            HiddenField uoHiddenFieldRouteFrom;
            HiddenField uoHiddenFieldRouteTo;

            List <NonTurnTransportationCancelRequest> PAH = new List <NonTurnTransportationCancelRequest>();

            foreach (ListViewDataItem item in uoListviewVehicleInfo.Items)
            {
                TransID            = (HiddenField)item.FindControl("uoHiddenFieldTransID");
                uoLblSfID          = (Label)item.FindControl("uoLblSfID");
                uoLabelLast        = (Label)item.FindControl("uoLabelLast");
                SeafarerLinkButton = (LinkButton)item.FindControl("SeafarerLinkButton");
                uoLblCheckOut      = (Label)item.FindControl("uoLblCheckOut");
                uoLblNites         = (Label)item.FindControl("uoLblNites");
                uoLblRoom          = (Label)item.FindControl("uoLblRoom");
                lblSFStatus        = (Label)item.FindControl("lblStatus");
                uoLblVessel        = (Label)item.FindControl("uoLblVessel");
                uoLblRank          = (Label)item.FindControl("uoLblRank");
                uoLblCostCenter    = (Label)item.FindControl("Label1");
                uoLblRecLoc        = (Label)item.FindControl("uoLblRecLoc");
                RecLocID           = (HiddenField)item.FindControl("uoHiddenFieldListRecLocID");
                TravelReqID        = (HiddenField)item.FindControl("uoHiddenFieldListTRID");
                SeqNo = (HiddenField)item.FindControl("uoHiddenFieldSeqNo");

                lblRoutFrom = (Label)item.FindControl("lblRouteFrom");
                lblRoutTo   = (Label)item.FindControl("lblRouteTo");

                uoHiddenFieldRouteFrom = (HiddenField)item.FindControl("uoHiddenFieldRouteFrom");
                uoHiddenFieldRouteTo   = (HiddenField)item.FindControl("uoHiddenFieldRouteTo");

                lblRoutFrom.Text = lblRoutFrom.Text == "" ? uoHiddenFieldRouteFrom.Value : lblRoutFrom.Text;
                lblRoutTo.Text   = lblRoutFrom.Text == "" ? uoHiddenFieldRouteTo.Value : lblRoutTo.Text;


                PAH.Add(new NonTurnTransportationCancelRequest
                {
                    TransVehicleID   = GlobalCode.Field2Long(TransID.Value),
                    TravelReqID      = GlobalCode.Field2Long(TravelReqID.Value),
                    SeafarerID       = GlobalCode.Field2Long(uoLblSfID.Text),
                    IdBigint         = GlobalCode.Field2Long(RecLocID.Value),
                    RecordLocator    = GlobalCode.Field2String(uoLblRecLoc.Text),
                    SeqNoInt         = GlobalCode.Field2Int(SeqNo.Value),
                    VehicleVendorID  = GlobalCode.Field2Int(uoVendorDropDownList.SelectedItem.Value),
                    PickUpDate       = GlobalCode.Field2DateTime(uoTextBoxPickupDate.Text),
                    PickUpTime       = GlobalCode.Field2DateTime(uoTextBoxPickupTime.Text),
                    DropOffDate      = GlobalCode.Field2DateTime(uoTextBoxPickupDate.Text),
                    DropOffTime      = GlobalCode.Field2DateTime(uoTextBoxPickupTime.Text),
                    ConfirmationNo   = GlobalCode.Field2String(uoTextBoxConfirmation.Text),
                    VehicleStatus    = "Cancel",
                    VehicleTypeId    = GlobalCode.Field2Int(uoDropDownListVehicleType.SelectedItem.Value),
                    RouteIDFrom      = GlobalCode.Field2Int(uoDropDownListTFrom.SelectedItem.Value),
                    RouteIDTo        = GlobalCode.Field2Int(uoDropDownListTTo.SelectedItem.Value),
                    RouteFromVarchar = GlobalCode.Field2String(lblRoutFrom.Text),
                    RouteToVarchar   = GlobalCode.Field2String(lblRoutTo.Text),
                    ContractId       = GlobalCode.Field2Int(uoHiddenFieldContractID.Value),
                    SFStatus         = GlobalCode.Field2String(lblSFStatus.Text),
                    ConfirmBy        = uoTextBoxConfirmedBy.Text,
                    Comments         = uoTextBoxComment.Text
                });
            }


            GlobalCode gc = new GlobalCode();
            DataTable  dt = new DataTable();

            dt = gc.getDataTable(PAH);

            PortAgentBLL PortBLL = new PortAgentBLL();

            PortBLL.InsertNonTurnTransactionRequestBooking(dt, spName, uoHiddenFieldUser.Value, uoTextBoxEmailAdd.Text, uoTextBoxCopy.Text);
        }