public ActionResult Index(int?page, BusPNRModel _model, DateTime?FromDate, DateTime?ToDate)
        {
            BusGeneralRepository.SetRequestPageRow();

            try
            {
                var ts = (TravelSession)Session["TravelPortalSessionInfo"];
                //_model.FromDate = Session["FromDate"] == null ? DateTime.Now.AddDays(-15) : Convert.ToDateTime(Session["FromDate"]);
                //_model.ToDate = Session["ToDate"] == null ? DateTime.Now : Convert.ToDateTime(Session["ToDate"]);

                if (FromDate == null && ToDate == null)
                {
                    _model.FromDate = ATLTravelPortal.Repository.GeneralRepository.CurrentDateTime().AddDays(-15);
                    _model.ToDate   = ATLTravelPortal.Repository.GeneralRepository.CurrentDateTime();
                }
                else
                {
                    _model.FromDate = FromDate;
                    _model.ToDate   = ToDate;
                }

                ViewData["DisList"] = new SelectList(defaultProvider.GetDistributorList(ts.LoginTypeId), "DistributorId", "DistributorName");
                _model.TabularList  = busBookedTicketProvider.GetBranchPagedBookedTicketList(page, _model.FromDate, _model.ToDate, _model.AgentId, ts.LoginTypeId);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }
            _model.Message = _res;
            return(View(_model));
        }
