Пример #1
0
        private static void AddBookingProcessData(BookingProcess bp, DateTime?date)
        {
            DateTime date1 = bp.OfferInfo.CheckIn;

            if (date != null)
            {
                TimeSpan days        = date1.Subtract((DateTime)date);
                int      difference  = days.Days;
                DateTime bookingdate = (DateTime)date;

                if (difference > 60)
                {
                    List <PaymentTerm> list         = new List <PaymentTerm>();
                    PaymentTerm        paymentTerm1 = new PaymentTerm();
                    paymentTerm1.Date    = bookingdate.AddDays(7);
                    paymentTerm1.Percent = 30;
                    paymentTerm1.Eur     = bp.PriceValueByBooking * 30 / 100;

                    PaymentTerm paymentTerm2 = new PaymentTerm();
                    paymentTerm2.Date    = bp.OfferInfo.CheckIn.AddDays(-42);
                    paymentTerm2.Percent = 70;
                    paymentTerm2.Eur     = bp.PriceValueByBooking * 70 / 100;

                    list.Add(paymentTerm1);
                    list.Add(paymentTerm2);
                    bp.PaymentTerms = list;

                    List <TravelApplicantPayment> travelapplicantpayments = new List <TravelApplicantPayment>();
                    TravelApplicantPayment        payment1 = new TravelApplicantPayment();
                    payment1.Date  = bookingdate.AddDays(7);
                    payment1.Value = bp.PriceValueByBooking * 30 / 100;

                    TravelApplicantPayment payment2 = new TravelApplicantPayment();
                    payment2.Date  = bp.OfferInfo.CheckIn.AddDays(-42);
                    payment2.Value = bp.PriceValueByBooking * 70 / 100;

                    travelapplicantpayments.Add(payment1);
                    travelapplicantpayments.Add(payment2);
                    bp.Payments = travelapplicantpayments;
                }
            }
            List <ProviderPayment> providerpayments = new List <ProviderPayment>();
            ProviderPayment        Payment          = new ProviderPayment();

            Payment.Date  = bp.OfferInfo.CheckIn.AddDays(-30);
            Payment.Value = bp.PriceValueByBooking * 80 / 100;
            providerpayments.Add(Payment);

            bp.PaymentsForProvider = providerpayments;
        }
Пример #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var manager        = PlugInManager.GetBookingDataManager();
            var bookingprocess = new BookingProcess();

            bookingprocess.Id                  = Guid.NewGuid().ToString();
            bookingprocess.Status              = DocumentProcessStatus.Close;
            bookingprocess.OfferInfo.Country   = txtCountry.Text;
            bookingprocess.OfferInfo.PlaceName = txtPlace.Text;
            bookingprocess.OfferInfo.SiteCode  = comboboxSite.SelectedItem != null?comboboxSite.SelectedItem.Text:"";
            string sitecode = bookingprocess.OfferInfo.SiteCode;
            string sitename = controller.GetSiteName(sitecode);

            bookingprocess.OfferInfo.SiteName  = sitename;
            bookingprocess.OfferInfo.UnitCode  = comboboxUnit.SelectedItem != null ? comboboxUnit.SelectedItem.Text : "";
            bookingprocess.OfferInfo.OfferCode = comboboxOffer.SelectedItem != null ? comboboxOffer.SelectedItem.Text : "";
            string offercode = bookingprocess.OfferInfo.OfferCode;
            string offername = controller.GetOfferName(offercode);

            bookingprocess.OfferInfo.OfferName        = offername;
            bookingprocess.OfferInfo.TourOperatorCode = txtTourOperator.Text.Trim();
            bookingprocess.OfferInfo.CheckIn          = ASPxDateEditCheckIn.Date;
            bookingprocess.OfferInfo.CheckOut         = ASPxDateEditCheckOut.Date;
            bookingprocess.OfferInfo.Adults           = int.Parse(txtAdults.Text.Trim());
            bookingprocess.OfferInfo.Children         = int.Parse(txtChildren.Text.Trim());
            bookingprocess.TravelApplicant.FirstName  = customer.FirstName;
            bookingprocess.TravelApplicant.LastName   = customer.LastName;
            bookingprocess.TravelApplicant.Contry     = customer.Country;
            bookingprocess.TravelApplicant.Adress     = customer.Adress;
            bookingprocess.TravelApplicantId          = customer.CustomerNr;
            bookingprocess.SellingPartner             = int.Parse(txtPartnerId.Text.Trim());
            bookingprocess.Season = txtSeason.Text;
            bookingprocess.TravelApplicant.MobilePhone = customer.MobilePhone;
            bookingprocess.TravelApplicant.Phone       = customer.Phone;
            bookingprocess.TravelApplicant.ZipCode     = customer.ZipCode;
            bookingprocess.TravelApplicant.Place       = customer.Place;
            bookingprocess.TravelApplicant.Salutation  = customer.Salutation;
            bookingprocess.TravelApplicant.EMail       = customer.EMail;
            List <TravelApplicantPayment> payments         = bookingprocess.Payments;
            TravelApplicantPayment        applicantPayment = new TravelApplicantPayment();

            applicantPayment.Date  = ASPxDateEditPayment.Date;
            applicantPayment.Value = Decimal.Parse(txtPaymetnValue.Text.Trim());
            payments.Add(applicantPayment);
            bookingprocess.Payments      = payments;
            bookingprocess.BookingNumber = txtBookingNumber.Text;

            manager.AddMasterData(bookingprocess);
        }
