コード例 #1
0
    private void MapCities(String ProviderName)
    {
        ProviderName = ProviderName.ToUpper();
        String strCities = String.Empty;
        DataTable dtCities = new DataTable();
        switch (ProviderName)
        {
            case "ABHIBUS":
            case "SVR":
            case "KALLADA":
            case "KAVERI":
            case "RAJESH":
            case "SAIANJANA":
                AbhibusAPI clsAbhibusAPI = new AbhibusAPI();
                if (ProviderName == "ABHIBUS")
                    strCities = clsAbhibusAPI.getSources("http://www.abhibus.com/api/manabus_kld/server.php", "BUSMANAHY05HBAI");
                else if (ProviderName == "SVR")
                    strCities = clsAbhibusAPI.getSources("http://www.svrtravels.com/api/lovejourney/server.php", "LOVE@SVR");
                else if (ProviderName == "KALLADA")
                    strCities = clsAbhibusAPI.getSources("http://kalladatravels.com/api/lovejourney/server.php", "LVOEJOURNEYAPI");
                else if (ProviderName == "KAVERI")
                    strCities = clsAbhibusAPI.getSources("http://kaveribus.com/api/lovejourney/server.php", "LVOEJOURNEYAPI");
                else if (ProviderName == "RAJESH")
                    strCities = clsAbhibusAPI.getSources("http://rajeshtravels.in/api/lovejourney/server.php", "LOVRAJESHAPI");
                else if (ProviderName == "SAIANJANA")
                    strCities = clsAbhibusAPI.getSources("http://saianjanatravels.in/api/lovejourney/server.php", "LOVEANJANAAPI");
                break;
            case "BITLA":
                BitlaAPI clsBitlaAPI = new BitlaAPI();
                strCities = clsBitlaAPI.getSources("http://api.ticketsimply.com/api", "TSAPI*854LOVEJOURNEY");
                break;
            case "MORNINGSTAR":
                BitlaAPI clsBitlaAPI2 = new BitlaAPI();
                strCities = clsBitlaAPI2.getSources("http://api.ticketsimply.com/api", "TSAPI*1648LOVEJOURNEYDIR");
                break;
            case "TICKETGOOSE":
                TicketGooseAPI clsTicketGooseAPI = new TicketGooseAPI();
                strCities = clsTicketGooseAPI.getSources("http://ticketgoose.com/bookbustickets/services/TGSWS", "ssdtech", "prasadsir");
                break;
            case "EASYBUS":
                EasybusAPI clsEasyBusAPI = new EasybusAPI();
                strCities = clsEasyBusAPI.getSources("http://demoapi.easybus.in/server.aspx", "easybus@123");
                break;
            default:
                break;
        }

        List<KeyValuePair<int, string>> UnmappedItemList = new List<KeyValuePair<int, string>>();
        dtCities = JsonConvert.DeserializeObject<DataTable>(strCities);
        if (dtCities != null && dtCities.Rows.Count > 0)
        {
            Connection = new SqlConnection(ConnectionString);
            try
            {
                command = new SqlCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_Insert_SourceCity";
                command.Connection = Connection;
                Connection.Open();
                foreach (DataRow row in dtCities.Rows)
                {
                    //command for sources table
                    command.Parameters.Add("@ID", SqlDbType.VarChar).Value = row["id"];
                    command.Parameters.Add("@Name", SqlDbType.VarChar).Value = row["name"];
                    command.Parameters.Add("@ProviderName", SqlDbType.VarChar).Value = ProviderName;
                    Object result = command.ExecuteScalar();

                    if (!result.ToString().ToUpper().Equals("SUCCESS"))
                    {
                        UnmappedItemList.Add(new KeyValuePair<int, String>(int.Parse(row["id"].ToString()), row["name"].ToString()));
                    }
                    command.Parameters.Clear();

                }

                Connection.Close();
            }
            catch (Exception ex)
            {
                //to do
                //Log Exception
            }
            finally
            {
                if (Connection.State == ConnectionState.Open)
                    Connection.Close();
            }
        }

        lblCount.InnerText = (UnmappedItemList != null) ? UnmappedItemList.Count.ToString() : "0";
        gvUnmappedItems.DataSource = UnmappedItemList;
        gvUnmappedItems.DataBind();
    }
コード例 #2
0
        private AvailableTrips Rajesh(string RAJESHAPIURL, string RAJESHConsumerKey, string RAJESHConsumerSecret, string RAJESHProviderName, int RAJESHsourceid, int RAJESHdestinationid, string RAJESHdate)
        {
            AvailableTrips objAvailableTrips = new AvailableTrips();
            List<object> objlist = new List<object>();

            AbhibusAPI clsAbhibusAPI = new AbhibusAPI();
            objAvailableTrips = clsAbhibusAPI.getBusAvailability(RAJESHsourceid
                                , RAJESHdestinationid
                                , RAJESHdate
                                , 6
                                , "0"
                                , RAJESHAPIURL
                                , RAJESHConsumerKey
                                , RAJESHProviderName);

            return objAvailableTrips;
        }
