Esempio n. 1
0
 public System.Collections.Generic.List <ReservationPeople> GetOrderPeople(ReservationOrder order)
 {
     if (order == null)
     {
         throw new System.ArgumentNullException("order");
     }
     System.Collections.Generic.List <ReservationPeople> result = new System.Collections.Generic.List <ReservationPeople>();
     if (this.people != null && order.peopleids != null)
     {
         result.AddRange(
             from m in this.people
             where order.peopleids.Contains(m.id)
             select m);
     }
     return(result);
 }
Esempio n. 2
0
 public System.Collections.Generic.List <ReservationError> GetOrderErrors(ReservationOrder order)
 {
     if (order == null)
     {
         throw new System.ArgumentNullException("order");
     }
     System.Collections.Generic.List <ReservationError> result = new System.Collections.Generic.List <ReservationError>();
     if (this.errors != null && !string.IsNullOrEmpty(order.id))
     {
         result.AddRange(
             from m in this.errors
             where m.orderid == order.id
             select m);
     }
     return(result);
 }
            public ReservationOrder ReservationOrder(DataRow row, string language, int? claimId, string orderNote)
            {
                ReservationOrder result = new ReservationOrder
                {
                    id = (!row.IsNull("orderid")) ? row.ReadNullableTrimmedString("orderid") : row.ReadNullableInt("localid").ToString(),
                    localid = row.ReadNullableInt("localid"),
                    status = new ReservationStatus
                    {
                        id = row.ReadInt("actstatusid"),
                        description = row.ReadNullableTrimmedString("actstatusname")
                    },
                    datefrom = row.ReadUnspecifiedDateTime("datefrom"),
                    datetill = row.ReadUnspecifiedDateTime("datetill"),
                    partner = row.IsNull("partnerid") ? null : new ReservationPartner
                    {
                        id = row.ReadInt("partnerid"),
                        name = row.ReadNullableTrimmedString("partnername")
                    },
                    pax = new ReservationPax
                    {
                        adult = row.ReadInt("adult"),
                        child = row.ReadInt("child"),
                        infant = row.ReadInt("infant"),
                        extra = row.ReadInt("addinfant")
                    },
                    note = row.ReadNullableTrimmedString("note"),
                    price = (row.IsNull("saleprice") || row.IsNull("salecurrency")) ? null : new ReservationOrderPrice
                    {
                        total = row.ReadDecimal("saleprice"),
                        currency = row.ReadNullableTrimmedString("salecurrency")
                    }
                };
                XElement peopleXml = row.ReadXml("peoples");
                if (peopleXml != null)
                {
                    result.peopleids = new System.Collections.Generic.List<string>();
                    foreach (XElement peopleNode in peopleXml.DescendantsAndSelf("People"))
                    {
                        XElement idNode = peopleNode.Element("Id");
                        XElement localidNode = peopleNode.Element("LocalId");
                        result.peopleids.Add((idNode != null) ? idNode.Value : ((localidNode != null) ? localidNode.Value : ""));
                    }
                }
                string orderType = row.ReadString("type").ToLower();
                if (orderType == "hotel")
                {
                    result.hotel = new HotelReservationOrder
                    {
                        id = row.ReadInt("hotelid"),
                        name = row.ReadNullableTrimmedString("hotelname"),
                        room = row.IsNull("roomid") ? null : new HotelReservationRoom
                        {
                            id = row.ReadInt("roomid"),
                            name = row.ReadNullableTrimmedString("roomname")
                        },
                        htplace = row.IsNull("htplaceid") ? null : new HotelReservationHtplace
                        {
                            id = row.ReadInt("htplaceid"),
                            name = row.ReadNullableTrimmedString("htplacename")
                        },
                        meal = row.IsNull("mealid") ? null : new HotelReservationMeal
                        {
                            id = row.ReadInt("mealid"),
                            name = row.ReadNullableTrimmedString("mealname")
                        }
                    };
                }
                else
                {
                    if (orderType == "excursion")
                    {
                        result.excursion = new ExcursionReservationOrder
                        {
                            id = row.ReadInt("excursid"),
                            name = row.ReadNullableTrimmedString("excursname"),
                            time = row.IsNull("extimeid") ? null : new ExcursionReservationTime
                            {
                                id = row.ReadInt("extimeid"),
                                description = row.ReadNullableTrimmedString("extimename")
                            },
                            grouptype = row.IsNull("exgrouptypeid") ? null : new ExcursionReservationGroup
                            {
                                id = row.ReadInt("exgrouptypeid"),
                                description = row.ReadNullableTrimmedString("exgrouptypename")
                            },
                            language = row.IsNull("languageid") ? null : new ExcursionReservationLanguage
                            {
                                id = row.ReadInt("languageid"),
                                description = row.ReadNullableTrimmedString("languagename")
                            },
                            pickuppoint = row.IsNull("geopointfromid") ? null : new PickupPlace
                            {
                                id = row.ReadInt("geopointfromid"),
                                name = row.ReadNullableTrimmedString("geopointfromname")
                            },
                            pickuphotel = row.IsNull("fromhotelid") ? null : new PickupPlace
                            {
                                id = row.ReadInt("fromhotelid"),
                                name = row.ReadNullableTrimmedString("fromhotelname")
                            },

                            included = GetExcursionIncluded(row.ReadInt("excursid"), language),

                            pickup = GetExcursionPickup(row.ReadInt("excursid"), language, claimId, orderNote)
                        };
                    }
                    else
                    {
                        if (orderType == "transport")
                        {
                            result.freight = new FreightReservationOrder
                            {
                                id = row.ReadInt("freightid"),
                                name = row.ReadNullableTrimmedString("freightname"),
                                bookingclass = row.IsNull("classid") ? null : new FreightReservationBookingclass
                                {
                                    id = row.ReadInt("classid"),
                                    name = row.ReadNullableTrimmedString("classname")
                                },
                                place = row.IsNull("frplaceid") ? null : new FreightReservationPlace
                                {
                                    id = row.ReadInt("frplaceid"),
                                    name = row.ReadNullableTrimmedString("frplacename")
                                }
                            };
                        }
                        else
                        {
                            if (orderType == "transfer")
                            {
                                result.transfer = new TransferReservationOrder
                                {
                                    id = row.ReadInt("serviceid"),
                                    name = row.ReadNullableTrimmedString("servicename")
                                };
                            }
                            else
                            {
                                if (orderType == "service")
                                {
                                    result.service = new ServiceReservationOrder
                                    {
                                        id = row.ReadInt("serviceid"),
                                        name = row.ReadNullableTrimmedString("servicename"),
                                        servicetype = row.IsNull("servtypeid") ? null : new ServiceReservationServicetype
                                        {
                                            id = row.ReadInt("servtypeid"),
                                            name = row.ReadNullableTrimmedString("servtypename")
                                        }
                                    };
                                }
                            }
                        }
                    }
                }
                return result;
            }