Пример #2
0
        public ActionResult Index(BusPNRModel model, int?page, ExportModel Expmodel, FormCollection frm)
        {
            Session["FromDate"] = model.FromDate;
            Session["ToDate"]   = model.ToDate;
            BusPNRModel _model            = new BusPNRModel();
            UnIssuedTicketRepository _rep = new UnIssuedTicketRepository();

            BusGeneralRepository.SetRequestPageRow();
            try
            {
                var ts = (TravelSession)Session["TravelPortalSessionInfo"];
                ViewData["AgentList"] = new SelectList(defaultProvider.GetDistributorAgentList(ts.LoginTypeId), "AgentId", "AgentName");
                _model.TabularList    = _rep.GetDistributorPagedIssueList(page, model.FromDate, model.ToDate, model.AgentId, ts.LoginTypeId);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }

            //export
            BookedTicketReportController crtBKT = new BookedTicketReportController();

            crtBKT.GetExportTypeClicked(Expmodel, frm);

            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = _model.TabularList.Select(m => new
                    {
                        Passenger_Name = m.FullName,
                        Operator_Name  = m.BusMasterName,
                        DepartureDate  = TimeFormat.DateFormat(m.DepartureDate.ToString()),
                        DepartureTime  = TimeFormat.GetAMPMTimeFormat(m.DepartureTime.ToString()),
                        Category       = m.BusCategoryName,
                        Type           = m.Type
                    });
                    App_Class.AppCollection.Export(Expmodel, exportData, "Issued Ticket");
                }
                catch
                {
                }
            }

            _model.Message = _res;
            return(View(_model));
        }
        public string CreateMessage(BusPNRModel model, string MobileNo)
        {
            string _operatorName = model.BusMasterName.IndexOf('(') < 0 ? model.BusMasterName : model.BusMasterName.Substring(0, model.BusMasterName.IndexOf('('));

            _operatorName = _operatorName.Length > 30 ? _operatorName.Substring(0, 30) : _operatorName;
            string _fromCityName = model.FromCityName.IndexOf('(') < 0 ? model.FromCityName : model.FromCityName.Substring(0, model.FromCityName.IndexOf('('));

            _fromCityName = _fromCityName.Length > 13 ? _fromCityName.Substring(0, 13) : _fromCityName;
            string _toCityName = model.ToCityName.IndexOf('(') < 0 ? model.ToCityName : model.ToCityName.Substring(0, model.ToCityName.IndexOf('('));

            _toCityName = _toCityName.Length > 13 ? _toCityName.Substring(0, 13) : _toCityName;
            string _category = model.BusCategoryName.IndexOf('(') < 0 ? model.BusCategoryName : model.BusCategoryName.Substring(0, model.BusCategoryName.IndexOf('('));

            _category = _category.Length > 10 ? _category.Substring(0, 10) : _category;
            string _type = model.Type.IndexOf('(') < 0 ? model.ToCityName : model.Type.Substring(0, model.Type.IndexOf('('));

            _type = _type.Length > 5 ? _type.Substring(0, 5) : _type;
            string _busNo      = model.BusNo.Length > 20 ? model.BusNo.Substring(0, 20) : model.BusNo;
            string _seatNumber = model.SeatNumber.Length > 23 ? model.SeatNumber.Substring(0, 23) : model.SeatNumber;
            //string _seatNumber = model.SeatNumber;
            StringBuilder message = new StringBuilder();

            message.Append(_operatorName + "\r\n");
            message.Append(_fromCityName + "-" + _toCityName + "\r\n");
            message.Append(model.DepartureDate.ToShortDateString() + "\r\n");
            message.Append(model.DepartureTime.Hours + ":" + model.DepartureTime.Minutes + "\r\n");
            message.Append(_category + "\r\n");
            message.Append(_type + "\r\n");
            message.Append("ID:" + model.ItinearyNumber + "\r\n");
            message.Append("Bus:" + _busNo + "\r\n");
            message.Append("Seat:" + _seatNumber + "\r\n");
            message.Append("Ph:" + MobileNo);
            return(message.ToString());
        }
        public ActionResult Index(int?page, BusPNRModel _model)
        {
            UnIssuedTicketRepository _rep = new UnIssuedTicketRepository();

            BusGeneralRepository.SetRequestPageRow();
            try
            {
                var ts = (TravelSession)Session["TravelPortalSessionInfo"];
                _model.FromDate = Session["FromDate"] == null?DateTime.Now.AddDays(-15) : Convert.ToDateTime(Session["FromDate"]);

                _model.ToDate = Session["ToDate"] == null ? DateTime.Now : Convert.ToDateTime(Session["ToDate"]);

                ViewData["AgentList"] = new SelectList(defaultProvider.GetAgentList(), "AgentId", "AgentName");
                _model.TabularList    = _rep.GetPagedIssueList(page, _model.FromDate, _model.ToDate, ts.LoginTypeId);
                if (BusGeneralRepository.ActionMessage != null)
                {
                    _res = BusGeneralRepository.ActionMessage;
                }
            }
            catch (Exception ex)
            {
                _res = BusGeneralRepository.CatchException(ex);
            }
            _model.Message = _res;
            return(View(_model));
        }
        public bool UpdateBusPNRModel(BusPNRModel model)
        {
            Bus_PNRs bus_PNRs = _ent.Bus_PNRs.Where(x => x.BusPNRId == model.BusPNRId).FirstOrDefault();

            //int _discountRate = int.Parse(System.Configuration.ConfigurationManager.AppSettings["BusDiscount"].ToString());
            bus_PNRs.Prefix         = model.Prefix;
            bus_PNRs.FullName       = model.FullName;
            bus_PNRs.PhoneNumber    = model.PhoneNumber;
            bus_PNRs.ContactAddress = model.ContactAddress;
            bus_PNRs.MobileNumber   = model.MobileNumber;
            bus_PNRs.EmailAddress   = model.EmailAddress;

            bus_PNRs.Type              = model.Type;
            bus_PNRs.BusCategoryId     = model.BusCategoryId;
            bus_PNRs.BusMasterId       = model.BusMasterId;
            bus_PNRs.DepartureDate     = model.DepartureDate;
            bus_PNRs.DepartureTime     = model.DepartureTime;
            bus_PNRs.BusNo             = model.BusNo;
            bus_PNRs.HideServiceCharge = model.HideServiceCharge;

            _ent.ApplyCurrentValues(bus_PNRs.EntityKey.EntitySetName, bus_PNRs);

            if (bus_PNRs.Bus_Passengers != null)
            {
                foreach (var pax in model.Passengers)
                {
                    Bus_Passengers paxToUpdate = _ent.Bus_Passengers.Where(x => x.BusPassengerId == pax.BusPassengerId).FirstOrDefault();
                    if (paxToUpdate.IsPrimary)
                    {
                        paxToUpdate.PassengerName = model.Prefix + " " + model.FullName;
                        paxToUpdate.MobileNumber  = model.MobileNumber;
                        paxToUpdate.Fare          = pax.Fare - paxToUpdate.Markup;
                        paxToUpdate.PickupPoint   = pax.PickupPoint;
                        paxToUpdate.TicketNumber  = pax.TicketNumber;
                        paxToUpdate.SeatNoalias   = pax.SeatNumber;
                        paxToUpdate.IsPrimary     = true;
                        //paxToUpdate.DiscountAmount = (pax.Fare * _discountRate) / 100;
                        _ent.ApplyCurrentValues(paxToUpdate.EntityKey.EntitySetName, paxToUpdate);
                    }
                    else
                    {
                        paxToUpdate.PassengerName = pax.PassengerName == null ? "" : pax.PassengerName;
                        paxToUpdate.MobileNumber  = pax.MobileNumber == null ? "" : pax.MobileNumber;
                        paxToUpdate.Fare          = pax.Fare - paxToUpdate.Markup;
                        paxToUpdate.PickupPoint   = pax.PickupPoint;
                        paxToUpdate.TicketNumber  = pax.TicketNumber;
                        paxToUpdate.SeatNoalias   = pax.SeatNumber;
                        //paxToUpdate.DiscountAmount = (pax.Fare * _discountRate) / 100;
                        _ent.ApplyCurrentValues(paxToUpdate.EntityKey.EntitySetName, paxToUpdate);
                    }
                }
            }
            _ent.SaveChanges();
            return(true);
        }
        public List <BusPNRModel> List(int AgentId)
        {
            IEnumerable <Bus_PNRs> _res = null;

            if (AgentId != 0)
            {
                _res = _ent.Bus_PNRs.Where(x => x.AgentId == AgentId && (x.TicketStatusId == 1 || x.TicketStatusId == 7 || x.TicketStatusId == 14 || x.TicketStatusId == 28)).OrderByDescending(o => o.CreateDate);
            }
            else
            {
                _res = _ent.Bus_PNRs.Where(x => x.TicketStatusId == 1 || x.TicketStatusId == 7 || x.TicketStatusId == 14 || x.TicketStatusId == 28).OrderByDescending(o => o.CreateDate);
            }

            List <BusPNRModel> list = new List <BusPNRModel>();

            foreach (var item in _res)
            {
                BusPNRModel busPnrModel = new BusPNRModel()
                {
                    Sno               = SNo++,
                    BusPNRId          = item.BusPNRId,
                    ServiceProviderId = item.ServiceProviderId,
                    AgentId           = item.AgentId,
                    RefrenceNumber    = item.RefrenceNumber,
                    BusMasterId       = item.BusMasterId,
                    BusMasterName     = item.Bus_Master.BusMasterName,
                    BusCategoryId     = item.BusCategoryId,
                    BusCategoryName   = item.Bus_Categories.BusCategoryName,
                    BusNo             = item.BusNo,
                    NoOfSeat          = item.NoOfSeat,
                    TicketStatusId    = item.TicketStatusId,
                    FromCityId        = item.FromCityId,
                    FromCityName      = item.Bus_Cities.BusCityName,
                    ToCityId          = item.ToCityId,
                    ToCityName        = item.Bus_Cities1.BusCityName,
                    DepartureDate     = item.DepartureDate,
                    DepartureTime     = item.DepartureTime,
                    ArrivalDate       = item.ArrivalDate,
                    ArrivalTime       = item.ArrivalTime,
                    InsurenceAmount   = item.InsurenceAmount,
                    Remarks           = item.Remarks,
                    FareRule          = item.FareRule,
                    FacilityDetails   = item.FacilityDetails,
                    Prefix            = item.Prefix,
                    FullName          = item.FullName,
                    EmailAddress      = item.EmailAddress,
                    MobileNumber      = item.MobileNumber,
                    PhoneNumber       = item.PhoneNumber,
                    ContactAddress    = item.ContactAddress,
                    Type              = item.Type,
                };
                list.Add(busPnrModel);
            }
            return(list);
        }