コード例 #3
0
 private AvailableTrips SVR(string SVRAPIURL, string SVRConsumerKey, string SVRConsumerSecret, string SVRProviderName, int SVRsourceid, int SVRdestinationid, string SVRdate)
 {
     AvailableTrips objAvailableTrips = new AvailableTrips();
     List<object> objlist = new List<object>();
     AbhibusAPI clsAbhibusAPI = new AbhibusAPI();
     objAvailableTrips = clsAbhibusAPI.getBusAvailability(SVRsourceid
                         , SVRdestinationid
                         , SVRdate
                         , 6
                         , "0"
                         , SVRAPIURL
                         , SVRConsumerKey
                         , SVRProviderName
                         );
     return objAvailableTrips;
 }
コード例 #4
0
        /// <summary>
        /// Method to get available trips for given provider
        /// </summary>
        /// <param name="ProviderName"></param>
        /// <param name="objClientAPIDetails"></param>
        /// <returns>Returns JSON string with list of available trips</returns>
        private SeatsInfo GetTripDetailsByProviderName(ClientAPIDetails objClientAPIDetails, BusesSearchFilter objBusesSearchFilter, String tripId, String markUpFare, String SeatLayoutId)
        {
            SeatsInfo objSeatsInfo = new SeatsInfo();
            try
            {
                switch (objClientAPIDetails.ProviderName)
                {

                    case "ABHIBUS":
                    case "SVR":
                    case "KALLADA":
                    case "KAVERI":
                    case "RAJESH":
                    case "SAIANJANA":
                        AbhibusAPI clsAbhibusAPI = new AbhibusAPI();
                        objSeatsInfo = clsAbhibusAPI.getBusSeatLayout(objBusesSearchFilter.SourceID
                                            , objBusesSearchFilter.DestinationID
                                            , objBusesSearchFilter.JourneyDate
                                            , tripId
                                            , "0"
                                            , objClientAPIDetails.APIURL
                                            , objClientAPIDetails.ConsumerKey);
                        break;
                    case "BITLA":
                    case "MORNINGSTAR":
                        BitlaAPI clsBitlaAPI = new BitlaAPI();
                        objSeatsInfo = clsBitlaAPI.getServiceDetails(tripId
                                            , objClientAPIDetails.APIURL
                                            , objClientAPIDetails.ConsumerKey);

                        break;
                    case "TICKETGOOSE":
                        TicketGooseAPI clsTicketGooseAPI = new TicketGooseAPI();
                        objSeatsInfo = clsTicketGooseAPI.getTripDetailsV2(objBusesSearchFilter.SourceID
                                            , objBusesSearchFilter.DestinationID
                                            , objBusesSearchFilter.JourneyDate
                                            , tripId
                                            , objClientAPIDetails.APIURL
                                            , objClientAPIDetails.ConsumerKey
                                            , objClientAPIDetails.ConsumerSecret);
                        break;
                    //easy bus 18-05-2013
                    case "EASYBUS":
                        EasybusAPI clsEasyBusAPI = new EasybusAPI();
                        objSeatsInfo = clsEasyBusAPI.getLayoutDetails(objBusesSearchFilter.SourceID
                                            , objBusesSearchFilter.DestinationID
                                            , objBusesSearchFilter.JourneyDate
                                            , tripId
                                            , SeatLayoutId
                                            , markUpFare
                                            , "0"
                                            , objClientAPIDetails.APIURL
                                            , objClientAPIDetails.ConsumerKey);
                        break;
                    default:
                        break;
                }
                objSeatsInfo.providerName = objClientAPIDetails.ProviderName;
            }
            catch (Exception ex)
            {
                //to do
                //Log Exception
            }
            return objSeatsInfo;
        }
コード例 #5
0
 private AvailableTrips KAVERI(string KAVERIAPIURL, string KAVERIConsumerKey, string KAVERIConsumerSecret, string KAVERIProviderName, int KAVERIsourceid, int KAVERIdestinationid, string KAVERIdate)
 {
     AvailableTrips objAvailableTrips = new AvailableTrips();
     AbhibusAPI clsAbhibusAPI = new AbhibusAPI();
     objAvailableTrips = clsAbhibusAPI.getBusAvailability(KAVERIsourceid
                         , KAVERIdestinationid
                         , KAVERIdate
                         , 6
                         , "0"
                         , KAVERIAPIURL
                         , KAVERIConsumerKey
                         , KAVERIProviderName);
     return objAvailableTrips;
 }
