public ActionResult FindOrderPost(string id, [Bind(Prefix = "Form")] FindOrderModel form)
        {
            FindOrderContext context = new FindOrderContext();

            context.Form = form;
            if (form.RequestType != "claim")
            {
                this.ClearErrorState(base.ModelState["Form.Claim"]);
                this.ClearErrorState(base.ModelState["Form.ClaimName"]);
            }
            if (form.RequestType != "passport")
            {
                this.ClearErrorState(base.ModelState["Form.Passport"]);
                this.ClearErrorState(base.ModelState["Form.PassportName"]);
            }
            if (base.ModelState.IsValid)
            {
                int guestId = WebSecurity.CurrentUserId;
                if (form.RequestType == "claim")
                {
                    context.Claims = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, guestId, form.ClaimName, new int?(System.Convert.ToInt32(form.Claim)), null);
                }
                else
                {
                    if (!(form.RequestType == "passport"))
                    {
                        throw new System.Exception("invalid RequestType");
                    }
                    context.Claims = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, guestId, form.PassportName, null, form.Passport);
                }
                context.NotFound = (context.Claims.Count == 0);
            }
            return(base.View(context));
        }
        public ActionResult Summary([Bind(Prefix = "OrderFindForm")] OrderModel model)
        {
            SummaryContext context = new SummaryContext {
                ShowOrderFindForm = true
            };

            if (base.ModelState.IsValid)
            {
                DateTime?         currentDate = model.CurrentDate;
                DateTime          dateFrom    = currentDate.HasValue ? currentDate.GetValueOrDefault() : DateTime.Now.Date;
                List <GuestClaim> claims      = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, 0, model.ClaimName, new int?(Convert.ToInt32(model.Claim)), null);
                if ((claims != null) && (claims.Count > 0))
                {
                    int?nullable2;
                    ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claims[0].claim);
                    if ((reservationState != null) && (nullable2 = reservationState.claimId).HasValue)
                    {
                        context.Claim             = reservationState;
                        context.ShowOrderFindForm = false;
                        context.Hotels            = new List <DepartureHotel>();
                        foreach (GuestClaim claim in claims)
                        {
                            nullable2 = null;
                            context.Hotels.AddRange(GuestProvider.GetDepartureInfo(UrlLanguage.CurrentLanguage, dateFrom, dateFrom.AddDays(1.0), nullable2, new int?(claim.claim)));
                        }
                        context.GuideDurties = new List <HotelGuideResult>();
                        List <GuestOrder> list2 = GuestProvider.GetActiveHotelOrders(claims, dateFrom, dateFrom.AddDays(1.0));
                        if ((list2 != null) && (list2.Count > 0))
                        {
                            GuideController controller = new GuideController();
                            foreach (GuestOrder order in list2)
                            {
                                HotelGuideParam param = new HotelGuideParam {
                                    h  = order.hotelid,
                                    ln = UrlLanguage.CurrentLanguage,
                                    pb = new DateTime?(order.period.begin.Value),
                                    pe = new DateTime?(order.period.end.Value)
                                };
                                HotelGuideResult item = controller.HotelGuide(param);
                                context.GuideDurties.Add(item);
                            }
                        }
                    }
                }
            }
            context.OrderFindNotFound = context.Claim == null;
            return(base.View(context));
        }
        public ActionResult PrintOrderPost([Bind(Prefix = "Form")] PrintOrderModel model)
        {
            PrintOrderContext context = new PrintOrderContext {
                Form = model
            };
            int result = 0;

            if (base.ModelState.IsValid && int.TryParse(model.Claim, out result))
            {
                List <GuestClaim> list = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, 0, model.Name, new int?(result), null);
                if ((list != null) && (list.Count > 0))
                {
                    return(this.BuildVoucher(result));
                }
                context.NotFound = true;
            }
            return(base.View(context));
        }
        public ActionResult Order([Bind(Prefix = "OrderFindForm")] OrderModel model)
        {
            OrderContext context = new OrderContext {
                ShowOrderFindForm = true
            };

            if (base.ModelState.IsValid)
            {
                List <GuestClaim> list = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, 0, model.ClaimName, new int?(Convert.ToInt32(model.Claim)), null);
                if ((list != null) && (list.Count > 0))
                {
                    ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, list[0].claim);
                    if ((reservationState != null) && reservationState.claimId.HasValue)
                    {
                        context.Claim = reservationState;
                        context.ExcursionTransfers = GuestProvider.GetExcursionTransferByClaim(UrlLanguage.CurrentLanguage, reservationState.claimId.Value);
                        context.ShowOrderFindForm  = false;
                    }
                }
            }
            context.OrderFindNotFound = context.Claim == null;
            return(base.View(context));
        }