Пример #7
0
        public ActionResult Edit(BusPNRModel model, FormCollection coll)
        {
            UnIssuedTicketRepository _rep = new UnIssuedTicketRepository();

            try
            {
                BusPNRModel   viewModel = new BusPNRModel();
                TravelSession obj       = (TravelSession)Session["TravelPortalSessionInfo"];
                if (coll.AllKeys.Contains("Update"))
                {
                    bool isUpdated = _rep.UpdateBusPNRModel(model);
                    viewModel = _rep.GetBusPNRModelByBusPNRId(model.BusPNRId);
                    TempData["ActionResponse"] = "Updated Successfully";
                }
                else if (coll.AllKeys.Contains("Issue"))
                {
                    bool isUpdated = _rep.UpdateBusPNRModel(model);
                    viewModel = _rep.GetBusPNRModelByBusPNRId(model.BusPNRId);
                    _rep.IssueBusTickets(model.BusPNRId, obj.AppUserId);

                    try
                    {
                        //string messageOperator = _rep.CreateMessage(viewModel, viewModel.OperatorMobileNo);
                        //Helpers.SMS.SendSms.Send(viewModel.MobileNumber, messageOperator, model.BusPNRId.ToString());
                        //string messagePassenger = _rep.CreateMessage(viewModel, viewModel.MobileNumber);
                        //Helpers.SMS.SendSms.Send(viewModel.OperatorMobileNo, messagePassenger.ToString(), model.BusPNRId.ToString());
                        TempData["ActionResponse"] = "Ticket Issued Successfully";

                        return(RedirectToAction("Index"));
                    }
                    catch
                    {
                        return(RedirectToAction("Index"));
                    }
                }
                else if (coll.AllKeys.Contains("Cancel"))
                {
                    _rep.CanCelBusTickets(model.BusPNRId, obj.AppUserId);
                    return(RedirectToAction("Index"));
                }

                return(View(viewModel));
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
                return(View());
            }
        }