コード例 #6
0
        public String CancelTicket(String bookingId, String seatNos, String ProviderName, String ConsumerKey, String ConsumerSecret)
        {
            if (ValidateRequest(ConsumerKey, ConsumerSecret))
            {
                ClientAPIList objClientAPIList = new ClientAPIList();

                if (HttpContext.Current.Cache["ClientAPI-" + ConsumerKey] == null)
                    GetAPIProvidersList(ConsumerKey, ConsumerSecret);

                objClientAPIList = (ClientAPIList)HttpContext.Current.Cache["ClientAPI-" + ConsumerKey];

                ClientAPIDetails objClientAPIDetails = objClientAPIList.SingleOrDefault(element => element.ProviderName == ProviderName);

                String strCancelResponse = String.Empty;
                try
                {
                    switch (ProviderName)
                    {
                        case "BITLA":
                        case "MORNINGSTAR":
                            BitlaAPI clsBitlaAPI = new BitlaAPI();
                            strCancelResponse = clsBitlaAPI.cancelTicket(bookingId, seatNos, objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey);
                            break;
                        case "TICKETGOOSE":
                            TicketGooseAPI clsTicketGooseAPI = new TicketGooseAPI();
                            strCancelResponse = clsTicketGooseAPI.confirmTicketCancellation(bookingId, seatNos, objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, objClientAPIDetails.ConsumerSecret);
                            break;
                        case "ABHIBUS":
                        case "SVR":
                        case "KALLADA":
                        case "KAVERI":
                        case "RAJESH":
                        case "SAIANJANA":
                            AbhibusAPI clsAbhiBusAPI = new AbhibusAPI();
                            strCancelResponse = "";//clsAbhiBusAPI.cancelTicket(objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, bookingId);
                            break;
                        case "EASYBUS":
                            EasybusAPI clsEasyBusAPI = new EasybusAPI();
                            strCancelResponse = "";//  clsEasyBusAPI.cancelTicket(bookingId, seatNos, objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, objClientAPIDetails.ConsumerSecret);
                            break;
                        default:
                            break;
                    }
                }
                catch (Exception)
                {
                    //
                }
                return strCancelResponse;
            }
            else
            {
                return null;
                //throw new http exception
                // throw new System.Web.Http.HttpResponseException(HttpStatusCode.Forbidden);
            }
        }
コード例 #7
0
        public string BookTicket(BlockSeats blockSeats, String ConsumerKey, String ConsumerSecret)
        {
            if (ValidateRequest(ConsumerKey, ConsumerSecret))
            {
                ClientAPIList objClientAPIList = new ClientAPIList();

                //if (HttpContext.Current.Cache["ClientAPI-" + ConsumerKey] == null)
                GetAPIProvidersList(ConsumerKey, ConsumerSecret);
                objClientAPIList = (ClientAPIList)HttpContext.Current.Cache["ClientAPI-" + ConsumerKey];
                ClientAPIDetails objClientAPIDetails = objClientAPIList.SingleOrDefault(element => element.ProviderName == blockSeats.ProviderName);
                BookSeatsResponse objBookResponse = new BookSeatsResponse();
                if (objClientAPIDetails != null)
                {
                    try
                    {
                        switch (blockSeats.ProviderName)
                        {
                            case "BITLA":
                            case "MORNINGSTAR":
                                BitlaAPI clsBitlaAPI = new BitlaAPI();
                                objBookResponse = clsBitlaAPI.bookTicket(blockSeats.SourceId, blockSeats.DestinationId, blockSeats.TripId,
                                    objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, blockSeats.NoOfSeats, blockSeats.BoardingId.ToString(), blockSeats.SeatNo, blockSeats.Title, blockSeats.Name,
                                    blockSeats.Age, blockSeats.Sex, blockSeats.Address, blockSeats.BookingRefNo, blockSeats.IdCardType, blockSeats.IdCardNo, blockSeats.IdCardIssuedBy,
                                    blockSeats.MobileNo, blockSeats.EmergencyMobileNo, blockSeats.EmailId);
                                break;
                            case "TICKETGOOSE":
                                TicketGooseAPI clsTicketGooseAPI = new TicketGooseAPI();
                                objBookResponse = clsTicketGooseAPI.BookTicket(blockSeats.BookingId, objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, objClientAPIDetails.ConsumerSecret);
                                break;
                            case "ABHIBUS":
                            case "SVR":
                            case "KALLADA":
                            case "KAVERI":
                            case "RAJESH":
                            case "SAIANJANA":
                                AbhibusAPI clsAbhiBusAPI = new AbhibusAPI();
                                objBookResponse = clsAbhiBusAPI.bookSeats(blockSeats.SourceId, blockSeats.DestinationId, blockSeats.JourneyDate
                                    , blockSeats.TripId, blockSeats.SeatNo, blockSeats.Title, blockSeats.Name, blockSeats.BoardingId, blockSeats.Address
                                    , blockSeats.Name, blockSeats.MobileNo, blockSeats.EmailId, blockSeats.BookingRefNo, objClientAPIDetails.APIURL
                                    , objClientAPIDetails.ConsumerKey);

                                objBookResponse.extraseatinfo = blockSeats.SourceId + "," + blockSeats.DestinationId + "," + blockSeats.JourneyDate
                              + "," + blockSeats.TripId + "," + blockSeats.SeatNo + "," + blockSeats.Title + "," + blockSeats.Name + "," + blockSeats.BoardingId + "," + blockSeats.Address
                              + "," + blockSeats.Name + "," + blockSeats.MobileNo + "," + blockSeats.EmailId + "," + blockSeats.BookingRefNo;
                                break;

                            case "EASYBUS":
                                EasybusAPI clsEasyBusAPI = new EasybusAPI();
                                objBookResponse = clsEasyBusAPI.bookSeats(blockSeats.SourceId, blockSeats.DestinationId, blockSeats.JourneyDate
                                    , blockSeats.TripId, blockSeats.SeatNo, blockSeats.Sex, blockSeats.Name, blockSeats.BoardingId, blockSeats.Address
                                    , blockSeats.Name, blockSeats.MobileNo, blockSeats.EmailId, blockSeats.BookingRefNo, objClientAPIDetails.APIURL
                                    , objClientAPIDetails.ConsumerKey);

                                objBookResponse.extraseatinfo = blockSeats.SourceId + "," + blockSeats.DestinationId + "," + blockSeats.JourneyDate
                              + "," + blockSeats.TripId + "," + blockSeats.SeatNo + "," + blockSeats.Title + "," + blockSeats.Name + "," + blockSeats.BoardingId + "," + blockSeats.Address
                              + "," + blockSeats.Name + "," + blockSeats.MobileNo + "," + blockSeats.EmailId + "," + blockSeats.BookingRefNo;

                                break;
                            default:
                                break;
                        }
                    }
                    catch (Exception ex)
                    {
                        objBookResponse.Message = ex.ToString();
                    }
                }
                else
                {
                    objBookResponse.Message = "no api found";
                }
                return JsonConvert.SerializeObject(objBookResponse);
            }
            else
            {
                return null;
                //throw new http exception
                //throw new System.Web.Http.HttpResponseException(HttpStatusCode.Forbidden);

            }
        }
