private static void AddPartnerContent(ref PartnerContent defaultContent, DataRow row)
        {
            if(!row.IsNull("description"))
                defaultContent.Description = row.ReadNullableTrimmedString("description");

            if (!row.IsNull("title"))
                defaultContent.Title = row.ReadNullableTrimmedString("title");

            if (!row.IsNull("keywords"))
                defaultContent.Keywords = row.ReadNullableTrimmedString("keywords");

            if (!row.IsNull("footer"))
                defaultContent.Footer = row.ReadNullableTrimmedString("footer");

            if (!row.IsNull("header"))
                defaultContent.Header = row.ReadNullableTrimmedString("header");

            if (!row.IsNull("background_image_name"))
                defaultContent.ImageName = row.ReadNullableTrimmedString("background_image_name");

            if (!row.IsNull("partner_id"))
                defaultContent.PartnerId = row.ReadInt("partner_id");

            if (!row.IsNull("partner_user_id"))
                defaultContent.UserId = row.ReadInt("partner_user_id");
        }
 internal GuestClaim GuestClaim(DataRow row)
 {
     return new GuestClaim
     {
         claim = row.ReadInt("claim$id"),
         period = new DatePeriod
         {
             begin = new System.DateTime?(row.ReadDateTime("claim$datebeg")),
             end = new System.DateTime?(row.ReadDateTime("claim$dateend"))
         },
         tourname = row.ReadNullableTrimmedString("tour$name")
     };
 }
 internal CharacteristicRank CharacteristicRank(DataRow row)
 {
     return new CharacteristicRank
     {
         Id = row.ReadInt("characteristic"),
         Name = row.ReadNullableTrimmedString("name"),
         Rank = row.ReadNullableDecimal("averagerank")
     };
 }
            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;
            }
 public ReservationError ReservationError(DataRow row)
 {
     ReservationError result = new ReservationError
     {
         orderid = row.ReadNullableTrimmedString("orderid"),
         number = row.ReadInt("errnum", 0),
         message = row.ReadNullableTrimmedString("errmessage"),
         usermessage = row.ReadNullableTrimmedString("usermessage"),
         isstop = row.ReadBoolean("stop")
     };
     string errortype = row.ReadNullableTrimmedString("errtype");
     if (errortype != null)
     {
         string text = errortype.ToLower();
         if (text != null)
         {
             if (!(text == "system"))
             {
                 if (text == "user")
                 {
                     result.errortype = ReservationErrorType.user;
                 }
             }
             else
             {
                 result.errortype = ReservationErrorType.system;
             }
         }
     }
     return result;
 }
 internal GuestService.Data.HotelCatalogObject HotelCatalogObject(DataRow row)
 {
     return new GuestService.Data.HotelCatalogObject { id = row.ReadInt("hotel$inc"), alias = row.ReadNullableTrimmedString("hotel$key"), name = row.ReadNullableTrimmedString("hotel$name"), star = this.HotelStar(row), town = this.Town(row), region = this.Region(row), address = row.ReadNullableTrimmedString("hotel$address"), web = row.ReadNullableTrimmedString("hotel$web"), geoposition = (row.IsNull("map$latitude") || row.IsNull("map$longitude")) ? null : new GeoLocation() };
 }
 internal GuestService.Data.WebPartner OnlinePartner(DataRow row)
 {
     return new GuestService.Data.WebPartner { id = row.ReadInt("partner"), passId = row.ReadInt("partpass"), alias = row.ReadNullableTrimmedString("alias") };
 }
 internal QuestionnaireQuestion QuestionnaireQuestion(DataRow row)
 {
     return new QuestionnaireQuestion
     {
         Id = row.ReadInt("question"),
         Category = row.ReadNullableTrimmedString("questioncategory"),
         IsMultiple = row.ReadBoolean("ismultiple"),
         Text = row.ReadNullableTrimmedString("questiontext"),
         IsNote = row.ReadBoolean("isnote"),
         NoteCaption = row.ReadNullableTrimmedString("notecaption")
     };
 }
 internal QuestionnaireGroup QuestionnaireGroup(DataRow row)
 {
     return new QuestionnaireGroup
     {
         Id = row.ReadInt("questiongroup"),
         Caption = row.ReadNullableTrimmedString("caption")
     };
 }
 public ReservationState ReservationState(DataRow row)
 {
     return new ReservationState
     {
         claimId = row.ReadNullableInt("claim_id"),
         status = row.IsNull("status_id") ? null : new ReservationStatus
         {
             id = row.ReadInt("status_id"),
             description = row.ReadNullableTrimmedString("status_name")
         },
         partner = row.IsNull("partner_id") ? null : new ReservationPartner
         {
             id = row.ReadInt("partner_id"),
             name = row.ReadNullableTrimmedString("partner_name")
         },
         confirmation = row.IsNull("confirm_id") ? null : new ReservationConfirmStatus
         {
             id = row.ReadInt("confirm_id"),
             description = row.ReadNullableTrimmedString("confirm_name")
         },
         price = (row.IsNull("payprice") || row.IsNull("payrest") || row.IsNull("paycurrency")) ? null : new ReservationPrice
         {
             total = row.ReadDecimal("payprice"),
             topay = row.ReadDecimal("payrest"),
             currency = row.ReadNullableTrimmedString("paycurrency")
         },
         action = new ReservationAction
         {
             canshowprice = row.ReadBoolean("showprice", false),
             canprintvoucher = row.ReadBoolean("printvoucher", false),
             canpay = row.ReadBoolean("canpay", false)
         },
         timelimit = GetClaimTimelimit(row.ReadNullableInt("claim_id"))
     };
 }
 private PartnerContent PartnerContent(DataRow row)
 {
     return new PartnerContent()
     {
         Description = row.ReadNullableTrimmedString("description"),
         Title = row.ReadNullableTrimmedString("title"),
         Keywords = row.ReadNullableTrimmedString("keywords"),
         Footer = row.ReadNullableTrimmedString("footer"),
         Header = row.ReadNullableTrimmedString("header"),
         ImageName = row.ReadNullableTrimmedString("background_image_name"),
         PartnerId = row.ReadInt("partner_id"),
         UserId = row.ReadInt("partner_user_id")
     };
 }
 internal DepartureTransfer DepartureTransfer(bool useNameField, DataRow row)
 {
     return new DepartureTransfer
     {
         id = row.ReadInt("transfer$inc"),
         ident = row.ReadNullableTrimmedString("transfer$ident"),
         date = row.ReadUnspecifiedDateTime("transfer$tdate"),
         pickup = (row.IsNull("transfer$pickdate") || row.IsNull("transfer$picktime")) ? null : new System.DateTime?(row.ReadUnspecifiedDateTime("transfer$pickdate").Date.Add(row.ReadUnspecifiedDateTime("transfer$picktime").TimeOfDay)),
         flight = (!(row.ReadNullableInt("transfer$freight") > 0)) ? null : new DepartureFlight
         {
             id = row.ReadInt("transfer$freight"),
             name = row.ReadNullableTrimmedString(useNameField ? "f$name" : "f$lname"),
             source = (!(row.ReadNullableInt("f$srcport") > 0)) ? null : new Airport
             {
                 id = row.ReadInt("f$srcport"),
                 alias = row.ReadNullableTrimmedString("port1$alias"),
                 name = row.ReadNullableTrimmedString(useNameField ? "port1$name" : "port1$lname"),
                 town = (!(row.ReadNullableInt("st$inc") > 0)) ? null : new Town
                 {
                     id = row.ReadInt("st$inc"),
                     name = row.ReadNullableTrimmedString("st$name")
                 }
             },
             target = (!(row.ReadNullableInt("f$trgport") > 0)) ? null : new Airport
             {
                 id = row.ReadInt("f$trgport"),
                 alias = row.ReadNullableTrimmedString("port2$alias"),
                 name = row.ReadNullableTrimmedString(useNameField ? "port2$name" : "port2$lname"),
                 town = (!(row.ReadNullableInt("tt$inc") > 0)) ? null : new Town
                 {
                     id = row.ReadInt("tt$inc"),
                     name = row.ReadNullableTrimmedString(useNameField ? "tt$name" : "tt$lname")
                 }
             },
             takeoff = (row.IsNull("transfer$fdate") || row.IsNull("f$srctime")) ? null : new System.DateTime?(row.ReadUnspecifiedDateTime("transfer$fdate").Date.Add(row.ReadUnspecifiedDateTime("f$srctime").TimeOfDay)),
             landingtime = row.IsNull("f$trgtime") ? null : new System.TimeSpan?(row.ReadUnspecifiedDateTime("f$trgtime").TimeOfDay)
         },
         hotel = (!(row.ReadNullableInt("transfer$hoteldest") > 0)) ? null : new DepartureDestinationHotel
         {
             id = row.ReadInt("transfer$hoteldest"),
             name = row.ReadNullableTrimmedString(useNameField ? "h2$name" : "h2$lname"),
             town = (!(row.ReadNullableInt("t2$inc") > 0)) ? null : new Town
             {
                 id = row.ReadInt("t2$inc"),
                 name = row.ReadNullableTrimmedString(useNameField ? "t2$name" : "t2$lname")
             },
             region = (!(row.ReadNullableInt("r2$inc") > 0)) ? null : new Region
             {
                 id = row.ReadInt("r2$inc"),
                 name = row.ReadNullableTrimmedString(useNameField ? "r2$name" : "r2$lname")
             }
         },
         note = row.ReadNullableTrimmedString("transfer$infonote"),
         language = row.ReadNullableTrimmedString("language$alias"),
         indiviadual = row.ReadNullableTrimmedString("transfer$indmark") == "IND",
         servicename = row.ReadNullableTrimmedString(useNameField ? "s$name" : "s$lname"),
         guide = (!(row.ReadNullableInt("transfer$guide") > 0)) ? null : new DepartureWorker
         {
             name = row.ReadNullableTrimmedString(useNameField ? "guide$name" : "guide$lname"),
             phone = row.ReadNullableTrimmedString("guide$mobile")
         },
         guide2 = (!(row.ReadNullableInt("transfer$guide2") > 0)) ? null : new DepartureWorker
         {
             name = row.ReadNullableTrimmedString(useNameField ? "guide2$name" : "guide2$lname"),
             phone = row.ReadNullableTrimmedString("guide2$mobile")
         }
     };
 }
 internal DepartureHotel DepartureHotel(bool useNameField, DataRow row)
 {
     return new DepartureHotel
     {
         id = row.ReadInt("transfer$hoteldep"),
         name = row.ReadNullableTrimmedString(useNameField ? "h1$name" : "h1$lname")
     };
 }
 internal ExcursionRankInfo ExcursionRankInfo(DataRow row)
 {
     return new ExcursionRankInfo
     {
         Excursion = row.ReadInt("excursion"),
         AverageRank = row.ReadNullableDecimal("averagerank"),
         SurveyCount = row.ReadInt("surveycount", 0)
     };
 }
 public CheckPromoCodeResult CheckPromoCodeResult(DataRow row)
 {
     return new CheckPromoCodeResult
     {
         errorcode = row.ReadInt("result"),
         errormessage = row.ReadNullableTrimmedString("message")
     };
 }
 internal InvitationInfo InvitationInfo(DataRow row)
 {
     return new InvitationInfo
     {
         Id = row.ReadInt("invitation"),
         ObjectType = row.ReadNullableTrimmedString("objecttype"),
         ObjectId = row.ReadInt("objectid"),
         ObjectName = row.ReadNullableTrimmedString("objectname"),
         Language = row.ReadNullableTrimmedString("lang"),
         Data = row.ReadNullableTrimmedString("data"),
         CreateDate = row.ReadDateTime("createdate"),
         AccessCode = row.ReadNullableTrimmedString("accesscode"),
         AccessCodeExpired = row.ReadNullableDateTime("accesscodeexpdate"),
         CompleteDate = row.ReadNullableDateTime("completedate"),
         Verified = row.ReadBoolean("verified"),
         ShareCode = row.ReadNullableTrimmedString("sharecode"),
         IsSurveyed = row.ReadBoolean("is_surveyed"),
         IsExpired = row.ReadBoolean("is_expired"),
         CanSurvey = row.ReadBoolean("can_survey"),
         IsShared = row.ReadBoolean("is_shared"),
         CanShare = row.ReadBoolean("can_share")
     };
 }
 public ExcursionOrderCalculatePrice ExcursionOrderCalculatePrice(DataRow row)
 {
     return new ExcursionOrderCalculatePrice
     {
         id = row.ReadInt("excursion$inc"),
         name = row.ReadNullableTrimmedString("excursion$name"),
         date = row.ReadUnspecifiedDateTime("date"),
         time = row.IsNull("time$inc") ? null : new ExcursionTime
         {
             id = row.ReadInt("time$inc"),
             name = row.ReadNullableTrimmedString("time$name")
         },
         language = row.IsNull("lang$inc") ? null : new Language
         {
             id = row.ReadInt("lang$inc"),
             name = row.ReadNullableTrimmedString("lang$name"),
             alias = row.ReadNullableTrimmedString("lang$alias")
         },
         group = row.IsNull("group$inc") ? null : new ExcursionGroup
         {
             id = row.ReadInt("group$inc"),
             name = row.ReadNullableTrimmedString("group$name")
         },
         departure = row.IsNull("departure$inc") ? null : new GeoArea
         {
             id = row.ReadInt("departure$inc"),
             name = row.ReadNullableTrimmedString("departure$name"),
             alias = row.ReadNullableTrimmedString("departure$alias")
         },
         pax = new BookingPax
         {
             adult = row.ReadInt("adult", 0),
             child = row.ReadInt("child", 0),
             infant = row.ReadInt("infant", 0)
         },
         contact = new ExcursionContact
         {
             name = row.ReadNullableTrimmedString("contact$name")
         },
         note = row.ReadNullableTrimmedString("note"),
         price = row.IsNull("price") ? null : new OrderPrice
         {
             price = row.ReadDecimal("price"),
             currency = row.ReadNullableTrimmedString("currency$alias")
         },
         closesaletime = row.ReadNullableUnspecifiedDateTime("closesaletime"),
         issaleclosed = row.ReadBoolean("isclosed"),
         isstopsale = row.ReadBoolean("isstopsale")
     };
 }
 internal QuestionnaireIssue QuestionnaireIssue(DataRow row)
 {
     return new QuestionnaireIssue
     {
         Id = row.ReadInt("issue"),
         Text = row.ReadNullableTrimmedString("issue_text")
     };
 }
 public ExternalCartAddOrderResult ExternalCartAddOrderResult(DataRow row)
 {
     return new ExternalCartAddOrderResult
     {
         errorcode = row.ReadInt("error_code"),
         errormessage = row.ReadNullableTrimmedString("error_msg"),
         ordercount = row.ReadNullableInt("ordercount")
     };
 }
 internal SurveyNote SurveyNote(DataRow row)
 {
     return new SurveyNote
     {
         Invitation = row.ReadInt("invitation"),
         CompleteDate = row.ReadDateTime("completedate"),
         Language = row.ReadNullableTrimmedString("lang"),
         ParticipantPrefix = row.ReadNullableTrimmedString("prefix"),
         ParticipantName = row.ReadNullableTrimmedString("name"),
         Notes = new System.Collections.Generic.List<SurveyNoteItem>()
     };
 }
 public void FillFreightInfo(FreightReservationOrder freight, DataRow row)
 {
     if (row != null)
     {
         System.TimeSpan? freightDepartureTime = row.ReadNullableUnspecifiedTime("stime");
         FreightPoint freightPoint = new FreightPoint();
         FreightPoint arg_5C_0 = freightPoint;
         System.DateTime dateTime = row.ReadUnspecifiedDateTime("sdate");
         dateTime = dateTime.Date;
         arg_5C_0.date = dateTime.Add(freightDepartureTime ?? System.TimeSpan.FromTicks(0L));
         freightPoint.port = new Airport
         {
             id = row.ReadInt("sport$inc"),
             alias = row.ReadNullableTrimmedString("sport$alias"),
             name = row.ReadNullableTrimmedString("sport$name"),
             town = new Town
             {
                 id = row.ReadInt("stown$inc"),
                 name = row.ReadNullableString("stown$name")
             }
         };
         freight.departure = freightPoint;
         System.TimeSpan? freightArrivalTime = row.ReadNullableUnspecifiedTime("dtime");
         FreightPoint freightPoint2 = new FreightPoint();
         FreightPoint arg_147_0 = freightPoint2;
         dateTime = freight.departure.date;
         dateTime = dateTime.Date;
         dateTime = dateTime.AddDays((double)row.ReadInt("daysinway"));
         arg_147_0.date = dateTime.Add(freightArrivalTime ?? System.TimeSpan.FromTicks(0L));
         freightPoint2.port = new Airport
         {
             id = row.ReadInt("dport$inc"),
             alias = row.ReadNullableTrimmedString("dport$alias"),
             name = row.ReadNullableTrimmedString("dport$name"),
             town = new Town
             {
                 id = row.ReadInt("dtown$inc"),
                 name = row.ReadNullableString("dtown$name")
             }
         };
         freight.arrival = freightPoint2;
     }
 }
 internal GuestService.Data.WebPartner WebPartner(DataRow row)
 {
     return new GuestService.Data.WebPartner { id = row.ReadInt("partner"), passId = row.ReadInt("partpass") };
 }
 internal GuestService.Data.GeoCatalogObject GeoCatalogObject(DataRow row)
 {
     return new GuestService.Data.GeoCatalogObject { id = row.ReadInt("point$inc"), name = row.ReadNullableTrimmedString("point$name"), geotype = row.ReadNullableTrimmedString("pointtype$name") };
 }