Пример #8
0
        public ActionResult Index(BusPNRModel model, int?page)
        {
            UnIssuedTicketRepository _rep = new UnIssuedTicketRepository();

            BusGeneralRepository.SetRequestPageRow();
            try
            {
                model.FromDate = DateTime.Now.AddDays(-15);
                model.ToDate   = DateTime.Now;

                ViewData["AgentList"] = new SelectList(defaultProvider.GetAgentList(), "AgentId", "AgentName");

                model.TabularList = _rep.GetPagedList(page, model.AgentId);
            }
            catch (Exception ex)
            {
                model.Message = BusGeneralRepository.CatchException(ex);
            }
            model.Message = _res;
            return(View(model));
        }
Пример #9
0
        public ActionResult Print(long?id)
        {
            BusPNRModel _model            = new BusPNRModel();
            UnIssuedTicketRepository _rep = new UnIssuedTicketRepository();

            try
            {
                _model = _rep.GetBusPNRModelByBusPNRId(id);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }
            BusGeneralRepository.ActionMessage = _model.Message;
            if (_model.Message.MsgNumber == 0)
            {
                return(View(_model));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
        public List <BusPNRModel> DistributorBookedTicketList(DateTime?fromdate, DateTime?todate, int AgentId, int distributorID)
        {
            IEnumerable <Bus_PNRs> _res = null;

            if (AgentId != 0)
            {
                if (fromdate != null && todate != null)
                {
                    _res = from a in entity.Bus_PNRs
                           join b in entity.Agents on a.AgentId equals b.AgentId
                           where a.AgentId == AgentId &&
                           b.DistributorId == distributorID &&
                           (a.TicketStatusId == 1 || a.TicketStatusId == 7) &&
                           (a.CreateDate >= fromdate && a.CreateDate <= todate)
                           orderby a.CreateDate
                           select a;
                }
                else if (fromdate != null && todate == null)
                {
                    _res = from a in entity.Bus_PNRs
                           join b in entity.Agents on a.AgentId equals b.AgentId
                           where a.AgentId == AgentId &&
                           b.DistributorId == distributorID &&
                           (a.TicketStatusId == 1 || a.TicketStatusId == 7) &&
                           (a.CreateDate >= fromdate)
                           orderby a.CreateDate
                           select a;
                }
                else
                {
                    _res = from a in entity.Bus_PNRs
                           join b in entity.Agents on a.AgentId equals b.AgentId
                           where a.AgentId == AgentId &&
                           b.DistributorId == distributorID &&
                           (a.TicketStatusId == 1 || a.TicketStatusId == 7)

                           orderby a.CreateDate
                           select a;
                }
            }
            else
            {
                if (fromdate != null && todate != null)
                {
                    _res = from a in entity.Bus_PNRs
                           join b in entity.Agents on a.AgentId equals b.AgentId
                           where b.DistributorId == distributorID &&
                           (a.TicketStatusId == 1 || a.TicketStatusId == 7) &&
                           (a.CreateDate >= fromdate && a.CreateDate <= todate)
                           orderby a.CreateDate
                           select a;
                }
                else if (fromdate != null && todate == null)
                {
                    _res = from a in entity.Bus_PNRs
                           join b in entity.Agents on a.AgentId equals b.AgentId
                           where
                           b.DistributorId == distributorID &&
                           (a.TicketStatusId == 1 || a.TicketStatusId == 7) &&
                           (a.CreateDate >= fromdate)
                           orderby a.CreateDate
                           select a;
                }
                else
                {
                    _res = from a in entity.Bus_PNRs
                           join b in entity.Agents on a.AgentId equals b.AgentId
                           where b.DistributorId == distributorID &&
                           (a.TicketStatusId == 1 || a.TicketStatusId == 7)
                           orderby a.CreateDate
                           select a;
                }
            }


            List <BusPNRModel> list = new List <BusPNRModel>();
            int SNo = 1;

            foreach (var item in _res)
            {
                BusPNRModel busPnrModel = new BusPNRModel()
                {
                    Sno               = SNo++,
                    BusPNRId          = item.BusPNRId,
                    ServiceProviderId = item.ServiceProviderId,
                    AgentId           = item.AgentId,
                    RefrenceNumber    = item.RefrenceNumber,
                    BusMasterId       = item.BusMasterId,
                    BusMasterName     = item.Bus_Master.BusMasterName,
                    BusCategoryId     = item.BusCategoryId,
                    BusCategoryName   = item.Bus_Categories.BusCategoryName,
                    BusNo             = item.BusNo,
                    NoOfSeat          = item.NoOfSeat,
                    TicketStatusId    = item.TicketStatusId,
                    FromCityId        = item.FromCityId,
                    FromCityName      = item.Bus_Cities.BusCityName,
                    ToCityId          = item.ToCityId,
                    ToCityName        = item.Bus_Cities1.BusCityName,
                    DepartureDate     = item.DepartureDate,
                    ArrivalDate       = item.ArrivalDate,
                    ArrivalTime       = item.ArrivalTime,
                    InsurenceAmount   = item.InsurenceAmount,
                    Remarks           = item.Remarks,
                    FareRule          = item.FareRule,
                    FacilityDetails   = item.FacilityDetails,
                    Prefix            = item.Prefix,
                    FullName          = item.FullName,
                    EmailAddress      = item.EmailAddress,
                    MobileNumber      = item.MobileNumber,
                    PhoneNumber       = item.PhoneNumber,
                    ContactAddress    = item.ContactAddress,
                    DepartureTime     = item.DepartureTime,
                    Type              = item.Type,
                    IssuedDate        = item.IssuedDate
                };
                list.Add(busPnrModel);
            }
            return(list);
        }
        public BusPNRModel GetBusPNRModelByBusPNRId(Int64?busPNRId)
        {
            var         _res  = _ent.Bus_PNRs.Where(x => x.BusPNRId == busPNRId).FirstOrDefault();
            BusPNRModel model = new BusPNRModel();

            if (_res != null)
            {
                model.BusPNRId              = _res.BusPNRId;
                model.ServiceProviderId     = _res.ServiceProviderId;
                model.AgentId               = _res.AgentId;
                model.RefrenceNumber        = _res.RefrenceNumber;
                model.BusMasterId           = _res.BusMasterId;
                model.BusMasterName         = _res.Bus_Master.BusMasterName;
                model.BusCategoryId         = _res.BusCategoryId;
                model.BusCategoryName       = _res.Bus_Categories.BusCategoryName;
                model.BusNo                 = _res.BusNo;
                model.NoOfSeat              = _res.NoOfSeat;
                model.TicketStatusId        = _res.TicketStatusId;
                model.FromCityId            = _res.FromCityId;
                model.FromCityName          = _res.Bus_Cities.BusCityName;
                model.ToCityId              = _res.ToCityId;
                model.ToCityName            = _res.Bus_Cities1.BusCityName;
                model.DepartureDate         = _res.DepartureDate;
                model.DepartureTime         = _res.DepartureTime;
                model.ArrivalDate           = _res.ArrivalDate;
                model.ArrivalTime           = _res.ArrivalTime;
                model.InsurenceAmount       = _res.InsurenceAmount;
                model.Remarks               = _res.Remarks;
                model.FareRule              = _res.FareRule;
                model.FacilityDetails       = _res.FacilityDetails;
                model.FullName              = _res.FullName;
                model.Prefix                = _res.Prefix;
                model.PhoneNumber           = _res.PhoneNumber;
                model.ContactAddress        = _res.ContactAddress;
                model.EmailAddress          = _res.EmailAddress;
                model.MobileNumber          = _res.MobileNumber;
                model.AgentAddress          = _res.Agents.Address;
                model.AgentCode             = _res.Agents.AgentCode;
                model.AgentEmial            = _res.Agents.Email;
                model.AgentName             = _res.Agents.AgentName;
                model.AgentPhone            = _res.Agents.Phone;
                model.OperatorAddress       = _res.Bus_Master.ContactAddress;
                model.OperatorContactPerson = _res.Bus_Master.ContactPerson;
                model.OperatorEmail         = _res.Bus_Master.BusMasterEmial;
                model.OperatorMobileNo      = _res.Bus_Master.Mobile;
                model.OperatorName          = _res.Bus_Master.BusMasterName;
                model.OperatorPhone         = _res.Bus_Master.Phone;
                model.FacilityDetails       = _res.FacilityDetails;
                model.Type          = _res.Type;
                model.Salutations   = new SelectList(EnumHelper.GetEnumDescription(typeof(Salutation)).ToList(), "Name", "Description", _res.Prefix);
                model.BusCategories = new SelectList(new BusCategoryRepository().List(), "BusCategoryId", "BusCategoryName", _res.BusCategoryId);
                BusScheduleRepository busScheduleRepository = new BusScheduleRepository();
                model.BusOperators = new SelectList(busScheduleRepository.ddlMasterList(), "Value", "Text", _res.BusMasterId);
                model.BusTypes     = new SelectList(busScheduleRepository.ddlTypeList(), "Value", "Text", _res.Type);


                model.FareRule          = _res.FareRule;
                model.ItinearyNumber    = "AH-" + _res.BusPNRId.ToString().PadLeft(5, '0');
                model.Type              = _res.Type;
                model.BusNo             = _res.BusNo;
                model.BookingDate       = _res.CreateDate.ToShortDateString();
                model.HideServiceCharge = _res.HideServiceCharge == null ? false : _res.HideServiceCharge.Value;
                double _rate          = 0;
                double _total         = 0;
                double _serviceCharge = 0;
                double _grandTotal    = 0;
                string _seatNo        = "";
                string _pickUpPoints  = "";
                string _passangerName = "";
                var    passengers     = _res.Bus_Passengers;

                double totalCalculatedDiscount = 0;
                double totalSummedDiscount     = 0;
                double totalTranFee            = 0;


                List <BusPassengerModel> passList         = new List <BusPassengerModel>();
                List <string>            PassNameList     = new List <string>();
                List <string>            PickUpPointsList = new List <string>();
                foreach (var pax in passengers)
                {
                    totalCalculatedDiscount = pax.DiscountAmount > 0 ? pax.DiscountAmount : 0;
                    totalTranFee            = (pax.DiscountAmount < 0 ? Math.Abs(pax.DiscountAmount) : 0);
                    if (_res.isBranchByPassDeal == false)
                    {
                        totalCalculatedDiscount = pax.BranchDeal < 0 ? Math.Abs(pax.BranchDeal) : 0;
                        totalTranFee           += (pax.BranchDeal > 0 ? Math.Abs(pax.BranchDeal) : 0);
                    }
                    if (_res.isDistributorByPassDeal == false)
                    {
                        totalCalculatedDiscount = pax.DistributorDeal < 0 ? Math.Abs(pax.DistributorDeal) : 0;
                        totalTranFee           += (pax.DistributorDeal > 0 ? Math.Abs(pax.DistributorDeal) : 0);
                    }


                    if (model.HideServiceCharge == true)
                    {
                        _total = _total + (pax.Fare + pax.Markup + (pax.ServiceCharge == null ? 0 : pax.ServiceCharge.Value));
                        if (_rate < 1)
                        {
                            _rate = (pax.Fare + pax.Markup - totalCalculatedDiscount + (pax.ServiceCharge == null ? 0 : pax.ServiceCharge.Value));
                        }
                    }
                    else
                    {
                        _total = _total + pax.Fare + pax.Markup; _serviceCharge = _serviceCharge + (pax.ServiceCharge == null ? 0 : pax.ServiceCharge.Value);
                        if (_rate < 1)
                        {
                            _rate = pax.Fare + pax.Markup - totalCalculatedDiscount;
                        }
                    }


                    if (_seatNo.Trim() != "")
                    {
                        _seatNo = _seatNo + "," + pax.SeatNoalias;
                    }
                    else
                    {
                        _seatNo = pax.SeatNoalias == null ? "" : pax.SeatNoalias;
                    }
                    if (_pickUpPoints.Trim() != "")
                    {
                        if (pax.PickupPoint != null)
                        {
                            if (!PickUpPointsList.Contains(pax.PickupPoint.Trim()))
                            {
                                //_pickUpPoints = _pickUpPoints + "," + pax.PickupPoint !=null?pax.PickupPoint.Trim():string.Empty;
                                string formatedText = pax.PickupPoint != null?pax.PickupPoint.Trim() : string.Empty;

                                _pickUpPoints = _pickUpPoints + "," + formatedText;
                                PickUpPointsList.Add(pax.PickupPoint.Trim());
                            }
                        }
                    }
                    else
                    {
                        _pickUpPoints = pax.PickupPoint == null ? "" : pax.PickupPoint; PickUpPointsList.Add(pax.PickupPoint != null ? pax.PickupPoint.Trim() : string.Empty);
                    }
                    if (_passangerName.Trim() != "")
                    {
                        if (pax.PassengerName != null)
                        {
                            if (!PassNameList.Contains(pax.PassengerName.Trim()))
                            {
                                string formatedText = pax.PassengerName != null?pax.PassengerName.Trim() : string.Empty;

                                _passangerName = _passangerName + "," + formatedText;

                                PassNameList.Add(pax.PassengerName.Trim());
                            }
                        }
                    }
                    else
                    {
                        _passangerName = pax.PassengerName == null ? "" : pax.PassengerName;
                        PassNameList.Add(pax.PassengerName.Trim());
                    }
                    BusPassengerModel busPassengerModel = new BusPassengerModel()
                    {
                        BusPassengerId = pax.BusPassengerId,
                        BusPNRId       = pax.BusPNRId,
                        PassengerName  = pax.PassengerName,
                        MobileNumber   = pax.MobileNumber,
                        TicketStatusId = pax.TicketStatusId.Value,
                        StatusName     = pax.TicketStatus.ticketStatusName,
                        TicketNumber   = pax.TicketNumber,
                        SeatNumber     = pax.SeatNoalias,
                        PickupPoint    = pax.PickupPoint,
                        Fare           = pax.Fare + pax.Markup,
                        Markup         = pax.Markup,
                        TaxAmount      = pax.TaxAmount,

                        CommissionAmount = pax.CommissionAmount,
                        DiscountAmount   = pax.DiscountAmount
                    };
                    totalSummedDiscount += totalCalculatedDiscount;
                    passList.Add(busPassengerModel);
                }
                model.DisRate         = _rate - totalTranFee;
                model.TotalAmount     = _total - totalSummedDiscount + totalTranFee;
                model.Passengers      = passList;
                model.SeatNumber      = _seatNo;
                model.ServiceCharge   = _serviceCharge;
                model.GrandTotal      = _total + _serviceCharge - totalSummedDiscount + totalTranFee;;
                model.PickUpPouints   = _pickUpPoints;
                model.PassengerName   = _passangerName;
                model.AvilableBalance = AvilableBalance(_res.AgentId);
                _act.ActionMessage    = "Success";
                _act.MsgNumber        = 0;
                _act.ErrSource        = "DataBase";
                _act.MsgType          = 3;
                _act.MsgStatus        = false;
            }
            else
            {
                _act.ActionMessage = String.Format(Resources.Message.InvalidOperation, "Itineary");
                _act.MsgNumber     = 1005;
                _act.ErrSource     = "DataBase";
                _act.MsgType       = 3;
                _act.MsgStatus     = true;
            }
            model.Message = _act;
            return(model);
        }