protected void Page_Load(object sender, EventArgs e)
 {
     if (EventId.HasValue)
     {
         OrderSummaryControl.EventId             = EventId.Value;
         OrderSummaryControl.RoleId              = (long)Roles.Technician;
         OrderSummaryControl.PackageId           = PackageId.HasValue ? PackageId.Value : 0;
         OrderSummaryControl.TestIds             = TestIds;
         OrderSummaryControl.IsSourceCodeApplied = SourceCodeId > 0;
         OrderSummaryControl.SourceCodeAmount    = SourceCodeAmount;
         if (!AppointmentSlotIds.IsNullOrEmpty())
         {
             var slotService = IoC.Resolve <IEventSchedulingSlotService>();
             var slot        = slotService.GetHeadSlotintheChain(AppointmentSlotIds);
             OrderSummaryControl.AppointmentTime = slot.StartTime.ToString("hh:mm tt");
         }
         if (ProductId.HasValue && ProductId.Value > 0)
         {
             IUniqueItemRepository <ElectronicProduct> itemRepository = new ElectronicProductRepository();
             var product = itemRepository.GetById(ProductId.Value);
             OrderSummaryControl.ProductName  = product.Name;
             OrderSummaryControl.ProductPrice = product.Price;
         }
         if (ShippingDetail != null && ShippingDetail.ShippingOption != null && ShippingDetail.ShippingOption.Id > 0)
         {
             IUniqueItemRepository <ShippingOption> itemRepository = new ShippingOptionRepository();
             var shippingOption = itemRepository.GetById(ShippingDetail.ShippingOption.Id);
             OrderSummaryControl.ShippingOption      = shippingOption.Name;
             OrderSummaryControl.ShippingOptionPrice = ShippingDetail.ActualPrice;
         }
     }
     if (!IsPostBack)
     {
         if (EventId.HasValue)
         {
             hfEventID.Value = EventId.Value.ToString();
         }
         else
         {
             SetAndDisplayErrorMessage("OOPS! Some error occured while saving details.");
             return;
         }
         if (TotalAmount.HasValue)
         {
             hfNetPayableAmount.Value = TotalAmount.ToString();
         }
         else
         {
             SetAndDisplayErrorMessage("OOPS! Some error occured while saving details.");
             return;
         }
         EligibilityIdHiddenField.Value = EligibilityId.ToString();
         ChargeCardIdHiddenField.Value  = ChargeCardId.ToString();
         if (ChargeCardId > 0)
         {
             GetCreditCardDataByChargeCardId(ChargeCardId);
         }
         BindJavaScriptEvents();
     }
     else
     {
         if (PostBackAction())
         {
             EligibilityId = Convert.ToInt64(EligibilityIdHiddenField.Value);
             ChargeCardId  = Convert.ToInt64(ChargeCardIdHiddenField.Value);
             PersistPaymentData();
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Gets shipping option info.
 /// </summary>
 /// <param name="shippingOptionId">ID of shipping option which should be returned.</param>
 public ShippingOptionInfo GetShippingOption(int shippingOptionId)
 {
     return(mShippingOptionRepository.GetById(shippingOptionId));
 }
        private void GetEventDetail()
        {
            if (EventId > 0 && CustomerId > 0)
            {
                _spCustomerId.InnerText = customerLogEditModel.CustomerId = CustomerId.ToString();
                _spEventId.InnerText    = customerLogEditModel.EventId = EventId.ToString();

                var appointmentRepository = IoC.Resolve <IAppointmentRepository>();
                var appointment           = appointmentRepository.GetEventCustomerAppointment(EventId, CustomerId);

                if (appointment == null)
                {
                    return;
                }

                var customerRepository = IoC.Resolve <ICustomerRepository>();
                var customer           = customerRepository.GetCustomer(CustomerId);

                var eventService = IoC.Resolve <IEventService>();
                var eventHost    = eventService.GetById(EventId);

                var strCustomerName = customerLogEditModel.Name = customer.NameAsString;

                _spAcesId.InnerText = string.IsNullOrWhiteSpace(customer.AcesId) ? "N/A" : customer.AcesId;

                _strEventDate = eventHost.EventDate.ToLongDateString();
                var strHostAddress = new Address(eventHost.StreetAddressLine1, eventHost.StreetAddressLine2,
                                                 eventHost.City, eventHost.State, eventHost.Zip, "");
                customerLogEditModel.EventVenue = _strEventVenue = eventHost.Name + "  " + strHostAddress;

                _spFullName.InnerText          = strCustomerName;
                customerLogEditModel.EventDate = _strEventDate + " at " + appointment.StartTime.ToShortTimeString();
                _spWhen.InnerText  = HttpUtility.HtmlEncode(customerLogEditModel.EventDate);
                _spVenue.InnerText = _strEventVenue;

                var orderDetail = GetCurrentOrder(CustomerId, EventId);
                //decimal shippingPrice = orderDetail.ShippingDetailOrderDetails.Sum(shippingDetailOrderDetail => shippingDetailOrderDetail.Amount);

                decimal totalAmount = _order.DiscountedTotal;

                IEventCustomerPackageTestDetailService eventCustomerPackageTestDetailService = new EventCustomerPackageTestDetailService();
                var eventCustomerPackageTestDetailViewData =
                    eventCustomerPackageTestDetailService.GetEventPackageDetails(EventId, CustomerId);
                if (eventCustomerPackageTestDetailViewData.Package != null)
                {
                    _spPackageName.InnerText = customerLogEditModel.PackageName = eventCustomerPackageTestDetailViewData.Package.Name;

                    var packageTest = string.Empty; var packageTestAudit = string.Empty;
                    foreach (var test in eventCustomerPackageTestDetailViewData.Package.Tests)
                    {
                        packageTest      += "<li style=\"margin: 0px 10px; padding: 0px 0px; list-style: disc;\">" + test.Name + "</li>";
                        packageTestAudit += test.Name + ", ";
                    }
                    _spTestNames.InnerHtml           = packageTest;
                    customerLogEditModel.PackageTest = packageTestAudit.Length > 2 ? packageTestAudit.Substring(0, packageTestAudit.Length - 2) : "";;
                }
                else
                {
                    _dvPackageMain.Visible      = false;
                    _dvAdditionalTest.InnerHtml = "Test(s):";
                }

                var additionalTest = string.Empty; var additionalTestAudit = string.Empty;
                foreach (var test in eventCustomerPackageTestDetailViewData.Tests)
                {
                    additionalTest      += "<li style=\"margin: 0px 10px; padding: 0px 0px; list-style: disc;\">" + test.Name + "</li>";
                    additionalTestAudit += test.Name + ", ";
                }

                _spAdditionalTestNames.InnerHtml         = additionalTest;
                customerLogEditModel.AdditionalTestAudit = additionalTestAudit.Length > 2 ? additionalTestAudit.Substring(0, additionalTestAudit.Length - 2) : "";
                if (eventCustomerPackageTestDetailViewData.Tests.Count < 1)
                {
                    _dvAdditionalTestMain.Visible = false;
                }

                _spPrice.InnerHtml = customerLogEditModel.OrderValue = totalAmount.ToString("C2");

                //_spPaymentStatus.InnerHtml = (_order.TotalAmountPaid - _order.DiscountedTotal) >= 0 ? "<i>The payment captured sucessfully.</i>" : "<i>Not Paid</i>";

                if (_order.DiscountedTotal > 0)
                {
                    customerLogEditModel.PaymentStatus = _spPaymentStatus.InnerHtml = _order.TotalAmountPaid > 0
                                                      ? "<i>The payment captured sucessfully.</i>"
                                                      : "<i>Not Paid</i>";
                }
                else
                {
                    customerLogEditModel.PaymentStatus = _spPaymentStatus.InnerHtml = "<i>Not charged.</i>";
                }

                customerLogEditModel.PaymentStatus = ((string)customerLogEditModel.PaymentStatus).Replace("<i>", "").Replace("</i>", "");

                if (eventCustomerPackageTestDetailViewData.ElectronicProduct != null)
                {
                    ProductDiv.Visible    = true;
                    ProductSpan.InnerHtml = eventCustomerPackageTestDetailViewData.ElectronicProduct.Name + "<a  class='jtip'  title='Description|" + eventCustomerPackageTestDetailViewData.ElectronicProduct.ShortDescription + "'> <span class='smalltxtblu'>[More Info]</span></a>";
                    customerLogEditModel.ElectronicProduct = eventCustomerPackageTestDetailViewData.ElectronicProduct.Name;
                }
                else
                {
                    ProductDiv.Visible = false;
                }

                //TODO:For Spike release it is kept here. it should be in db and need to have one more field in DB to identify Digital delivery shipping option
                var shippingOption = new ShippingOption {
                    Id = 0, Name = "Unlimited Online Results (Free)", Price = 0.00m, Description = IoC.Resolve <ISettings>().CompanyName + "  securely stores your screening results, including all medical device output and ultrasound images, online permanently and provides unlimited access, printing & emailing 24-hours a day, free of charge!  Online results typically available in less than 2 business days however, guaranteed in 4 business days.", Disclaimer = ""
                };

                long shippingDetailId = 0;
                if (orderDetail != null && orderDetail.ShippingDetailOrderDetails != null && orderDetail.ShippingDetailOrderDetails.Count() > 0)
                {
                    shippingDetailId = orderDetail.ShippingDetailOrderDetails.Where(sdod => sdod.IsActive).Select(sdod => sdod.ShippingDetailId).FirstOrDefault();
                }

                if (shippingDetailId > 0)
                {
                    var shippingRepository = IoC.Resolve <IShippingDetailRepository>();
                    var shippingDetail     = shippingRepository.GetById(shippingDetailId);

                    IShippingOptionRepository shippingOptionRepository = new ShippingOptionRepository();
                    shippingOption = shippingOptionRepository.GetById(shippingDetail.ShippingOption.Id);
                }

                _spShippingOption.InnerHtml = shippingOption.Name + "<a  class='jtip'  title='Description/Disclaimer!|" + shippingOption.Description + "|<br /><strong>" + shippingOption.Disclaimer + "</strong><br /> '> <span class='smalltxtblu'>[More Info]</span></a>";

                if (IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.CheckRole((long)Roles.CallCenterRep))
                {
                    GetCcRepInstruction(EventId);
                }
                else
                {
                    _spCCRepNotes.Visible = false;
                }

                var corporateAccountRepository = IoC.Resolve <ICorporateAccountRepository>();
                var account = corporateAccountRepository.GetbyEventId(EventId);

                _spUserName.InnerText = customerLogEditModel.UserName = customer.UserLogin.UserName;
                //_spPassword.InnerHtml = customer.UserLogin.Password;
                hfUserID.Value = customer.UserLogin.Id.ToString();

                SetPcpInfo(CustomerId);

                SetHafInfo(account);
                SetHraInfo(EventId, CustomerId, eventHost.EventDate, account);
                HideUserLoginDetails(account);
            }
        }