Ejemplo n.º 1
0
        public static ExternalCartAddOrderResult ExternalCart_AddOrder(string language, WebPartner partner, string externalCartId, BookingOrder order)
        {
            if (partner == null)
            {
                throw new System.ArgumentNullException("partner");
            }
            if (order == null)
            {
                throw new System.ArgumentNullException("order");
            }
            BookingClaim claim = new BookingClaim
            {
                orders = new System.Collections.Generic.List <BookingOrder>()
            };

            claim.orders.Add(order);
            XElement xml = BookingProvider.BuildBookingClaimXml(partner.id, claim);
            DataSet  ds  = DatabaseOperationProvider.QueryProcedure("up_guest_ExternalCart_AddOrder", "result", new
            {
                lang      = language,
                OrdersXML = xml,
                CartId    = externalCartId,
                PartPass  = partner.passId
            });

            return((
                       from DataRow row in ds.Tables["result"].Rows
                       select BookingProvider.factory.ExternalCartAddOrderResult(row)).FirstOrDefault <ExternalCartAddOrderResult>());
        }
Ejemplo n.º 2
0
        public static void AcceptInvoice(int claimId)
        {
            using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString))
            {
                using (SqlCommand command = connection.CreateCommand())
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "income.dbo.up_RegPaymentsFromBankInvoices";

                    using (OperationDurationLimit.ShortOperation(command))
                    {
                        connection.Open();
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                        }
                    }
                }
            }

            //отправка сообщений
            {
                var reservation = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claimId);


                Task[] tasks = new Task[]
                {
                    Task.Factory.StartNew(() => new SimpleEmailService().SendEmail <ReservationState>(reservation.customer.mail, "payment", reservation.customer.language, reservation)),
                    Task.Factory.StartNew(() => new SmsSender().SendMessage <ReservationState>(reservation.customer.phone, "payment", reservation.customer.language, reservation))
                };

                Task.WaitAll(tasks);
            }
        }
Ejemplo n.º 3
0
        public static ReservationState DoBooking(string language, int partnerId, int partnerPassId, BookingClaim claim)
        {
            if (claim == null)
            {
                throw new System.ArgumentNullException("claim");
            }
            XElement xml = BookingProvider.BuildBookingClaimXml(partnerId, claim);

            return(BookingProvider.BuildBookingProcessResult(language, "save", xml, new int?(partnerPassId)));
        }
Ejemplo n.º 4
0
        public static CheckPromoCodeResult CheckExcursionPromoCode(string language, int partnerId, BookingClaim claim, string promoCode)
        {
            if (claim == null)
            {
                throw new System.ArgumentNullException("claim");
            }
            if (string.IsNullOrEmpty(promoCode))
            {
                throw new System.ArgumentNullException("promoCode");
            }
            XElement xml = BookingProvider.BuildBookingClaimXml(partnerId, claim);
            DataSet  ds  = DatabaseOperationProvider.QueryProcedure("[promo].[up_CheckExPromoCodes]", "errors", new
            {
                OrdersXML = xml,
                lang      = language,
                PromoCode = promoCode
            });
            CheckPromoCodeResult result = (
                from DataRow row in ds.Tables["errors"].Rows
                select BookingProvider.factory.CheckPromoCodeResult(row)).FirstOrDefault <CheckPromoCodeResult>();

            result.code = promoCode;
            return(result);
        }
Ejemplo n.º 5
0
        public static ReservationState GetReservationState(string language, int claimId)
        {
            XElement xml = BookingProvider.BuildStatusClaimXml(claimId);

            return(BookingProvider.BuildBookingProcessResult(language, "status", xml, null));
        }