/// <summary>
        /// Get Travel Request by RequestID
        /// </summary>
        /// <param name="RequestID"></param>
        /// <returns>Dataset filled with 1 table having travel request details</returns>
        public DataSet GetTravelRequestByID(int RequestID, int AgentID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.GET_TravelRequest_ByID(RequestID, AgentID)); }
            catch { throw; }
        }
        /// <summary>
        /// return list of fleets
        /// </summary>
        /// <returns>Dataset with list of fleets</returns>
        public DataSet GetFleetList()
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.GetFleetList()); }
            catch { throw; }
        }
        /// <summary>
        /// Get all travel Requests in a hyrarichel manner with request at top and pax underneath
        /// </summary>
        /// <returns>Dataset with 2 tables. Parent & child. Parent Table = Request, Child table = Pax</returns>
        public DataSet GetRequestList()
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.GET_TravelRequest()); }
            catch { throw; }
        }
        /// <summary>
        /// Remove Pax from an exisiting request.
        /// </summary>
        /// <param name="RequestID">Exisitng request id</param>
        /// <param name="StaffID">Staffid to be added to the list</param>
        /// <param name="RemovedBy">Person name adding pax to the request</param>
        /// <returns>true on success, false otherwise</returns>
        public Boolean RemovePaxFromTravelRequest(int RequestPaxId, int Deleted_By)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Remove_PAX_From_TravelRequest(RequestPaxId, Deleted_By)); }
            catch { throw; }
        }
        /// <summary>
        /// Add Flights to the existing request
        /// </summary>
        /// <param name="RequestID">Existing request id</param>
        /// <param name="FlightDetail">object wrapped in trv_request class</param>
        /// <returns>true on success, false otherwise</returns>
        public Boolean AddFlightToTravelRequest(int RequestID, TRV_Request FlightDetail)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.ADD_FLIGHT_TO_TravelRequest(RequestID, FlightDetail)); }
            catch { throw; }
        }
        /// <summary>
        /// Update eTicketNumber to the travel request flight
        /// </summary>
        /// <param name="id">flight id for which eTicketNumber has to be updated</param>
        /// <param name="eTicketNumber">eTicketNumber</param>
        /// <returns>true on success, false otherwise</returns>
        public Boolean UpdateETicketNumber(int RequestID, int Flightid, string eTicketNumber, int updated_by, int PaxID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Update_eTicketNumber(RequestID, Flightid, eTicketNumber, updated_by, PaxID)); }
            catch { throw; }
        }
        /// <summary>
        /// returns list of vessels
        /// </summary>
        /// <param name="FleetCode">fleetcode for which vessel list is required.</param>
        /// <returns>Dataset as list of vessels</returns>
        public DataSet GetVesselList(int @FleetCode)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.GetVesselList(FleetCode)); }
            catch { throw; }
        }
        /// <summary>
        /// Add Flights to the existing request
        /// </summary>
        /// <param name="RequestID">Existing request id</param>
        /// <param name="FlightDetail">object wrapped in trv_request class</param>
        /// <returns>true on success, false otherwise</returns>
        public DataSet GetFlightByRequestID(int RequestID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_Fligts_By_RequestID(RequestID)); }
            catch { throw; }
        }
        /// <summary>
        /// Create a new travel request
        /// </summary>
        /// <param name="newRequest">object as new request with all properties set</param>
        /// <returns>New created request id</returns>
        public int CreateTravelRequest(TRV_Request newRequest, int Vessel_ID = 0, int ReqID = 0, string Change_Remark = "")
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.ADD_TravelRequest(newRequest, Vessel_ID, ReqID, Change_Remark)); }
            catch { throw; }
        }
        /// <summary>
        /// Add Remarks in travel request
        /// </summary>
        /// <param name="requestid">Request id to add remarks</param>
        /// <param name="remarks">remarks to be added</param>
        /// <param name="remarkby">username adding remarks</param>
        /// <param name="agentid">agent id if remark is added by agent/supplier</param>
        /// <returns></returns>
        public Boolean AddRemarks(int requestid, string remarks, int remarkby, int agentid, string RemarkAgentIDs = "")
        {
            DataTable dtAgentIDs = new DataTable();

            dtAgentIDs.Columns.Add("TAID");
            DataRow drID;

            foreach (string sid in RemarkAgentIDs.Split(','))
            {
                if (sid.Trim() != "")
                {
                    drID         = dtAgentIDs.NewRow();
                    drID["TAID"] = sid;
                    dtAgentIDs.Rows.Add(drID);
                }
            }



            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Add_Remarks(requestid, remarks, remarkby, agentid, dtAgentIDs)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        /// <summary>
        /// Get Current status of request
        /// </summary>
        /// <param name="RequestID">Request id for which status is seed</param>
        /// <param name="AgentID">Agent id if status is request at agent level, 0 otherwise</param>
        /// <returns>string as result</returns>
        public string GetCurrentStatus(int RequestID, int AgentID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_Current_Status(RequestID, AgentID)); }
            catch { throw; }
        }
        /// <summary>
        /// Save email in database
        /// </summary>
        /// <param name="subject">suject of email</param>
        /// <param name="mailTO">mail to list, separated by commas</param>
        /// <param name="MailCC">mail to cc list, separated by commas</param>
        /// <param name="body">mail body</param>
        /// <param name="userid">user id sending this email</param>
        /// <returns>int, newly created email record id in database</returns>
        public int SaveEmail(string subject, string mailTO, string MailCC, string body, int userid)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Save_Email(subject, mailTO, MailCC, body, userid)); }
            catch { throw; }
        }
        /// <summary>
        /// Get Agetn list to whom RFQ has been sent
        /// </summary>
        /// <param name="RequestID">Request ID</param>
        /// <returns>Agent list as datatable</returns>
        public DataTable GetQuoteAgents(int RequestID, int Quoted)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_Quote_Agent(RequestID, Quoted)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        public int Update_Travel_Flag(int AgentReqstID, int Userid, int RequsetID = 0)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Update_Travel_Flag(AgentReqstID, Userid, RequsetID)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        public int ResetQuotation(int RequestID, int AgentID, int QuoteID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Reset_Quotations(RequestID, AgentID, QuoteID)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        /// <summary>
        /// Cancels the travel request
        /// </summary>
        /// <param name="RequestID">Requestid to be cancelled</param>
        /// <returns>true on success, false otherwise</returns>
        public Boolean CancelRequest(int RequestID, int Deleted_By)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Cancel_TravelRequest(RequestID, Deleted_By)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        /// <summary>
        /// Put the request for Refund.
        /// </summary>
        /// <param name="RequestID">request id to put for refund</param>
        /// <returns>true on successfull</returns>
        public Boolean RefundRequest(int RequestID, int Created_By, string Refund_Remarks)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Refund_Request_DL(RequestID, Created_By, Refund_Remarks)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        public DataTable GetRoutInfo(int RequestID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.GetRoutInfo(RequestID)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        public DataSet Get_Request_Pax(int RequestID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_Request_Pax_DL(RequestID)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        public string Get_Pax_Validation(int RequestID, string Action)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_Pax_Validation_DL(RequestID, Action)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        public DataTable Get_ETicket_By_RequestID(int RequestID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_ETicket_By_RequestID_DL(RequestID)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="crewid"></param>
        /// <param name="userid"></param>
        /// <param name="Search_Text"></param>
        /// <returns></returns>
        public DataSet Get_SearchCrew(int crewid, int EventID, int VoyageID, int userid, string Search_Text)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_SearchCrew_DL(crewid, EventID, VoyageID, userid, Search_Text)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        /// <summary>
        /// Get crew list by event id
        /// </summary>
        /// <param name="VoyageID">voyage id for which crew list is desired</param>
        /// <returns>Dataset containing the list of crew</returns>
        public DataSet GetCrewListByVoyageID(int EventID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try { return(TRequest.Get_CrewList_By_EventID(EventID)); }
            catch { throw; }
            finally { TRequest = null; }
        }
        /// <summary>
        /// Add Pax to an exisiting request.
        /// </summary>
        /// <param name="RequestID">Exisitng request id</param>
        /// <param name="StaffID">Staffid to be added to the list</param>
        /// <param name="CreatedBy">Person name adding pax to the request</param>
        /// <returns>true on success, false otherwise</returns>
        public Boolean AddPaxToTravelRequest(int RequestID, int StaffID, int CreatedBy, int VoyageID, int EventID)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try
            {
                return(TRequest.ADD_PAX_IN_TravelRequest(RequestID, StaffID, CreatedBy, VoyageID, EventID));
            }
            catch { throw; }
        }
        public DataSet GetRequestList(int vessel_id, string stage, string request_id, string pax_name, string airport, int agentid, ref int rowcount)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try
            {
                //return TRequest.GET_TravelRequest();
                return(TRequest.Search_Travel_Request(vessel_id, stage, request_id, pax_name, airport, agentid, ref rowcount));
            }
            catch { throw; }
        }
        public string RequestUserPreference(int RequestID, int UserID, DataTable dtUser)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try
            {
                return(TRequest.RequestUserPreference_DL(RequestID, UserID, dtUser));
            }
            catch { throw; }
            finally { TRequest = null; }
        }
        public DataTable GetPersonNameToTravelWithinfiveDays(string staffid)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try
            {
                return(TRequest.GetPersonNameToTravelWithinfiveDays(staffid));
            }
            catch { throw; }
            finally { TRequest = null; }
        }
        public DataSet Get_TravelRequests_Agent(int UserID, int fleetid, int vesselid, string travelFrom,
                                                string travelTo, string dateFrom, string dateTo, string name, string status, int?pagenumber, int?pagesize, ref int isfetchcount, int?AppCompanyID, int?QuotedBY = null, int?RequestedBy = null)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try
            {
                //return TRequest.GET_TravelRequest_By_AgentID(AgentID);
                return(TRequest.Get_TravelRequests_Agent_DL(fleetid, vesselid, UserID, travelFrom, travelTo, dateFrom, dateTo, name, status, pagenumber, pagesize, ref isfetchcount, AppCompanyID, QuotedBY, RequestedBy));
            }
            catch { throw; }
        }
        public DataSet GetRequestList(int?fleetid, int?vesselid, int?agentid, string travelFrom,
                                      string travelTo, string dateFrom, string dateTo, string name, string status, int?Approver_ID, int?pagenumber, int?pagesize, ref int isfetchcount)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();

            try
            {
                //return TRequest.GET_TravelRequest();
                return(TRequest.Search_Travel_Request(fleetid, vesselid, agentid, travelFrom, travelTo, dateFrom, dateTo, name, status, Approver_ID, pagenumber, pagesize, ref isfetchcount));
            }
            catch { throw; }
        }
        /// <summary>
        /// Get Remarks
        /// </summary>
        /// <param name="requestid">Requestid to get the remarks for</param>
        /// <param name="agentid">AgentID </param>
        /// <returns></returns>
        public DataSet GetRemarks(int requestid, int agentid)
        {
            DAL_TRV_Request TRequest = new DAL_TRV_Request();
            DataSet         ds       = new DataSet();

            try
            {
                ds = TRequest.Get_Remarks(requestid, agentid);
                return(ds);
            }
            catch { throw; }
            finally { TRequest = null; }
        }