コード例 #8
0
        /// <summary>
        /// Method to get available trips for given provider
        /// </summary>
        /// <param name="ProviderName"></param>
        /// <param name="objClientAPIDetails"></param>
        /// <returns>Returns JSON string with list of available trips</returns>
        private AvailableTrips GetAvailableTripsByProviderName(ClientAPIDetails objClientAPIDetails, BusesSearchFilter objBusesSearchFilter)
        {
            AvailableTrips objAvailableTrips = new AvailableTrips();
            List<object> objlist = new List<object>();
            switch (objClientAPIDetails.ProviderName)
            {

                case "ABHIBUS":
                case "SVR":
                case "KALLADA":
                case "KAVERI":
                case "RAJESH":
                case "SAIANJANA":
                    AbhibusAPI clsAbhibusAPI = new AbhibusAPI();
                    objAvailableTrips = clsAbhibusAPI.getBusAvailability(objBusesSearchFilter.SourceID
                                        , objBusesSearchFilter.DestinationID
                                        , objBusesSearchFilter.JourneyDate
                                        , 6
                                        , "0"
                                        , objClientAPIDetails.APIURL
                                        , objClientAPIDetails.ConsumerKey
                                        , objClientAPIDetails.ProviderName);
                    break;
                case "BITLA":
                case "MORNINGSTAR":
                    BitlaAPI clsBitlaAPI = new BitlaAPI();
                    objAvailableTrips = clsBitlaAPI.getAvailableRoutes(objBusesSearchFilter.SourceID
                                        , objBusesSearchFilter.DestinationID
                                        , objBusesSearchFilter.JourneyDate
                                        , objClientAPIDetails.APIURL
                                        , objClientAPIDetails.ConsumerKey, objClientAPIDetails.ProviderID);
                    break;
                case "TICKETGOOSE":
                    TicketGooseAPI clsTicketGooseAPI = new TicketGooseAPI();
                    objAvailableTrips = clsTicketGooseAPI.getTripListV2(objBusesSearchFilter.SourceID
                                        , objBusesSearchFilter.DestinationID
                                        , objBusesSearchFilter.JourneyDate
                                        , objClientAPIDetails.APIURL
                                        , objClientAPIDetails.ConsumerKey
                                        , objClientAPIDetails.ConsumerSecret, objClientAPIDetails.ProviderID);
                    break;
                //easybus
                case "EASYBUS":
                    EasybusAPI clsEasyBusAPI = new EasybusAPI();

                    break;
                default:
                    break;

            }

            return objAvailableTrips;
        }
