Exemple #1
0
        protected virtual void SetupQuoteOptionCollection()
        {
            const string          quoteOption01Code        = "01";
            const string          quoteOption01Name        = "Option 01";
            const string          quoteOption01Description = "Option Description 01";
            const LicenseTypeEnum quoteOption01LicenseType = LicenseTypeEnum.Option;
            const int             quoteOption01Quantity    = 10;
            const double          quoteOption01Rate        = 2.5;
            const PriceTypeEnum   quoteOption01PriceType   = PriceTypeEnum.Recurring;
            const FrequencyEnum   quoteOption01Frequency   = FrequencyEnum.Monthly;
            const string          quoteOption02Code        = "02";
            const string          quoteOption02Name        = "Option 02";
            const string          quoteOption02Description = "Option Description 02";
            const LicenseTypeEnum quoteOption02LicenseType = LicenseTypeEnum.AnnualTechAccess;
            const int             quoteOption02Quantity    = 20;
            const double          quoteOption02Rate        = 4.5;
            const PriceTypeEnum   quoteOption02PriceType   = PriceTypeEnum.OneTime;
            const FrequencyEnum   quoteOption02Frequency   = FrequencyEnum.Annual;

            _quoteOption01 = new QuoteOption(
                quoteOption01Code,
                quoteOption01Name,
                quoteOption01Description,
                quoteOption01LicenseType,
                quoteOption01Quantity,
                quoteOption01Rate,
                quoteOption01PriceType,
                quoteOption01Frequency);

            _quoteOption02 = new QuoteOption(
                quoteOption02Code,
                quoteOption02Name,
                quoteOption02Description,
                quoteOption02LicenseType,
                quoteOption02Quantity,
                quoteOption02Rate,
                quoteOption02PriceType,
                quoteOption02Frequency);

            _quoteOptionCollection = new QuoteOptionCollection();
            _quoteOptionCollection.Add(_quoteOption01);
            _quoteOptionCollection.Add(_quoteOption02);
        }
        public ActionResult Options(QuoteOptionsModel model)
        {
            using (var qm = new QuoteManager())
            {
                foreach (var psm in model.ProductLineSelectionModels)
                {
                    if (psm.IsSelected)
                    {
                        // add it to the quote options database
                        var option = new QuoteOption
                        {
                            QuoteID         = model.QuoteID,
                            ContentCategory = QuoteOptionCategory.ProductLineMapping,
                            ForeignKey      = psm.ProductLineID,
                            TableName       = TableName.ProductLine
                        };
                        option = qm.CreateOption(option);
                    }
                }

                foreach (var msm in model.ManufacturerSelectionModels)
                {
                    if (msm.IsSelected)
                    {
                        // add it to the quote options database
                        var option = new QuoteOption
                        {
                            QuoteID         = model.QuoteID,
                            ContentCategory = QuoteOptionCategory.ManufacturerDefault,
                            ForeignKey      = msm.ManufacturerID,
                            TableName       = TableName.Manufacturer
                        };
                        option = qm.CreateOption(option);
                    }
                }
            }
            return(RedirectToAction("Edit", new { id = model.QuoteID }));
        }
Exemple #3
0
 public QuoteOption CreateOption(QuoteOption option)
 {
     db.QuoteOptions.InsertOnSubmit(option);
     db.SubmitChanges();
     return option;
 }