Пример #3
0
        private static BookingProcess CreateBookingProcess(SyncBookingInquiry inquiry, Customer customer)
        {
            BookingProcess booking = new BookingProcess();

            booking.Id = inquiry.id;


            booking.OfferInfo.Adults   = inquiry.BookingData.Adults;
            booking.OfferInfo.Children = inquiry.BookingData.Children;
            booking.OfferInfo.CheckIn  = inquiry.BookingData.CheckIn;
            DateTime date = inquiry.BookingData.CheckIn;

            booking.OfferInfo.CheckOut         = inquiry.BookingData.CheckOut;
            booking.OfferInfo.OfferCode        = inquiry.BookingData.OfferCode;
            booking.OfferInfo.SiteCode         = inquiry.BookingData.SiteCode;
            booking.OfferInfo.TourOperatorCode = inquiry.TourOperatorCode;



            booking.TravelApplicant.Adress      = inquiry.BookingData.TravelApplicant.Adress;
            booking.TravelApplicant.Contry      = inquiry.BookingData.TravelApplicant.Contry;
            booking.TravelApplicant.EMail       = inquiry.BookingData.TravelApplicant.EMail;
            booking.TravelApplicant.FirstName   = inquiry.BookingData.TravelApplicant.FirstName;
            booking.TravelApplicant.LastName    = inquiry.BookingData.TravelApplicant.LastName;
            booking.TravelApplicant.MobilePhone = inquiry.BookingData.TravelApplicant.MobilePhone;
            booking.TravelApplicant.Phone       = inquiry.BookingData.TravelApplicant.Phone;
            booking.TravelApplicant.Place       = inquiry.BookingData.TravelApplicant.Place;
            booking.TravelApplicant.Salutation  = inquiry.BookingData.TravelApplicant.Salutation;
            booking.TravelApplicant.ZipCode     = inquiry.BookingData.TravelApplicant.ZipCode;



            List <TravelApplicantPayment> lis = new List <TravelApplicantPayment>();
            TravelApplicantPayment        p1  = new TravelApplicantPayment();

            p1.Date  = inquiry.BookingData.CheckIn;
            p1.Value = inquiry.BookingData.PriceValueByArrival;
            TravelApplicantPayment p2 = new TravelApplicantPayment();

            p2.Date  = inquiry.BookingData.CheckOut;
            p2.Value = inquiry.BookingData.PriceValueByBooking;
            lis.Add(p1);
            lis.Add(p2);
            //booking.Payments = lis;
            booking.Season            = date.Year.ToString();
            booking.Status            = DocumentProcessStatus.New;
            booking.TravelApplicantId = customer.CustomerNr;
            CreateBookingInquiry(inquiry);
            string             bookinginquirynumber = inquiry.BookingInquiryNummer;
            BookingInquiry     inquiryq             = manager.GetBookingInquiryByNumber(bookinginquirynumber);
            BookingProcessItem item = new BookingProcessItem();

            item.DocumentId        = inquiryq.Id;
            item.DocumentNr        = inquiryq.BookingInquiryNummer;
            item.DocumentStatus    = DocumentStatus.Active;
            item.DocumentTitel     = "AB" + "-" + inquiryq.BookingInquiryNummer;
            item.CreateDate        = DateTime.Now;
            item.BookingProcessTyp = BookingProcessItemTyp.BookingInquiry;
            item.Author            = "Igor Cuic";

            List <BookingProcessItem> bookinglist = new List <BookingProcessItem>();

            bookinglist.Add(item);

            booking.BookingProcessItemList = bookinglist;

            return(booking);
        }