コード例 #9
0
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        try
        {

            DataSet dsticketdetails = CheckTicketID();

            if (CheckStatus)
            {
                if (dsticketdetails != null)
                {
                    int BookingId = Convert.ToInt32(dsticketdetails.Tables[0].Rows[0]["BookingId"].ToString());
                    int tentativeId = Convert.ToInt32(dsticketdetails.Tables[0].Rows[0]["TentativeId"].ToString());
                    string EmailId = dsticketdetails.Tables[0].Rows[0]["EmailId"].ToString();
                    string Name = dsticketdetails.Tables[0].Rows[0]["FullName"].ToString();
                    string seatnumbers = dsticketdetails.Tables[0].Rows[0]["SeatNos"].ToString();
                    string totalfareabhi = dsticketdetails.Tables[0].Rows[0]["TotalFare"].ToString();
                    string ticketNumberBitla = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();

                    string BoardingPointName = dsticketdetails.Tables[0].Rows[0]["BoardingPointName"].ToString();
                    string DateofJourney = dsticketdetails.Tables[0].Rows[0]["DateOfJourney"].ToString();
                    string[] dd = DateofJourney.Split(' ');
                    string[] bd = BoardingPointName.Split('-');
                    string dateofjourney = dd[0];
                    string datenow = dd[0] + "" + bd[1];
                    string APIName = dsticketdetails.Tables[0].Rows[0]["APIName"].ToString();
                    lblCode.Text = GenerateRandomCode();
                    TimeSpan s = DateTime.Parse(datenow) - DateTime.Now;

                    if (s.Days > 0)
                    {
                        dayhours = Convert.ToInt32(s.Days) * 24;
                    }
                    if (s.Minutes > 30)
                    {
                        hour = dayhours + s.Hours + 1;
                    }
                    if (s.Minutes <= 30)
                    {
                        hour = dayhours + s.Hours;
                    }
                    if (hour > 0)
                    {

                        Session["NameMail"] = Name;
                        Session["EmailIdMail"] = EmailId;

                        #region Kesineni
                        if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "Kesineni")
                        {
                            ViewState["APIName"] = "Kesineni";
                            rbtnlstCancelType.Visible = gvPartialCancellation.Visible = btnConfrmCancel.Visible = false;
                            gvPartialCancellation.DataSource = dsticketdetails.Tables[1];
                            gvPartialCancellation.DataBind();
                            ViewState["dsticketdetails"] = dsticketdetails.Tables[0];
                            btnConfrmCancel_Click(sender, e);
                        }
                        #endregion

                        #region AbhiBus
                        else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "SVR" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "KAVERI" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "RAJESH" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "SAIANJANA" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "KALLADA")
                        {
                            string ticketNumberAbhiBus = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();
                            //cancelTicket
                            ClientAPIList objClientAPIList = new ClientAPIList();
                            objClientAPIList = GetAPIProvidersList(ConsumerKey, ConsumerSecret);
                            ClientAPIDetails objClientAPIDetails = objClientAPIList.SingleOrDefault(element => element.ProviderName == dsticketdetails.Tables[0].Rows[0]["APIName"].ToString()); //objClientAPIList.ElementAt(resultSet - 1)
                            LJ.CLB.Buses.AbhibusAPI obj = new LJ.CLB.Buses.AbhibusAPI();
                            DataTable dtAbhiBus = obj.cancelTicket(objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, ticketNumberAbhiBus);

                            if (dtAbhiBus != null)
                            {
                                if (dtAbhiBus.Rows.Count > 0)
                                {
                                    if (dtAbhiBus.Rows[0]["status"].ToString().ToUpper().Trim().ToString() == "SUCCESS")
                                    {
                                        string totalRefundAmount = dtAbhiBus.Rows[0]["total_refund_amount"].ToString();
                                        string canpercentage = dtAbhiBus.Rows[0]["cancellation_parcentage"].ToString();
                                        string[] canindec = canpercentage.Split('%');
                                        double cancelcharges = Convert.ToDouble(totalfareabhi) * (Convert.ToDouble(canindec[0].ToString()) / 100);
                                        AddCancellation(BookingId, tentativeId, seatnumbers, EmailId,
                                            Convert.ToString(Convert.ToDouble(totalfareabhi) - cancelcharges), Convert.ToString(totalfareabhi), APIName, hour);
                                        Mail(dsticketdetails.Tables[0].Rows[0]["EmailId"].ToString(), dsticketdetails.Tables[0].Rows[0]["PGMBRefNo"].ToString());
                                        // DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                                        //string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
                                        //  Label lbl = (Label)this.Master.FindControl("lblBalance");
                                        //lbl.Text = balance;
                                        //Session["Balance"] = balance;
                                        txtEmailID.Text = txtMBRefNo.Text = "";

                                    }
                                    else
                                    {
                                        lblMsg.Text = "Ticket cancelled failed. Try Again";
                                    }
                                }
                                else
                                {
                                    lblMsg.Text = "Ticket cancelled failed. Try Again";
                                }
                            }
                            else
                            {
                                lblMsg.Text = "Ticket cancelled failed. Try Again";
                            }
                        }
                        #endregion

                        #region Kallada
                        if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "kallada")
                        {
                            string ticketNumberkallada = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();
                            DataTable dtkallada = objkalladaAPILayer.CancellationConfirmation(ticketNumberkallada);
                            if (dtkallada != null)
                            {
                                if (dtkallada.Rows.Count > 0)
                                {
                                    if (dtkallada.Rows[0]["status"].ToString() == "Success")
                                    {
                                        string totalRefundAmount = dtkallada.Rows[0]["total_refund_amount"].ToString();
                                        string canpercentage = dtkallada.Rows[0]["cancellation_parcentage"].ToString();
                                        string[] canindec = canpercentage.Split('%');
                                        double cancelcharges = Convert.ToDouble(totalfareabhi) * (Convert.ToDouble(canindec[0].ToString()) / 100);

                                        DataTable dtKallada1 = objkalladaAPILayer.TicketCancellation(ticketNumberkallada);
                                        if (dtKallada1.Rows.Count > 0 && dtKallada1.Columns.Count > 1)
                                        {
                                            if (dtKallada1.Rows[0]["status"].ToString().ToUpper().Trim().ToString() != "FAIL")
                                            {
                                                AddCancellation(BookingId, tentativeId, seatnumbers, EmailId,
                                                    Convert.ToString(Convert.ToDouble(totalfareabhi) - cancelcharges), Convert.ToString(totalfareabhi), APIName, hour);

                                                //objBAL = new ClsBAL();
                                                //objBAL.AdjustAgentBalance(txtMBRefNo.Text.Trim().ToString(),
                                                //    Convert.ToDouble(Convert.ToDouble(totalfareabhi) - cancelcharges), Convert.ToDouble(cancelcharges),
                                                //    Convert.ToInt32(Session["UserID"].ToString()));
                                            }
                                            else { lblMsg.Text = "Ticket cancelled failed."; }

                                            DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));

                                            string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
                                            Label lbl = (Label)this.Master.FindControl("lblBalance");
                                            lbl.Text = balance;
                                            Session["Balance"] = balance;
                                            txtEmailID.Text = txtMBRefNo.Text = "";
                                        }
                                    }
                                    else
                                    {
                                        lblMsg.Text = "Ticket cancelled failed. Try Again";
                                        lblMsg.ForeColor = System.Drawing.Color.Red;
                                    }
                                }
                                else
                                {
                                    lblMsg.Text = "Ticket cancelled failed. Try Again";
                                    lblMsg.ForeColor = System.Drawing.Color.Red;
                                }
                            }
                            else
                            {
                                lblMsg.Text = "Ticket cancelled failed. Try Again";
                                lblMsg.ForeColor = System.Drawing.Color.Red;
                            }
                        }
                        #endregion

                        #region Bitla
                        else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "BITLA")
                        {
                            ViewState["APIName"] = "Bitla";
                            rbtnlstCancelType.Visible = gvPartialCancellation.Visible = btnConfrmCancel.Visible = false;
                            gvPartialCancellation.DataSource = dsticketdetails.Tables[1];
                            gvPartialCancellation.DataBind();
                            ViewState["dsticketdetails"] = dsticketdetails.Tables[0];
                            btnConfrmCancel_Click(sender, e);
                        }
                        #endregion

                        #region TicketGoose
                        else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "TICKETGOOSE")
                        {
                            ViewState["APIName"] = "TicketGoose";
                            string ticketNumber = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();
                            string[] seatNos = dsticketdetails.Tables[0].Rows[0]["SeatNos"].ToString().Split(',');
                            DataTable dt = objTicketGooseAPILayer.CancelTicket(ticketNumber, seatNos);
                            if (dt != null)
                            {
                                if (dt.Rows.Count > 0)
                                {
                                    if (dt.Rows[0]["Status"].ToString() == "Success")
                                    {
                                        DataTable dtt = objTicketGooseAPILayer.ConfirmTicketCancellation(ticketNumber, seatNos);
                                        if (dtt != null)
                                        {
                                            if (dtt.Rows.Count > 0)
                                            {
                                                if (dtt.Rows[0]["Status"].ToString() == "Success")
                                                {
                                                    string refAmount = dtt.Rows[0]["refundAmount"].ToString();

                                                    AddCancellation(BookingId, tentativeId, seatnumbers, EmailId,
                                                   refAmount, Convert.ToString(Convert.ToDouble(totalfareabhi)), APIName, hour);

                                                    Mail(dsticketdetails.Tables[0].Rows[0]["EmailId"].ToString(), dsticketdetails.Tables[0].Rows[0]["PGMBRefNo"].ToString());

                                                    //objBAL = new ClsBAL();
                                                    //objBAL.AdjustAgentBalance(txtMBRefNo.Text.Trim().ToString(),
                                                    //    Convert.ToDouble(refAmount), Convert.ToDouble(Convert.ToDouble(totalfareabhi) - Convert.ToDouble(refAmount)),
                                                    //    Convert.ToInt32(Session["UserID"]));
                                                }
                                                else { lblMsg.Text = "Ticket cancelled failed. Try Again"; }

                                                //DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"]));

                                                //string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
                                                //Label lbl = (Label)this.Master.FindControl("lblBalance");
                                                //lbl.Text = balance;
                                                //Session["Balance"] = balance;
                                                txtEmailID.Text = txtMBRefNo.Text = "";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        #endregion

                        #region EasyBus

                        else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "EASYBUS")
                        {
                            string ticketNumberEasybus = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();
                            //cancelTicket
                            ClientAPIList objClientAPIList = new ClientAPIList();
                            objClientAPIList = GetAPIProvidersList(ConsumerKey, ConsumerSecret);
                            ClientAPIDetails objClientAPIDetails = objClientAPIList.SingleOrDefault(element => element.ProviderName == dsticketdetails.Tables[0].Rows[0]["APIName"].ToString()); //objClientAPIList.ElementAt(resultSet - 1)
                            LJ.CLB.Buses.EasybusAPI obj = new LJ.CLB.Buses.EasybusAPI();
                            DataTable dtEasybus = obj.cancelTicket(objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, ticketNumberEasybus, seatnumbers, dateofjourney);
                            if (dtEasybus != null)
                            {
                                if (dtEasybus.Rows.Count > 0)
                                {
                                    if (dtEasybus.Rows[0]["Message"].ToString() == "Your Ticket has been cancelled")
                                    {

                                        string totalRefundAmount = totalfareabhi;
                                        string canpercentage = "10";
                                        string[] canindec = canpercentage.Split('%');
                                        double cancelcharges = Convert.ToDouble(totalfareabhi) * (Convert.ToDouble(canindec[0].ToString()) / 100);

                                        AddCancellation(BookingId, tentativeId, seatnumbers, EmailId,
                                           Convert.ToString(Convert.ToDouble(totalfareabhi) - cancelcharges), Convert.ToString(totalfareabhi), APIName, hour);
                                        Mail(dsticketdetails.Tables[0].Rows[0]["EmailId"].ToString(), dsticketdetails.Tables[0].Rows[0]["PGMBRefNo"].ToString());

                                    }
                                }
                            }

                        }
                        #endregion
                    }
                    else
                    {
                        tdmsg.Visible = true;
                        lblMainMsg.Text = "Invalid LoveJourney Ref No.";
                        lblMainMsg.ForeColor = System.Drawing.Color.Maroon;
                        txtMBRefNo.Text = "";
                    }
                }
                else
                {
                    tdmsg.Visible = true;
                    lblMainMsg.Text = "Invalid LoveJourney Ref No.";
                    lblMainMsg.ForeColor = System.Drawing.Color.Maroon;
                    txtMBRefNo.Text = "";

                }
            }
            else
            {
                tdmsg.Visible = true;
                lblMainMsg.Text = "Invalid LoveJourney Ref No.";
                lblMainMsg.ForeColor = System.Drawing.Color.Maroon;
                txtMBRefNo.Text = "";
                txtEmailID.Text = "";

            }

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw ex;
        }
    }
