Esempio n. 1
0
        public JsonResult GetAllCarrierCode()
        {
            var model = new PnrResource().CarrayDictionary.CarrayList.Select(p => new
            {
                AirCode = p.AirCode,
                AirName = p.AirCode + "-" + p.Carry.AirName
            });

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/x-javascript";
            List <Type> list = new List <Type>()
            {
                typeof(EnumTravelType),
                typeof(EnumReleaseType),
                typeof(EnumIssueTicketWay),
                typeof(EnumApply),
                typeof(EnumPayStatus),
                typeof(EnumPayMethod),
                typeof(EnumOrderStatus),
                typeof(EnumTfgProcessStatus),
                typeof(EnumPolicySourceType),
                typeof(EnumSmsTemplateType),
                typeof(EnumSkyWayType),
                typeof(FixedOnSaleType),
                typeof(EnumAriChangNotifications),
                typeof(EnumRefuse)
            };
            StringBuilder sb = new StringBuilder();

            foreach (Type item in list)
            {
                string arrayName = item.Name;
                sb.AppendFormat("var {0} = new Array();", arrayName);
                foreach (var enumItem in Enum.GetNames(item))
                {
                    var    obj       = Enum.Parse(item, enumItem, false);
                    string descStr   = enumItem;
                    var    descModel = obj.GetType().GetField(enumItem).GetCustomAttributes(typeof(DescriptionAttribute), false).OfType <DescriptionAttribute>().FirstOrDefault();
                    if (descModel != null)
                    {
                        descStr = descModel.Description;
                    }
                    sb.AppendFormat("{0}[{1}]={{Value:{1},Text:'{3}',Description:'{2}'}};", arrayName, (int)obj, descStr, enumItem);
                }
            }
            //航空公司
            sb.Append("var CarrayList=new Array();");
            var carrayList = new PnrResource().CarrayDictionary.CarrayList;

            for (int i = 0; i < carrayList.Count; i++)
            {
                sb.AppendFormat("CarrayList[{0}]={{Value:'{1}',Text:'{2}'}};", i, carrayList[i].AirCode, carrayList[i].AirCode + "-" + carrayList[i].Carry.AirName);
            }

            context.Response.Write(sb.ToString());
        }
Esempio n. 3
0
        /// <summary>
        /// 运营商个人信息
        /// </summary>
        /// <returns></returns>
        public ActionResult CarrierIndex()
        {
            CarrierDataObject dataObject = null;

            CommunicateManager.Invoke <IConsoBusinessmanService>(p =>
            {
                dataObject = p.GetCarrierDetail();
            });
            var carrayCodeModel = new PnrResource().CarrayDictionary.CarrayList.Select(p => new
            {
                AirCode = p.AirCode,
                AirName = p.AirCode + "-" + p.Carry.AirName
            }).ToList();

            carrayCodeModel.Insert(0, new { AirCode = "ALL", AirName = "ALL-所有航空公司" });
            return(View(new { DataObject = dataObject, CarrayCodeModel = carrayCodeModel }));
        }
Esempio n. 4
0
        public static OrderDto ToOrderDto(this Order p, OrderDto result = null)
        {
            var         temp        = p.OrderLogs.Where(x => x.OperationContent.Contains("拒绝出票")).FirstOrDefault();
            DataBill    databill    = new DataBill();
            PnrResource pnrResource = new PnrResource();

            if (result == null)
            {
                result = new OrderDto();
            }
            result.HasAfterSale              = p.HasAfterSale;
            result.OutOrderId                = p.OutOrderId;
            result.OrderId                   = p.OrderId;
            result.IsSupplier                = AuthManager.GetCurrentUser().Type == "Supplier" ? true : false;
            result.IsCarrier                 = AuthManager.GetCurrentUser().Code == p.CarrierCode ? true : false;
            result.CurrentCode               = AuthManager.GetCurrentUser().Code;
            result.UserRole                  = AuthManager.GetCurrentUser().Type;
            result.CPMoney                   = p.CPMoney;
            result.OrderMoney                = p.OrderMoney;
            result.Remark                    = p.Remark;
            result.PnrCode                   = p.PnrCode;
            result.CarrierCode               = p.CarrierCode;
            result.BigCode                   = p.BigCode;
            result.PNRContent                = p.PnrContent;
            result.OrderStatus               = (int)p.OrderStatus;
            result.BusinessmanName           = p.BusinessmanName;
            result.BusinessmanCode           = p.BusinessmanCode;
            result.CreateTime                = p.CreateTime;
            result.LockAccount               = p.LockAccount;
            result.IsCompleted               = p.CoordinationStatus;
            result.OrderCommissionTotalMoney = p.OrderCommissionTotalMoney;
            result.PnrSource                 = p.PnrSource;
            result.IsChangePnrTicket         = p.IsChangePnrTicket;
            result.IsLowPrice                = p.IsLowPrice;
            result.HaveBabyFlag              = p.HaveBabyFlag;
            result.RealRemark                = temp != null ? temp.OperationContent : string.Empty;
            result.OrderSource               = p.OrderSource;
            result.OldOrderId                = p.OldOrderId;
            result.YdOffice                  = p.YdOffice;
            result.CpOffice                  = p.CpOffice;
            result.OrderType                 = p.OrderType.ToString();
            result.PayInfo                   = new OrderPayDto();
            if (p.OrderPay != null)
            {
                result.PayInfo.PayMethodCode     = p.OrderPay.PayMethodCode;
                result.PayInfo.PayDateTime       = p.OrderPay.PayDateTime;
                result.PayInfo.PaidMethod        = p.OrderPay.PaidMethod == null ? null : p.OrderPay.PaidMethod.ToString();
                result.PayInfo.PayDateTime       = p.OrderPay.PayDateTime;
                result.PayInfo.PayMethod         = GetPayMethod(p.OrderPay.PayMethod == null ? null : p.OrderPay.PayMethod.ToString());
                result.PayInfo.PaidMoney         = p.OrderPay.PaidMoney;
                result.PayInfo.PayMoney          = p.OrderPay.PayMoney;
                result.PayInfo.PaidSerialNumber  = p.OrderPay.PaidSerialNumber;
                result.PayInfo.PaySerialNumber   = p.OrderPay.PaySerialNumber;
                result.PayInfo.SystemFee         = p.OrderPay.SystemFee;
                result.PayInfo.TradePoundage     = p.OrderPay.TradePoundage;
                result.PayInfo.PaidStatus        = p.OrderPay.PaidStatus;
                result.PayInfo.PayStatus         = p.OrderPay.PayStatus;
                result.PayInfo.PayBillDetailDtos = p.OrderPay.PayBillDetails.Select(x => new PayBillDetailDto()
                {
                    ID          = x.ID,
                    Code        = x.Code,
                    CashbagCode = x.CashbagCode,
                    AdjustType  = x.AdjustType,
                    Money       = x.Money,
                    Name        = x.Name,
                    OpType      = x.OpType.ToEnumDesc(),
                    Point       = x.Point,
                    Remark      = x.Remark
                }).ToList();
                if (p.OrderPay.PaidDateTime.HasValue)
                {
                    DateTime ticketTime = DateTime.Now;
                    if (p.IssueTicketTime.HasValue)
                    {
                        ticketTime = p.IssueTicketTime.Value;
                    }
                    result.Time = (int)ticketTime.Subtract(p.OrderPay.PaidDateTime.Value).TotalMinutes;
                }
            }
            result.Policy = new PolicyDto();
            if (p.Policy != null)
            {
                result.Policy = p.Policy.ToPolicyDto(p);
            }

            result.Passengers = p.Passengers
                                .Select(x => new PassengerDto()
            {
                Id                   = x.Id,
                PassengerName        = x.PassengerName,
                CardNo               = x.CardNo,
                TaxFee               = x.ABFee,
                RQFee                = x.RQFee,
                SeatPrice            = x.SeatPrice,
                Mobile               = x.Mobile,
                PassengerType        = x.PassengerType,                   //.ToEnumDesc(),
                TicketNumber         = x.TicketNumber,
                TravelNumber         = x.TravelNumber,
                PassengerTripStatus  = x.PassengerTripStatus,
                PayMoney             = x.PayMoney,
                BuyInsuranceCount    = x.BuyInsuranceCount,
                BuyInsurancePrice    = x.BuyInsurancePrice,
                IsInsuranceRefund    = x.IsInsuranceRefund,
                InsuranceRefunrPrice = x.InsuranceRefunrPrice,
                IdType               = x.IdType,
                SexType              = x.SexType,
                Birth                = x.Birth,
                CPMoney              = x.CPMoney
            }).ToList();
            result.SkyWays = p.SkyWays
                             .Select(k => new SkyWayDto()
            {
                SkyWayId        = k.Id,
                FromCityCode    = k.FromCityCode,
                ToCityCode      = k.ToCityCode,
                FromCity        = pnrResource.GetCityInfo(k.FromCityCode) == null ? "" : pnrResource.GetCityInfo(k.FromCityCode).city.Name,
                ToCity          = pnrResource.GetCityInfo(k.ToCityCode) == null ? "" : pnrResource.GetCityInfo(k.ToCityCode).city.Name,
                CarrayShortName = pnrResource.GetAirInfo(k.CarrayCode) == null ? "" : pnrResource.GetAirInfo(k.CarrayCode).Carry.AirShortName,
                CarrayCode      = k.CarrayCode,
                StartDateTime   = k.StartDateTime,
                ToDateTime      = k.ToDateTime,
                FlightNumber    = k.FlightNumber,
                FromTerminal    = k.FromTerminal,
                Seat            = k.Seat,
                ToTerminal      = k.ToTerminal,
                Discount        = k.Discount.HasValue ? k.Discount.Value : 0m,
                FlightModel     = k.FlightModel
            }).ToList();


            return(result);
        }
