예제 #1
0
        /// <summary>
        /// Updates the payment details.
        /// </summary>
        /// <param name="pricePlanDetails">The price plan details.</param>
        /// <param name="validationGroup">The validation group.</param>
        public void UpdatePaymentDetails(PricePlanDetails pricePlanDetails, string validationGroup)
        {
            chkAcceptTerms.Checked = false;
            this.PricePlanDetails  = pricePlanDetails;
            int paymentmethodCodeId  = 0;
            var globalizationSection = WebConfigurationManager.GetSection("system.web/globalization") as GlobalizationSection;

            if (Mode == DisplayMode.CreditCard)
            {
                paymentmethodCodeId      = CreditCardPaymentCode.CodeId;
                lblAcceptPricing.Visible = false;
                chkAcceptPricing.Visible = true;
                chkAcceptPricing.Checked = false;
            }
            else if (Mode == DisplayMode.Invoice)
            {
                paymentmethodCodeId      = InvoicePaymentCode.CodeId;
                lblAcceptPricing.Visible = true;
                chkAcceptPricing.Visible = false;
            }
            string paymentTermsandCondition = this.GetBL <FinanceBL>().GetPaymentFinalAgreementText(PricePlanDetails, paymentmethodCodeId, globalizationSection.Culture);

            chkAcceptPricing.Text = lblAcceptPricing.Text = paymentTermsandCondition;
            upnlPaymentDetails.Update();
        }
예제 #2
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="pricePlanDetails">The price plan details.</param>
        /// <param name="validationGroup">The validation group.</param>
        public void InitializeControl(PricePlanDetails pricePlanDetails, string validationGroup)
        {
            if (!PageBase.StopProcessing)
            {
                this.CompanyId        = pricePlanDetails.CompanyId;
                this.PricePlanDetails = pricePlanDetails;
                Mode = DisplayMode.CreditCard;

                LoadPaymentDetails();
                InitializeUI(validationGroup);
            }
        }
예제 #3
0
        /// <summary>
        /// Handles the Click event of the FinishButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void FinishButton_Click(object sender, EventArgs e)
        {
            PricePlanDetails pricePlanDetails = new PricePlanDetails
            {
                CompanyId                         = 0,
                DiscountCodeUsage                 = paymentPackageSummary.GetDiscountCodeUsage(),
                InventoryPaymentPackageTypeId     = paymentPackageSelector.InventoryPaymentPackageTypeId,
                ProjectPaymentPackageTypeId       = paymentPackageSelector.ProjectPaymentPackageTypeId,
                PaymentDurationCodeId             = paymentPackageSelector.PaymentDurationTypeCodeId,
                TotalAmount                       = paymentPackageSummary.TotalAmount,
                TotalAmountForPeriod              = paymentPackageSummary.TotalAmountForPeriod,
                TotalAmountWithEducationalPackage = paymentPackageSummary.TotalAmountWithEducationalPackage,
                DiscountCode                      = paymentPackageSummary.GetDiscountCode(),
                IsEducationalPackage              = paymentPackageSummary.HasEducationalPackage()
            };

            paymentPackageSummary.UpdatePaymentSummary();//We need to call this. If not Summary panel does not load properly on postbacks
            paymentValidation.ValidatePackageConfigurations(pricePlanDetails);
        }
예제 #4
0
        /// <summary>
        /// Handles the Click event of the btnNext control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnNext_Click(object sender, EventArgs e)
        {
            PricePlanDetails pricePlanDetails = new PricePlanDetails
            {
                CompanyId                         = this.CompanyId,
                DiscountCodeUsage                 = paymentPackageSummary.DiscountCodeUsage,
                DiscountCode                      = paymentPackageSummary.DiscountCodeUsage != null ? paymentPackageSummary.DiscountCodeUsage.DiscountCode : null,
                InventoryPaymentPackageTypeId     = paymentPackageSelector.InventoryPaymentPackageTypeId,
                ProjectPaymentPackageTypeId       = paymentPackageSelector.ProjectPaymentPackageTypeId,
                PaymentDurationCodeId             = paymentPackageSelector.PaymentDurationTypeCodeId,
                TotalAmount                       = paymentPackageSummary.TotalAmount,
                TotalAmountForPeriod              = paymentPackageSummary.TotalAmountForPeriod,
                TotalAmountWithEducationalPackage = paymentPackageSummary.TotalAmountWithEducationalPackage,
                IsEducationalPackage              = paymentPackageSummary.HasEducationalPackage()
            };

            paymentValidation.ResetPopupSelections();
            paymentValidation.ValidatePackageConfigurations(pricePlanDetails);
        }