コード例 #10
0
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsticketdetails = CheckTicketID();
            if (CheckStatus)
            {
                if (dsticketdetails != null)
                {
                    int BookingId = Convert.ToInt32(dsticketdetails.Tables[0].Rows[0]["BookingId"].ToString());
                    int tentativeId = Convert.ToInt32(dsticketdetails.Tables[0].Rows[0]["TentativeId"].ToString());
                    string EmailId = dsticketdetails.Tables[0].Rows[0]["EmailId"].ToString();
                    string Name = dsticketdetails.Tables[0].Rows[0]["FullName"].ToString();
                    string seatnumbers = dsticketdetails.Tables[0].Rows[0]["SeatNos"].ToString();
                    string totalfareabhi = dsticketdetails.Tables[0].Rows[0]["TotalFare"].ToString();
                    string ticketNumberBitla = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();

                    Session["NameMail"] = Name;
                    Session["EmailIdMail"] = EmailId;

                    #region Kesineni
                    if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "Kesineni")
                    {
                        ViewState["APIName"] = "Kesineni";
                        rbtnlstCancelType.Visible = gvPartialCancellation.Visible = btnConfrmCancel.Visible = true;
                        gvPartialCancellation.DataSource = dsticketdetails.Tables[1];
                        gvPartialCancellation.DataBind();
                        ViewState["dsticketdetails"] = dsticketdetails.Tables[0];
                    }
                    #endregion

                    #region AbhiBus
                    else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "SVR" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "KAVERI" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "RAJESH" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "SAIANJANA" || dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "KALLADA")
                    {
                        string ticketNumberAbhiBus = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();//"OHYD19615";
                        //cancelTicket
                        ClientAPIList objClientAPIList = new ClientAPIList();
                        objClientAPIList = GetAPIProvidersList(ConsumerKey, ConsumerSecret);
                        ClientAPIDetails objClientAPIDetails = objClientAPIList.SingleOrDefault(element => element.ProviderName == dsticketdetails.Tables[0].Rows[0]["APIName"].ToString()); //objClientAPIList.ElementAt(resultSet - 1)
                        LJ.CLB.Buses.AbhibusAPI obj = new LJ.CLB.Buses.AbhibusAPI();
                        DataTable dtAbhiBus = obj.cancelTicket(objClientAPIDetails.APIURL, objClientAPIDetails.ConsumerKey, ticketNumberAbhiBus);

                        if (dtAbhiBus != null)
                        {
                            if (dtAbhiBus.Rows.Count > 0)
                            {
                                if (dtAbhiBus.Rows[0]["status"].ToString().ToUpper().Trim().ToString() == "SUCCESS")
                                {
                                    string totalRefundAmount = dtAbhiBus.Rows[0]["total_refund_amount"].ToString();
                                    string canpercentage = dtAbhiBus.Rows[0]["cancellation_parcentage"].ToString();
                                    string[] canindec = canpercentage.Split('%');
                                    double cancelcharges = Convert.ToDouble(totalfareabhi) * (Convert.ToDouble(canindec[0].ToString()) / 100);
                                    AddCancellation(BookingId, tentativeId, seatnumbers, EmailId, Convert.ToString(Convert.ToDouble(totalfareabhi) - cancelcharges), Convert.ToString(cancelcharges));
                                    Mail(dtAbhiBus.Rows[0]["EmailId"].ToString(), dtAbhiBus.Rows[0]["PGMBRefNo"].ToString());
                                }
                            }
                            else
                            {
                                lblMsg.Text = "Ticket cancelled failed.Try Again";
                            }
                        }
                        else
                        {
                            lblMsg.Text = "Ticket cancelled failed.Try Again";
                        }
                    }
                    #endregion

                    #region Bitla
                    else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "BITLA")
                    {
                        ViewState["APIName"] = "Bitla";
                        rbtnlstCancelType.Visible = gvPartialCancellation.Visible = btnConfrmCancel.Visible = true;
                        gvPartialCancellation.DataSource = dsticketdetails.Tables[1];
                        gvPartialCancellation.DataBind();
                        ViewState["dsticketdetails"] = dsticketdetails.Tables[0];
                        btnConfrmCancel_Click(sender, e);
                    }
                    #endregion

                    #region Kallada
                    if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "kallada")
                    {

                        string ticketNumberkallada = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();//"OHYD19615";
                        DataTable dtkallada = objkalladaAPILayer.CancellationConfirmation(ticketNumberkallada);
                        if (dtkallada != null)
                        {
                            if (dtkallada.Rows.Count > 0)
                            {
                                if (dtkallada.Rows[0]["status"].ToString() == "Success")
                                {
                                    string totalRefundAmount = dtkallada.Rows[0]["total_refund_amount"].ToString();
                                    string canpercentage = dtkallada.Rows[0]["cancellation_parcentage"].ToString();
                                    string[] canindec = canpercentage.Split('%');
                                    double cancelcharges = Convert.ToDouble(totalfareabhi) * (Convert.ToDouble(canindec[0].ToString()) / 100);

                                    DataTable dtKallada1 = objkalladaAPILayer.TicketCancellation(ticketNumberkallada);
                                    if (dtKallada1.Rows.Count > 0 && dtKallada1.Columns.Count > 1)
                                    {
                                        AddCancellation(BookingId, tentativeId, seatnumbers, EmailId, Convert.ToString(Convert.ToDouble(totalfareabhi) - cancelcharges), Convert.ToString(cancelcharges));
                                    }
                                }
                                else
                                {
                                    lblMsg.Text = "Ticket cancelled failed.Try Again";
                                    lblMsg.ForeColor = System.Drawing.Color.Red;
                                }
                            }
                            else
                            {
                                lblMsg.Text = "Ticket cancelled failed.Try Again";
                                lblMsg.ForeColor = System.Drawing.Color.Red;
                            }
                        }
                        else
                        {
                            lblMsg.Text = "Ticket cancelled failed.Try Again";
                            lblMsg.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                    #endregion

                    #region TicketGoose
                    else if (dsticketdetails.Tables[0].Rows[0]["APIName"].ToString() == "TICKETGOOSE")
                    {
                        ViewState["APIName"] = "TicketGoose";
                        string ticketNumber = dsticketdetails.Tables[0].Rows[0]["PNRNumber"].ToString();
                        string[] seatNos = dsticketdetails.Tables[0].Rows[0]["SeatNos"].ToString().Split(',');
                        DataTable dt = objTicketGooseAPILayer.CancelTicket(ticketNumber, seatNos);
                        if (dt != null)
                        {
                            if (dt.Rows.Count > 0)
                            {
                                if (dt.Rows[0]["Status"].ToString() == "Success")
                                {
                                    DataTable dtt = objTicketGooseAPILayer.ConfirmTicketCancellation(ticketNumber, seatNos);
                                    if (dtt != null)
                                    {
                                        if (dtt.Rows.Count > 0)
                                        {
                                            if (dtt.Rows[0]["Status"].ToString() == "Success")
                                            {
                                                string refAmount = dtt.Rows[0]["refundAmount"].ToString();

                                                AddCancellation(BookingId, tentativeId, seatnumbers, EmailId,
                                               refAmount, Convert.ToString(Convert.ToDouble(totalfareabhi) - Convert.ToDouble(refAmount)));

                                                Mail(dt.Rows[0]["EmailId"].ToString(), dt.Rows[0]["PGMBRefNo"].ToString());

                                            }
                                            else { lblMsg.Text = "Ticket cancelled failed. Try Again"; }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    txtMBRefNo.Text = "";
                    lblCancelMessage.Visible = true;
                    lblCancelMessage.Text = "Invalid Love Journey RefNo";
                    lblCancelMessage.ForeColor = System.Drawing.Color.Maroon;
                }
            }
            else
            {
                txtMBRefNo.Text = "";
                lblCancelMessage.Visible = true;
                lblCancelMessage.Text = "Invalid Love Journey RefNo";
                lblCancelMessage.ForeColor = System.Drawing.Color.Maroon;

            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }