Beispiel #1
0
        //訂單明細中下方的「旅客資料」
        public static List <OMDL_CUST_DATA> GetOrderCus(JToken obj)
        {
            List <OMDL_CUST_DATA> order_cus = new List <OMDL_CUST_DATA>();
            OMDL_CUST_DATA        cus       = new OMDL_CUST_DATA();

            foreach (var item in obj)
            {
                if (item["englishName"] != null)
                {
                    if (item["englishName"]["lastName"] != null && item["englishName"]["firstName"] != null)
                    {
                        var lastName  = item["englishName"]["lastName"];
                        var firstName = item["englishName"]["firstName"];
                        cus.englishName = string.Format("{0}{1}{2}", lastName, " ", firstName);
                    }
                }
                if (item["gender"] != null)
                {
                    cus.gender = item["gender"].ToString();
                }
                if (item["meal"] != null && item["meal"]["mealName"] != null)
                {
                    cus.meal = item["meal"]["mealName"].ToString();
                }
                if (item["nationality"] != null)
                {
                    nationalityInfo national = new nationalityInfo();

                    if (item["nationality"]["nationalityCode"] != null)
                    {
                        national.nationalityCode = item["nationality"]["nationalityCode"].ToString();
                    }
                    if (item["nationality"]["TWIdentity_number"] != null)
                    {
                        national.TWIdentity_number = item["nationality"]["TWIdentity_number"].ToString();
                    }
                    if (item["nationality"]["MTPNumber"] != null)
                    {
                        national.MTPNumber = item["nationality"]["MTPNumber"].ToString();
                    }
                    if (item["nationality"]["HKMOIdentityNumber"] != null)
                    {
                        national.HKMOIdentityNumber = item["nationality"]["HKMOIdentityNumber"].ToString();
                    }

                    cus.nationality = national;
                }
                if (item["birthday"] != null)
                {
                    cus.birthday = item["birthday"].ToString();
                }
                if (item["passport"] != null)
                {
                    passportInfo pass = new passportInfo();

                    if (item["passport"]["passportNo"] != null)
                    {
                        pass.passportNo = item["passport"]["passportNo"].ToString();
                    }
                    if (item["passport"]["passportExpDate"] != null)
                    {
                        pass.passportExpDate = item["passport"]["passportExpDate"].ToString();
                    }

                    cus.passport = pass;
                }
                if (item["localName"] != null)
                {
                    if (item["localName"]["lastName"] != null && item["localName"]["firstName"] != null)
                    {
                        var lastName  = item["localName"]["lastName"];
                        var firstName = item["localName"]["firstName"];
                        cus.localName = string.Format("{0}{1}{2}", lastName, " ", firstName);
                    }
                }
                if (item["height"] != null)
                {
                    if (item["height"]["value"] != null && item["height"]["unit"] != null)
                    {
                        cus.height = string.Format("{0}{1}", item["height"]["value"], item["height"]["unit"]);
                    }
                }
                if (item["weight"] != null)
                {
                    if (item["weight"]["value"] != null && item["weight"]["unit"] != null)
                    {
                        cus.weight = string.Format("{0}{1}", item["weight"]["value"], item["weight"]["unit"]);
                    }
                }
                if (item["shoeSize"] != null)
                {
                    if (item["shoeSize"]["type"] != null && item["shoeSize"]["unit"] != null && item["shoeSize"]["value"] != null)
                    {
                        string type  = item["shoeSize"]["type"].ToString();
                        string unit  = item["shoeSize"]["unit"].ToString();
                        double?value = (double?)item["shoeSize"]["value"];
                        cus.shoeSize = string.Format("{0}{1}{2}", type, value, unit);
                    }
                }
                if (item["glassDiopter"] != null)
                {
                    cus.glassDiopter = (double?)item["glassDiopter"];
                }

                order_cus.Add(cus);
            }

            return(order_cus);
        }