예제 #5
0
        /// <summary>
        /// Validates the package configurations.
        /// </summary>
        /// <param name="pricePlanDetails">The price plan details.</param>
        public void ValidatePackageConfigurations(PricePlanDetails pricePlanDetails)
        {
            PricePlanDetails = pricePlanDetails;

            if (!IsCompanyValidToSave())
            {
                return;
            }

            if (PricePlanDetails.ProjectPaymentPackageTypeId > 0 && PricePlanDetails.InventoryPaymentPackageTypeId > 0 && PricePlanDetails.PaymentDurationCodeId > 0)
            {
                ProjectPaymentPackageDetails   projectPackageDetails          = Utils.GetSystemProjectPackageDetailByPaymentPackageTypeId(PricePlanDetails.ProjectPaymentPackageTypeId);
                InventoryPaymentPackageDetails inventoryPaymentPackageDetails = Utils.GetSystemInventoryPackageDetailByPaymentPackageTypeId(PricePlanDetails.InventoryPaymentPackageTypeId);
                //Get the current usage of the company. If exceeds the package show the error message
                string errorOnUsage = this.GetBL <FinanceBL>().GettheValidityOfSelectedPlan(CompanyId, pricePlanDetails, projectPackageDetails, inventoryPaymentPackageDetails);

                this.DisplayMode = ViewMode.PricingPlanPage; //concurrent discount chaged popups come on top of pricing plan page. view mode set accordingly.
                if (errorOnUsage.Length > 0)
                {
                    //Show the error message.
                    litError.Text = errorOnUsage;
                    popupError.ShowPopup();
                }
                else
                {
                    //Assign the InMemory Company object
                    if (CompanyId == 0)
                    {
                        paymentDetails.NewCompany = NewCompany;
                        paymentDetails.Media      = Media;
                    }

                    CompanyPaymentPackage oldCompanyPaymentPackage = this.GetBL <FinanceBL>().GetCurrentPaymentPackageFortheCompanyIncludingFreeTrial(CompanyId);

                    DateTime packageStartDate = Utils.Today;//For Normal company, the package start date should be Today.
                    //Find the package start date
                    if (this.GetBL <CompanyBL>().IsFreeTrialCompany(CompanyId))
                    {
                        //For Free Trial Companies, Start Date should be FT end Date + 1
                        packageStartDate = this.GetBL <CompanyBL>().GetFreeTrialProjectEndDate(CompanyId).AddDays(1);
                    }
                    else
                    {
                        if (oldCompanyPaymentPackage != null)
                        {
                            if (oldCompanyPaymentPackage.PaymentDurationCodeId == Utils.GetCodeIdByCodeValue("PaymentPackageDuration", "ANUAL"))
                            {
                                if (oldCompanyPaymentPackage.ProjectPaymentPackageTypeId != PricePlanDetails.ProjectPaymentPackageTypeId || oldCompanyPaymentPackage.InventoryPaymentPackageTypeId != PricePlanDetails.InventoryPaymentPackageTypeId)
                                {
                                    packageStartDate = Utils.Today;
                                }
                                else
                                {
                                    if (oldCompanyPaymentPackage.EndDate != null)
                                    {
                                        packageStartDate = oldCompanyPaymentPackage.EndDate.Value.AddDays(1);
                                    }
                                    else
                                    {
                                        packageStartDate = oldCompanyPaymentPackage.StartDate.AddYears(1).AddDays(1);
                                    }
                                }
                            }
                            else if (oldCompanyPaymentPackage.EndDate != null)
                            {
                                packageStartDate = oldCompanyPaymentPackage.EndDate.Value;
                            }
                        }
                    }
                    PricePlanDetails.PackageStartDate = packageStartDate;

                    OriginalLastUpdatedDate = oldCompanyPaymentPackage != null ? oldCompanyPaymentPackage.LastUpdateDate : null;

                    // No projects selected during free trial period
                    if (!HasRespondedToFreeTrailNoProjectsPopup && this.CompanyId > 0 && projectPackageDetails.Amount == 0 && GetBL <CompanyBL>().IsFreeTrialCompany(this.CompanyId))
                    {
                        ShowPopupForNoProjectsPackageSelectionDuringFreeTrail();
                    }
                    // free inventory scenario
                    else if ((projectPackageDetails.Amount + inventoryPaymentPackageDetails.Amount) == 0)
                    {
                        ShowFreeInventoryOnlyPopUp(inventoryPaymentPackageDetails.ItemCount.Value);
                    }
                    else if (HandleConcurrentDiscountChanges())
                    {
                        this.PricePlanDetails.DiscountCodeUsage = this.DiscountCodeUsage;
                        this.PricePlanDetails.DiscountCode      = (this.DiscountCodeUsage != null ? this.DiscountCodeUsage.DiscountCode : null);
                    }
                    else if (!HasRespondedToNoPackageChangesPopup && !this.GetBL <FinanceBL>().IsCompanyPaymentPackageChanged(this.CompanyId, pricePlanDetails))
                    {
                        ShowPopupNoPackageChanges();
                    }
                    else if (!PricePlanDetails.IsEducationalPackage && (PricePlanDetails.DiscountCodeUsage != null &&
                                                                        PricePlanDetails.DiscountCodeUsage.DiscountCode.Discount == 100 && PricePlanDetails.TotalAmountForPeriod == 0))
                    {
                        ShowHundredPercentDiscountPopUp(PricePlanDetails.DiscountCodeUsage);
                    }
                    else
                    {
                        ShowAdddetailsPaymentpopUp();
                    }
                }
            }
        }