Esempio n. 4
0
            public ReservationOrder ReservationOrder(DataRow row, string language, int?claimId, string orderNote)
            {
                ReservationOrder result = new ReservationOrder
                {
                    id      = (!row.IsNull("orderid")) ? row.ReadNullableTrimmedString("orderid") : row.ReadNullableInt("localid").ToString(),
                    localid = row.ReadNullableInt("localid"),
                    status  = new ReservationStatus
                    {
                        id          = row.ReadInt("actstatusid"),
                        description = row.ReadNullableTrimmedString("actstatusname")
                    },
                    datefrom = row.ReadUnspecifiedDateTime("datefrom"),
                    datetill = row.ReadUnspecifiedDateTime("datetill"),
                    partner  = row.IsNull("partnerid") ? null : new ReservationPartner
                    {
                        id   = row.ReadInt("partnerid"),
                        name = row.ReadNullableTrimmedString("partnername")
                    },
                    pax = new ReservationPax
                    {
                        adult  = row.ReadInt("adult"),
                        child  = row.ReadInt("child"),
                        infant = row.ReadInt("infant"),
                        extra  = row.ReadInt("addinfant")
                    },
                    note  = row.ReadNullableTrimmedString("note"),
                    price = (row.IsNull("saleprice") || row.IsNull("salecurrency")) ? null : new ReservationOrderPrice
                    {
                        total    = row.ReadDecimal("saleprice"),
                        currency = row.ReadNullableTrimmedString("salecurrency")
                    }
                };
                XElement peopleXml = row.ReadXml("peoples");

                if (peopleXml != null)
                {
                    result.peopleids = new System.Collections.Generic.List <string>();
                    foreach (XElement peopleNode in peopleXml.DescendantsAndSelf("People"))
                    {
                        XElement idNode      = peopleNode.Element("Id");
                        XElement localidNode = peopleNode.Element("LocalId");
                        result.peopleids.Add((idNode != null) ? idNode.Value : ((localidNode != null) ? localidNode.Value : ""));
                    }
                }
                string orderType = row.ReadString("type").ToLower();

                if (orderType == "hotel")
                {
                    result.hotel = new HotelReservationOrder
                    {
                        id   = row.ReadInt("hotelid"),
                        name = row.ReadNullableTrimmedString("hotelname"),
                        room = row.IsNull("roomid") ? null : new HotelReservationRoom
                        {
                            id   = row.ReadInt("roomid"),
                            name = row.ReadNullableTrimmedString("roomname")
                        },
                        htplace = row.IsNull("htplaceid") ? null : new HotelReservationHtplace
                        {
                            id   = row.ReadInt("htplaceid"),
                            name = row.ReadNullableTrimmedString("htplacename")
                        },
                        meal = row.IsNull("mealid") ? null : new HotelReservationMeal
                        {
                            id   = row.ReadInt("mealid"),
                            name = row.ReadNullableTrimmedString("mealname")
                        }
                    };
                }
                else
                {
                    if (orderType == "excursion")
                    {
                        result.excursion = new ExcursionReservationOrder
                        {
                            id   = row.ReadInt("excursid"),
                            name = row.ReadNullableTrimmedString("excursname"),
                            time = row.IsNull("extimeid") ? null : new ExcursionReservationTime
                            {
                                id          = row.ReadInt("extimeid"),
                                description = row.ReadNullableTrimmedString("extimename")
                            },
                            grouptype = row.IsNull("exgrouptypeid") ? null : new ExcursionReservationGroup
                            {
                                id          = row.ReadInt("exgrouptypeid"),
                                description = row.ReadNullableTrimmedString("exgrouptypename")
                            },
                            language = row.IsNull("languageid") ? null : new ExcursionReservationLanguage
                            {
                                id          = row.ReadInt("languageid"),
                                description = row.ReadNullableTrimmedString("languagename")
                            },
                            pickuppoint = row.IsNull("geopointfromid") ? null : new PickupPlace
                            {
                                id   = row.ReadInt("geopointfromid"),
                                name = row.ReadNullableTrimmedString("geopointfromname")
                            },
                            pickuphotel = row.IsNull("fromhotelid") ? null : new PickupPlace
                            {
                                id   = row.ReadInt("fromhotelid"),
                                name = row.ReadNullableTrimmedString("fromhotelname")
                            },

                            included = GetExcursionIncluded(row.ReadInt("excursid"), language),

                            pickup = GetExcursionPickup(row.ReadInt("excursid"), language, claimId, orderNote)
                        };
                    }
                    else
                    {
                        if (orderType == "transport")
                        {
                            result.freight = new FreightReservationOrder
                            {
                                id           = row.ReadInt("freightid"),
                                name         = row.ReadNullableTrimmedString("freightname"),
                                bookingclass = row.IsNull("classid") ? null : new FreightReservationBookingclass
                                {
                                    id   = row.ReadInt("classid"),
                                    name = row.ReadNullableTrimmedString("classname")
                                },
                                place = row.IsNull("frplaceid") ? null : new FreightReservationPlace
                                {
                                    id   = row.ReadInt("frplaceid"),
                                    name = row.ReadNullableTrimmedString("frplacename")
                                }
                            };
                        }
                        else
                        {
                            if (orderType == "transfer")
                            {
                                result.transfer = new TransferReservationOrder
                                {
                                    id   = row.ReadInt("serviceid"),
                                    name = row.ReadNullableTrimmedString("servicename")
                                };
                            }
                            else
                            {
                                if (orderType == "service")
                                {
                                    result.service = new ServiceReservationOrder
                                    {
                                        id          = row.ReadInt("serviceid"),
                                        name        = row.ReadNullableTrimmedString("servicename"),
                                        servicetype = row.IsNull("servtypeid") ? null : new ServiceReservationServicetype
                                        {
                                            id   = row.ReadInt("servtypeid"),
                                            name = row.ReadNullableTrimmedString("servtypename")
                                        }
                                    };
                                }
                            }
                        }
                    }
                }
                return(result);
            }