Beispiel #2
0
        //假聯絡人
        //public static distributorInfo fakeContact()
        //{

        //    distributorInfo fake = new distributorInfo()
        //    {
        //        companyXid = "1",
        //        channelOid = "111",
        //        userid = "2",
        //        firstName = "sharon",
        //        lastName = "chang",
        //        areatel = "886",
        //        tel = "3939889",
        //        email = "*****@*****.**",
        //        countryCd = "TW",
        //        lang = "zh-tw",
        //        currency = "TWD",
        //        state="TW",
        //        memberUuid = "051794b8-db2a-4fe7-939f-31ab1ee2c719",
        //        tokenKey = "897af29c45ed180451c2e6bfa81333b6",
        //        deviceId = "3c2ab71448224d1d7148350f7972e96e"
        //    };

        //    return fake;
        //}

        //假國攷
        //public static List<Country> fakeCountry()
        //{
        //    Country c1 = new Country() { countryCd = "TW", countryName = "台灣", countryEngName = "TAIWAN" };
        //    Country c2 = new Country() { countryCd = "HK", countryName = "香港", countryEngName = "HONG KONG" };
        //    Country c3 = new Country() { countryCd = "MO", countryName = "澳門", countryEngName = "MO" };
        //    Country c4 = new Country() { countryCd = "CN", countryName = "中國", countryEngName = "CN" };
        //    Country c5 = new Country() { countryCd = "US", countryName = "美國", countryEngName = "US" };

        //    List<Country> lstCountry = new List<Country>();
        //    lstCountry.Add(c1);
        //    lstCountry.Add(c2);
        //    lstCountry.Add(c3);
        //    lstCountry.Add(c4);
        //    lstCountry.Add(c5);

        //    return lstCountry;
        //}

        //單純的目的是產出前台可以使用的object string
        public static DataModel getDefaultDataModel(int qty, string guidNo)
        {
            DataModel d = new DataModel();

            d.guidNo = guidNo;

            modulesData modules = new modulesData();

            otherDataM other = new otherDataM();

            other.moduleType = "OMDL_OTHER_DATA";
            moduleData_otherData mo = new moduleData_otherData();

            other.moduleData  = mo;
            modules.otherData = other;

            contactDataM contact = new contactDataM();

            contact.moduleType = "OMDL_CONTACT_DATA";
            moduleData_contactData mcontract = new moduleData_contactData();
            contactNameInfo        cni       = new contactNameInfo();
            contactTelInfo         cti       = new contactTelInfo();
            contactAppInfo         cai       = new contactAppInfo();

            mcontract.contactName = cni;
            mcontract.contactTel  = cti;
            mcontract.contactApp  = cai;
            contact.moduleData    = mcontract;


            modules.contactData = contact;

            sendDataM send = new sendDataM();

            send.moduleType = "OMDL_SEND_DATA";
            moduleData_sendData msend         = new moduleData_sendData();
            receiverNameInfo    receiverName  = new receiverNameInfo();
            receiverTelInfo     receiverTel   = new receiverTelInfo();
            sendToCountryInfo   sendToCountry = new sendToCountryInfo();

            receiveAddressInfo receiveAdd = new receiveAddressInfo();

            sendToCountry.receiveAddress = receiveAdd;

            sendToHotelInfo sendToHotel = new sendToHotelInfo();
            buyerPassportEnglishNameInfo buyerPassportEnglishName = new buyerPassportEnglishNameInfo();
            buyerLocalNameInfo           buyerLocalName           = new buyerLocalNameInfo();

            sendToHotel.buyerPassportEnglishName = buyerPassportEnglishName;
            sendToHotel.buyerLocalName           = buyerLocalName;
            shipInfoInfo shipInfo = new shipInfoInfo();

            msend.receiverName  = receiverName;
            msend.receiverTel   = receiverTel;
            msend.sendToCountry = sendToCountry;
            msend.sendToHotel   = sendToHotel;
            msend.shipInfo      = shipInfo;
            send.moduleData     = msend;
            modules.sendData    = send;

            passengerDataM passenger = new passengerDataM();

            passenger.moduleType = "OMDL_PSGR_DATA";
            moduleData_passenger mp            = new moduleData_passenger();
            qtyChildSeatInfo     qtyChildSeat  = new qtyChildSeatInfo();
            qtyInfantSeatInfo    qtyInfantSeat = new qtyInfantSeatInfo();

            mp.qtyChildSeat       = qtyChildSeat;
            mp.qtyInfantSeat      = qtyInfantSeat;
            passenger.moduleData  = mp;
            modules.passengerData = passenger;

            carRentingDataM carRentingData = new carRentingDataM();

            carRentingData.moduleType = "OMDL_RENT_CAR";
            moduleData_CarRent cm     = new moduleData_CarRent();
            pickUpInfo_forCar  pickUp = new pickUpInfo_forCar();

            dateTimeInfo t = new dateTimeInfo();

            pickUp.datetime = t;

            dropOffInfo_forCar dropOff = new dropOffInfo_forCar();

            dropOff.datetime          = t;
            cm.pickUp                 = pickUp;
            cm.dropOff                = dropOff;
            carRentingData.moduleData = cm;
            modules.carRentingData    = carRentingData;

            shuttleDataM shuttle = new shuttleDataM();

            shuttle.moduleType = "OMDL_SHUTTLE";
            moduleData_Shuttle     ms = new moduleData_Shuttle();
            designatedLocationInfo designatedLocation = new designatedLocationInfo();
            timeInfo   time = new timeInfo();
            pickUpInfo pp   = new pickUpInfo();

            pp.time = time;
            dropOffInfo dd = new dropOffInfo();
            designatedByCustomerInfo designatedByCustomer = new designatedByCustomerInfo();

            designatedByCustomer.pickUp  = pp;
            designatedByCustomer.dropOff = dd;
            charterRouteInfo charterRoute = new charterRouteInfo();

            ms.designatedLocation   = designatedLocation;
            ms.designatedByCustomer = designatedByCustomer;
            ms.charterRoute         = charterRoute;
            shuttle.moduleData      = ms;
            modules.shuttleData     = shuttle;

            flightInfoDataM flight = new flightInfoDataM();

            flight.moduleType = "OMDL_FLIGHT_INFO";
            moduleData_FlightInfo mf      = new moduleData_FlightInfo();
            arrivalInfo           arrival = new arrivalInfo();

            arrivalDatetimeInfo atime = new arrivalDatetimeInfo();

            arrival.arrivalDatetime = atime;
            departureInfo         departure = new departureInfo();
            departureDatetimeInfo dtime     = new departureDatetimeInfo();

            departure.departureDatetime = dtime;

            mf.arrival             = arrival;
            mf.departure           = departure;
            flight.moduleData      = mf;
            modules.flightInfoData = flight;

            d.modules = modules;


            List <CusDataInfo> LstCus = new List <CusDataInfo>();

            for (int i = 0; i < qty; i++)
            {
                CusDataInfo cus = new CusDataInfo();

                nationalityInfo nation = new nationalityInfo();
                cus.nationality = nation;
                passportInfo ppt = new passportInfo();
                cus.passport = ppt;

                englishNameInfo en = new englishNameInfo();
                cus.englishName = en;
                localNameInfo localName = new localNameInfo();
                cus.localName = localName;
                weightInfo weight = new weightInfo();
                cus.weight = weight;
                heightInfo height = new heightInfo();
                cus.height = height;
                shoeSizeInfo shoes = new shoeSizeInfo();
                cus.shoeSize = shoes;

                foodAllergyInfo food = new foodAllergyInfo();
                mealInfo        meal = new mealInfo();
                meal.foodAllergy     = food;
                meal.excludeFoodType = new string[] { };

                cus.meal = meal;
                LstCus.Add(cus);
            }
            d.travelerData = LstCus;

            cardInfo card = new cardInfo();

            d.card = card;

            return(d);
        }