Esempio n. 5
0
        public void SendSmsForPhone(string OrderId, string Content, int[] PassengerId)
        {
            string          code        = AuthManager.GetCurrentUser().Code;
            var             businessman = businessmanRepository.FindAll(x => x.Code == code).SingleOrDefault();
            CurrentUserInfo currentUser = AuthManager.GetCurrentUser();

            if (currentUser == null)
            {
                throw new CustomException(404, "获取信息失败,请稍后再试!");
            }
            if (string.IsNullOrEmpty(Content))
            {
                throw new CustomException(400, "发送短信内容不能为空!");
            }


            var         mOrder      = orderRepository.FindAll(x => x.OrderId == OrderId).FirstOrDefault();
            ChangeOrder mafterOrder = null;

            if (mOrder.HasAfterSale == true)
            {
                mafterOrder = afterSaleOrderRepository.FindAll(p => p.Order.OrderId == mOrder.OrderId && p is ChangeOrder).Select(p => p as ChangeOrder).FirstOrDefault();
            }
            PnrResource pnrResource      = new PnrResource();
            string      fromCity         = null;
            string      toCity           = null;
            string      flightTime       = null;
            string      arriveTime       = null;
            string      flightNumber     = null;
            string      flightCarrayCode = null;

            if (mOrder.SkyWays != null && mOrder.SkyWays.Count == 1)
            {
                //单程
                fromCity         = pnrResource.GetCityInfo(mOrder.SkyWays[0].FromCityCode).city.Name;
                toCity           = pnrResource.GetCityInfo(mOrder.SkyWays[0].ToCityCode).city.Name;
                flightTime       = mOrder.SkyWays[0].StartDateTime.ToString("yyyy-MM-dd HH:mm");
                arriveTime       = mOrder.SkyWays[0].ToDateTime.ToString("HH:mm");
                flightNumber     = mOrder.SkyWays[0].FlightNumber;
                flightCarrayCode = mOrder.SkyWays[0].CarrayCode;

                Content = Content.Replace("[航空公司航班号]", flightCarrayCode + flightNumber);
                Content = Content.Replace("[出发城市]", fromCity);
                Content = Content.Replace("[出发航站楼]", mOrder.SkyWays[0].FromTerminal);
                Content = Content.Replace("[到达城市]", toCity);
                Content = Content.Replace("[到达航站楼]", mOrder.SkyWays[0].ToTerminal);
                if (mafterOrder != null)
                {
                    flightTime = DateTime.Parse(mafterOrder.SkyWay[0].FlyDate.ToString()).ToString("yyyy-MM-dd HH:mm");
                }
                Content = Content.Replace("[起飞时间]", flightTime);
                Content = Content.Replace("[到达时间]", arriveTime);
            }
            else if (mOrder.SkyWays != null && mOrder.SkyWays.Count == 2)
            {
                //返程联程
                var fromCity1 = pnrResource.GetCityInfo(mOrder.SkyWays[0].FromCityCode).city.Name;
                var fromCity2 = pnrResource.GetCityInfo(mOrder.SkyWays[1].FromCityCode).city.Name;
                var toCity1   = pnrResource.GetCityInfo(mOrder.SkyWays[0].ToCityCode).city.Name;
                var toCity2   = pnrResource.GetCityInfo(mOrder.SkyWays[1].ToCityCode).city.Name;
                flightCarrayCode = mOrder.SkyWays[0].CarrayCode;
                flightNumber     = mOrder.SkyWays[0].FlightNumber;
                flightTime       = mOrder.SkyWays[0].StartDateTime.ToString("yyyy-MM-dd HH:mm");
                arriveTime       = mOrder.SkyWays[0].ToDateTime.ToString("HH:mm");
                var flightCarrayCodeBack = mOrder.SkyWays[1].CarrayCode;
                var flightNumberNameBack = mOrder.SkyWays[1].FlightNumber;

                var flightTimeBack = mOrder.SkyWays[1].StartDateTime.ToString("yyyy-MM-dd HH:mm");
                var arriveTimeBack = mOrder.SkyWays[1].ToDateTime.ToString("HH:mm");
                if (fromCity1 == toCity2 && toCity1 == fromCity2)
                {
                    //往返

                    Content = Content.Replace("[航空公司航班号]", flightCarrayCode + flightNumber);
                    Content = Content.Replace("[出发城市]", fromCity1);
                    Content = Content.Replace("[出发航站楼]", mOrder.SkyWays[0].FromTerminal);
                    Content = Content.Replace("[到达城市]", toCity1);
                    Content = Content.Replace("[到达航站楼]", mOrder.SkyWays[0].ToTerminal);
                    Content = Content.Replace("[起飞时间]", flightTime);
                    Content = Content.Replace("[到达时间]", arriveTime);

                    Content = Content.Replace("[回程航空公司航班号]", flightCarrayCodeBack + flightNumberNameBack);
                    Content = Content.Replace("[回程出发城市]", fromCity2);
                    Content = Content.Replace("[回程出发航站楼]", mOrder.SkyWays[1].FromTerminal);
                    Content = Content.Replace("[回程到达城市]", toCity2);
                    Content = Content.Replace("[回程到达航站楼]", mOrder.SkyWays[1].ToTerminal);
                    Content = Content.Replace("[回程起飞时间]", flightTimeBack);
                    Content = Content.Replace("[回程到达时间]", arriveTimeBack);
                }
                else
                {
                    //中转
                    Content = Content.Replace("[航空公司航班号]", flightCarrayCode + flightNumber);
                    Content = Content.Replace("[出发城市]", fromCity1);
                    Content = Content.Replace("[出发航站楼]", mOrder.SkyWays[0].FromTerminal);
                    Content = Content.Replace("[到达城市]", toCity1);
                    Content = Content.Replace("[到达航站楼]", mOrder.SkyWays[0].ToTerminal);
                    Content = Content.Replace("[起飞时间]", flightTime);
                    Content = Content.Replace("[到达时间]", arriveTime);

                    Content = Content.Replace("[中转航空公司航班号]", flightCarrayCodeBack + flightNumberNameBack);
                    Content = Content.Replace("[中转出发城市]", fromCity2);
                    Content = Content.Replace("[中转出发航站楼]", mOrder.SkyWays[1].FromTerminal);
                    Content = Content.Replace("[中转到达城市]", toCity2);
                    Content = Content.Replace("[中转到达航站楼]", mOrder.SkyWays[1].ToTerminal);
                    Content = Content.Replace("[回程起飞时间]", flightTimeBack);
                    Content = Content.Replace("[回程到达时间]", arriveTimeBack);
                }
            }


            for (int i = 0; i < mOrder.Passengers.Where(p => PassengerId.Contains(p.Id)).Count(); i++)
            {
                Content = Content.Replace("[乘客名称]", mOrder.Passengers[i].PassengerName);
                Content = Content.Replace("[证件号]", mOrder.Passengers[i].CardNo);
                if (Content.Length > 300)
                {
                    throw new CustomException(400, "短信内容只能在300字数内!");
                }
                int sendCount = Convert.ToInt32(Math.Ceiling((double)Content.Length / 64));
                if (sendCount > businessman.SMS.RemainCount)
                {
                    throw new CustomException(400, "你的短信不足,请充值购买!");
                }
                businessman.SendMessage(currentUser.OperatorName, mOrder.Passengers[i].PassengerName, mOrder.Passengers[i].Mobile, Content);
            }

            unitOfWorkRepository.PersistUpdateOf(businessman);
            unitOfWork.Commit();
        }