public ServiceResponse AddSystemToQuote(SystemMatchupModel systemMatchupModel)
        {
            var serviceResponse = new ServiceResponse();

            QuoteModel quoteModel = new QuoteModel();

            var session = HttpContext.Current.Session;

            quoteModel.QuoteId = (long?)session["BasketQuoteId"];



            //Check if products exist
            foreach (string productNumber in systemMatchupModel.ProductNumbers)
            {
                if (productservices.ProductExist(this.CurrentUser, productNumber))
                {
                    systemMatchupModel.ValidProducts.Add(productNumber);
                }
                else
                {
                    systemMatchupModel.InValidProducts.Add(productNumber);
                    serviceResponse.AddError("Can not find product " + productNumber);
                }
            }

            //Add products to Quote
            if (serviceResponse.IsOK || systemMatchupModel.ContinueAdding)
            {
                var addProductSvcResp = new ServiceResponse();
                //add valid products
                if (systemMatchupModel.ValidProducts.Count > 0)
                {
                    foreach (string productNumber in systemMatchupModel.ValidProducts)
                    {
                        var productId = productservices.GetProductId(this.CurrentUser, productNumber);
                        if (productId != 0)
                        {
                            addProductSvcResp = new QuoteServices().AddProductToQuoteWithTag(this.CurrentUser, quoteModel, productId, systemMatchupModel.Quantity, systemMatchupModel.Tags);
                        }
                        if (!addProductSvcResp.IsOK)
                        {
                            return(addProductSvcResp);
                        }
                    }

                    return(addProductSvcResp);// Added products successfully
                }
                else
                {
                    addProductSvcResp.AddError("There's no valid products to Add.");
                    return(addProductSvcResp);// No valid products to Add
                }
            }
            else
            {
                serviceResponse.Model = systemMatchupModel;
                return(serviceResponse); // return with error ("There is invalid product ...")
            }
        }
示例#2
0
        public ProductServicesTest()
        {
            productService = new ProductServices(this.TContext);

            projectService  = new ProjectServices(this.TContext);
            businessService = new BusinessServices(this.TContext);
            quoteService    = new QuoteServices(this.TContext);

            user = GetUserSessionModel("*****@*****.**");

            _projectId = this.db.Context.Projects
                         .Where(p => p.OwnerId == user.UserId)
                         .OrderByDescending(p => p.ProjectId)
                         .Select(p => p.ProjectId)
                         .FirstOrDefault();

            projectModel = projectService.GetProjectModel(user, _projectId).Model as ProjectModel;

            _quoteId = this.db.Context.Quotes.Where(q => q.ProjectId == _projectId)
                       .OrderByDescending(q => q.QuoteId)
                       .Select(q => q.QuoteId)
                       .FirstOrDefault();

            _productNumber = this.db.Context.Products
                             .Select(pr => pr.ProductNumber)
                             .Where(pr => pr != null)
                             .FirstOrDefault();

            _quoteItemId = this.db.Context.QuoteItems
                           .Where(qi => qi.Quantity > 0)
                           .Select(qi => qi.QuoteItemId)
                           .FirstOrDefault();
        }
示例#3
0
 public OrderController()
 {
     _erpSvcProvider    = new ERPServiceProvider();
     _orderServiceLight = new OrderServiceLight();
     _orderServices     = new OrderServices();
     _quoteServices     = new QuoteServices();
 }
示例#4
0
        public QuoteModel GetActiveQuoteModel(UserSessionModel user, string projectName)
        {
            var activequote = db.Quotes.Where(q => q.Project.Name.Contains(projectName) && q.Project.ActiveVersion == q.Revision).FirstOrDefault();

            var response = new QuoteServices(this.TContext).GetQuoteModel(user, activequote);

            return(response.Model as QuoteModel);
        }
        public SubmittalPackageController()
        {
            projectService   = new ProjectServices();
            quoteService     = new QuoteServices();
            htmlService      = new HtmlServices();
            submittalService = new SubmittalPackageServices();

            //this.log = Log;
        }
示例#6
0
        public DaikinServices(DPOContext context)
            : base(context)
        {
            daikinSuperUser = new AccountServices().GetSuperUserSessionModel().Model as UserSessionModel;
            quoteServices   = new QuoteServices(this.Context);
            businessService = new BusinessServices(this.Context);

            client = new CrmServiceClient(Utilities.Config("dpo.webservices.endpoint"));
        }
示例#7
0
        public TestOrderController()
        {
            orderService      = new OrderServices(this.TContext);
            orderServiceLight = new OrderServiceLight();
            searchOrders      = new SearchOrders();

            accountService = new AccountServices();
            user           = accountService.GetUserSessionModel("*****@*****.**").Model as UserSessionModel;
            quoteService   = new QuoteServices();

            orderVMLight                             = new OrderViewModelLight();
            orderVMLight.BusinessId                  = 206680765352640513;
            orderVMLight.ShipToAddressId             = 479102086194151432;
            orderVMLight.PricingTypeId               = 1;
            orderVMLight.PONumber                    = "AAPO0613201601";
            orderVMLight.TotalDiscountPercent        = 0;
            orderVMLight.EstimatedReleaseDate        = Convert.ToDateTime("2016-06-06 00:00:00.000");
            orderVMLight.DeliveryAppointmentRequired = false;
            orderVMLight.DeliveryContactName         = "";
            orderVMLight.DeliveryContactPhone        = "";
            orderVMLight.OrderReleaseDate            = DateTime.Now.AddDays(2);
            orderVMLight.SubmittedByUserId           = 392643416367824896;
            orderVMLight.SubmitDate                  = DateTime.Now;
            orderVMLight.CreatedByUserId             = 392643416367824896;
            orderVMLight.UpdatedByUserId             = 392643416367824896;
            orderVMLight.DiscountRequestId           = 0;
            orderVMLight.CommissionRequestId         = 0;
            orderVMLight.ERPOrderNumber              = "";
            orderVMLight.ERPPOKey                    = 0;
            orderVMLight.ERPStatus                   = "Submitted";
            orderVMLight.Comments                    = "PLEASE CALL BEFORE SHIPPING";
            orderVMLight.ERPComments                 = "";
            orderVMLight.ERPOrderDate                = null;
            orderVMLight.ERPInvoiceDate              = null;
            orderVMLight.ERPShipDate                 = null;
            orderVMLight.ERPInvoiceNumber            = null;
            orderVMLight.QuoteId                     = 479102111284477952;
            orderVMLight.ProjectId                   = 479102086194151424;
            orderVMLight.CurrentUser                 = user;
            var fileUpload = new FileUploadTest();

            orderVMLight.POAttachment         = fileUpload;
            orderVMLight.POAttachmentFileName = fileUpload.FileUploadName;
            orderVMLight.ERPAccountId         = "1234";

            orderControllerApi          = new OrderController();
            orderController             = new DPO.Web.Controllers.ProjectDashboardController();
            orderController.CurrentUser = user;

            projects = this.db.Projects.Where(p => p.OwnerId == user.UserId).ToList();
        }
示例#8
0
        public ServiceResponse GetSubmittalOrder()
        {
            using (var quoteService = new QuoteServices())
            {
                if (quoteService.HasConfiguredModel(683220433364942848))
                {
                    var temp = 0;
                    //return orderService.BuildSubmittalOrder(683222334861049856);
                }

                var xmlResponse = "<Order_Response><CustomerNumber>20033700</CustomerNumber><Config_Order>9</Config_Order><Order_Type>Customer</Order_Type><MapicsModel><Site>002</Site><Model_Number>DTC060XXX3DXXD</Model_Number><Revision>AA</Revision><BomCreation><Status>Successful</Status></BomCreation></MapicsModel></Order_Response>";
                // string xmlResponse = "<Order_Response><Exception>Duplicate Order# received.</Exception></Order_Response>";
                var serviceResponse = _erpSvcProvider.ProcessMapicsOrderSeriveResponse(xmlResponse);
                return(null);
            }
        }
示例#9
0
        public TestQuoteServices()
        {
            systemService   = new SystemTestDataServices(this.TContext);
            projectService  = new ProjectServices(this.TContext);
            businessService = new BusinessServices(this.TContext);
            quoteService    = new QuoteServices(this.TContext);

            user = GetUserSessionModel("*****@*****.**");

            _projectId   = this.db.Context.Projects.Where(p => p.OwnerId == user.UserId).OrderByDescending(p => p.ProjectId).Select(p => p.ProjectId).FirstOrDefault();
            projectModel = projectService.GetProjectModel(user, _projectId).Model as ProjectModel;
            _quoteId     = this.db.Context.Quotes.Where(q => q.ProjectId == _projectId)
                           .OrderByDescending(q => q.QuoteId)
                           .Select(q => q.QuoteId).FirstOrDefault();

            _quoteCount = this.db.Context.Quotes.Where(q => q.ProjectId == _projectId)
                          .OrderByDescending(q => q.QuoteId)
                          .Count();
        }
示例#10
0
        public ServiceManager()
        {
            this.googleServices = new GoogleServices();
            this.googleServices.LatestCalendarEvent += (sender, calendar) => { this.CalendarStatusEvent?.Invoke(this, calendar); };
            this.googleServices.LatestEmailsEvent   += (sender, mail) => { this.LatestEmailsEvent?.Invoke(this, mail); };

            this.googleMapsServices = new GoogleMapsServices();
            this.googleMapsServices.TrafficUpdateEvent += (sender, traffic) => { this.TrafficUpdateEvent?.Invoke(this, traffic); };

            this.newsServices = new NewsServices();
            this.newsServices.LatestNewsEvent += (sender, newsmodel) => { this.LatestNewsEvent?.Invoke(this, newsmodel); };

            this.weatherServices = new WeatherServices(this.lat, this.logt);
            this.weatherServices.WeatherUpdateEvent += (sender, weather) => { this.WeatherUpdateEvent?.Invoke(this, weather); };

            this.quoteServices = new QuoteServices();
            this.quoteServices.QuoteUpdateEvent += (sender, quote) => { this.QuoteUpdateEvent?.Invoke(this, quote); };

            this.dateTimeServices = new DateTimeServices();
            this.dateTimeServices.TimerUpdateEvent += (sender, time) => { this.TimerUpdateEvent?.Invoke(this, time); };
        }
示例#11
0
        public TestOrderAPI()
        {
            orderService      = new OrderServices(this.TContext);
            orderServiceLight = new OrderServiceLight();
            searchOrders      = new SearchOrders();

            accountService = new AccountServices();
            user           = accountService.GetUserSessionModel("*****@*****.**").Model as UserSessionModel;
            quoteService   = new QuoteServices();

            orderVMLight                             = new OrderViewModelLight();
            orderVMLight.BusinessId                  = 206680765352640513;
            orderVMLight.ShipToAddressId             = 479102086194151432;
            orderVMLight.PricingTypeId               = 1;
            orderVMLight.PONumber                    = "AAPO0613201601";
            orderVMLight.TotalDiscountPercent        = 0;
            orderVMLight.EstimatedReleaseDate        = Convert.ToDateTime("2016-06-06 00:00:00.000");
            orderVMLight.DeliveryAppointmentRequired = false;
            orderVMLight.DeliveryContactName         = "";
            orderVMLight.DeliveryContactPhone        = "";
            orderVMLight.OrderReleaseDate            = DateTime.Now.AddDays(2);
            orderVMLight.SubmittedByUserId           = 392643416367824896;
            orderVMLight.SubmitDate                  = DateTime.Now;
            orderVMLight.CreatedByUserId             = 392643416367824896;
            orderVMLight.UpdatedByUserId             = 392643416367824896;
            orderVMLight.DiscountRequestId           = 0;
            orderVMLight.CommissionRequestId         = 0;
            orderVMLight.ERPOrderNumber              = "";
            orderVMLight.ERPPOKey                    = 0;
            orderVMLight.ERPStatus                   = "Submitted";
            orderVMLight.Comments                    = "PLEASE CALL BEFORE SHIPPING";
            orderVMLight.ERPComments                 = "";
            orderVMLight.ERPOrderDate                = null;
            orderVMLight.ERPInvoiceDate              = null;
            orderVMLight.ERPShipDate                 = null;
            orderVMLight.ERPInvoiceNumber            = null;
            orderVMLight.QuoteId                     = 479102111284477952;
            orderVMLight.ProjectId                   = 479102086194151424;
            orderVMLight.CurrentUser                 = user;
            var fileUpload = new FileUploadTest();

            orderVMLight.POAttachment         = fileUpload;
            orderVMLight.POAttachmentFileName = fileUpload.FileUploadName;
            orderVMLight.ERPAccountId         = "1234";

            orderController = new OrderController();

            projects = this.db.Projects.Where(p => p.OwnerId == user.UserId).ToList();

            foreach (var project in projects)
            {
                var result = this.db.Context.Quotes.Where(q => q.AwaitingOrder == null && q.ProjectId == project.ProjectId).OrderByDescending(q => q.QuoteId).Select(q => new { q.QuoteId, q.ProjectId }).FirstOrDefault();
                if (result != null)
                {
                    quoteModel = quoteService.GetQuoteModel(user, result.ProjectId, result.QuoteId).Model as QuoteModel;
                    if (quoteModel != null)
                    {
                        quotesModelWithoutOrder.Add(quoteModel);
                    }
                }
            }

            foreach (var project in projects)
            {
                var result = this.db.Context.Quotes.Where(q => q.AwaitingOrder == true && q.ProjectId == project.ProjectId).OrderByDescending(q => q.QuoteId).Select(q => new { q.QuoteId, q.ProjectId }).FirstOrDefault();
                if (result != null)
                {
                    quoteModel = quoteService.GetQuoteModel(user, result.ProjectId, result.QuoteId).Model as QuoteModel;
                    if (quoteModel != null)
                    {
                        quotesModelWithOrder.Add(quoteModel);
                    }
                }
            }
        }
示例#12
0
        public void RulesOnStatusChange(UserSessionModel user, Order entity)
        {
            if (base.Entry.HasChanged("OrderStatusTypeId"))
            {
                entity.UpdatedByUserId = user.UserId;

                if (entity.Quote.Project == null)
                {
                    // Needed for quote calculations
                    Db.QueryProjectViewableByProjectId(user, entity.Quote.ProjectId).Include("Owner").Include("Owner.Business").Load();
                }

                if (entity.OrderStatusTypeId == (byte)OrderStatusTypeEnum.Submitted)
                {
                    entity.Quote.Active = true;

                    QuoteServices quoteService = new QuoteServices();
                    QuoteModel    quoteVM      = new QuoteModel();
                    quoteVM = quoteService.GetQuoteModel(user, entity.Quote.ProjectId, entity.QuoteId).Model as QuoteModel;

                    if (quoteVM != null)
                    {
                        this.Response = quoteService.SetActive(user, quoteVM);
                    }

                    if (this.Response.IsOK)
                    {
                        entity.Quote.Project.ProjectOpenStatusTypeId = (byte)ProjectOpenStatusTypeEnum.DaikinHasPO;
                        entity.Quote.Project.ProjectStatusTypeId     = ProjectStatusTypeEnum.ClosedWon;
                    }
                    else
                    {
                        this.Response.Messages.AddError("Set Quote to Active failed");
                    }
                }
                //if (entity.DiscountRequestStatusTypeId == (byte)DiscountRequestStatusTypeEnum.Rejected ||
                //    entity.DiscountRequestStatusTypeId == (byte)DiscountRequestStatusTypeEnum.Deleted)
                //{
                //    entity.Quote.DiscountRequestId = null;
                //    entity.Quote.AwaitingDiscountRequest = false;

                //    entity.ApprovedDiscount = 0;
                //    entity.ApprovedDiscountSplit = 0;
                //    entity.ApprovedDiscountVRV = 0;

                //    RecalulateQuote(user, entity);

                //    if (entity.DiscountRequestStatusTypeId == (byte)DiscountRequestStatusTypeEnum.Rejected)
                //    {
                //        if (this.Response.IsOK) this.Response.AddSuccess("Discount request rejected.");
                //    }
                //    else
                //    {
                //        if (this.Response.IsOK) this.Response.AddSuccess("Discount request deleted.");
                //    }
                //}

                //if (entity.DiscountRequestStatusTypeId == (byte)DiscountRequestStatusTypeEnum.Approved)
                //{
                //    entity.Quote.DiscountRequestId = entity.DiscountRequestId;
                //    entity.Quote.ApprovedCommissionPercentage = entity.RequestedCommission;
                //    if (entity.ApprovedDiscount != null && entity.ApprovedDiscount > 0)
                //    {
                //        entity.Quote.ApprovedDiscountPercentage = entity.ApprovedDiscount.Value;
                //    }
                //    else
                //    {
                //        entity.Quote.ApprovedDiscountPercentage = entity.RequestedDiscount;

                //    }

                //    entity.Quote.AwaitingDiscountRequest = false;

                //    RecalulateQuote(user, entity);

                //    if (this.Response.IsOK) this.Response.AddSuccess("Discount request approved.");
                //}
            }
        }
示例#13
0
 public QuoteController(QuoteServices quoteServices)
 {
     this.quoteServices = quoteServices;
 }
示例#14
0
 public QuoteController()
 {
     this.quoteServices = new QuoteServices();
 }
 public TestQuoteServices()
 {
     service       = new QuoteServices(this.TContext);
     serviceBasket = new BasketServices(this.TContext);
 }
示例#16
0
        public void TestProjectQuotesView_TestSetActiveButton_ShouldSetTheSelectedQuoteToActive()
        {
            NavigateToProjectQuotesView(user, projectId);

            IWebElement quoteTable           = driver.FindElement(By.Id("ProjectQuotes_table"));
            IWebElement quoteSetActiveBtnDiv = quoteTable.FindElement(By.TagName("tbody"))
                                               .FindElements(By.TagName("td")).ToList()
                                               .Where(i => i.GetAttribute("data-col-id") == "9").First();

            //get the row that contain the quoteId that we select. default will be first row
            IWebElement quoteSelectedId = quoteTable.FindElement(By.TagName("tbody"))
                                          .FindElements(By.TagName("tr")).ToList()
                                          .First();

            //now we need to check if the quote we select is active or not
            bool isActive = false;

            long quoteId = (Convert.ToInt64(quoteSelectedId.GetAttribute("id")));

            QuoteServices quoteService  = new QuoteServices();
            QuoteModel    selectedQuote = quoteService.GetQuoteModel(user, projectId, quoteId).Model as QuoteModel;

            if (selectedQuote != null)
            {
                if (selectedQuote.Active == true)
                {
                    isActive = true;
                }
            }

            IWebElement quoteSetActiveBtn = null;

            if (isActive == false)
            {
                quoteSetActiveBtn = quoteSetActiveBtnDiv.FindElement(By.TagName("a"));

                Assert.That(quoteSetActiveBtn.GetAttribute("href").ToLower(),
                            Is.EqualTo("http://user15%40test.com:123456@tstsysdcity2/projectdashboard/projectquotes/" +
                                       projectId + "#"));
                Assert.That(quoteSetActiveBtn.GetAttribute("sc-ajaxpost").ToLower(),
                            Is.EqualTo("/projectdashboard/quotesetactive"));
                Assert.That(quoteSetActiveBtn.GetAttribute("sc-quoteid"), Is.Not.EqualTo(string.Empty));
                Assert.That(quoteSetActiveBtn.FindElement(By.TagName("img")).GetAttribute("src").ToLower(),
                            Is.EqualTo("http://user15%40test.com:123456@tstsysdcity2/images/switch-off.png"));

                //only need to check for the click event when quote is not Active.
                //when quote is Active , the SetActive button is unclickable.
                IJavaScriptExecutor js = driver as IJavaScriptExecutor;
                js.ExecuteScript("arguments[0].click()", quoteSetActiveBtn);

                //set the thread sleep for 5 seconds to make sure the Return message availble
                Thread.Sleep(5000);

                IWebElement quoteSetActiveMessage = driver.FindElement(By.ClassName("pagemessage-success"));
                Assert.That(quoteSetActiveMessage.Text.ToLower().Contains("has been updated."));
            }
            else
            {
                quoteSetActiveBtn = quoteSetActiveBtnDiv.FindElement(By.TagName("img"));
                Assert.That(quoteSetActiveBtn.GetAttribute("src").ToLower(),
                            Is.EqualTo("http://user15%40test.com:123456@tstsysdcity2/images/switch-on.png"));
            }
        }
        public AjaxResponse ReCalculate(QuoteHeader qHeader, QuoteData qData)
        {
            this.QHeader = qHeader;
            this.QData = qData;

            // This is to fix an issue where walmart validates email and user changes it.
            if (this.QHeader.PartnerId.Equals(2319))
            {
                QuoteServices quoteServices = new QuoteServices();
                if (!quoteServices.ValidateEmailVerificationCode(this.QHeader.QuoteNumber, QData.cvgPartnerDiscount))
                {

                    if (QData.cvgPartnerDiscount != null)
                    {
                        this.QHeader.OLSStatus = OlsStatusPaperlessStoredId;
                        this.QData.cvgPartnerDiscount = String.Empty;
                    }
                    else
                    {
                        this.QHeader.OLSStatus = OlsStatusPaperlessStoredIdNegative;
                    }
                }
            }

            switch (QHeader.FormCode)
            {
                case 3:
                    if (QData.cvgDeductible != null)
                    {
                        UpdateWindHailOrHurricaneValues(QData.cvgDeductible);
                    }
                    break;
                case 4:
                    if (QData.propertyCoverageDeductible != null)
                    {
                        UpdateWindHailOrHurricaneValues(QData.propertyCoverageDeductible);
                    }
                    break;
            }

            this.DataBinder.BindCoverageData();

            this.BusinessLogic().Quote.ApexBillingOption = this.QHeader.ApexBillingOption;
            this.BusinessLogic().Quote.Save();
            // do rating
            this.ServiceInterface.CallRatingService();

            //call logging ITR#5549
            LogRateChangeEvent(2);

            DoCompleteQuoteSave();

            // return response
            AjaxResponse response = new AjaxResponse();

            //ITR#8181 Apex
            if (qHeader.IsApexState)
            {
                response.WindoidContentList = QuoteServices.GetQuoteSummary(this.BusinessLogic().Header, this.BusinessLogic().Quote, this.BusinessLogic().Coverage);
                response.WindoidContent = QuoteServices.GetQuoteSummaryFromList(response.WindoidContentList, quote.ApexBillingOption);
            }
            else
            {
                response.WindoidContent = QuoteServices.GetQuoteSummary(this.BusinessLogic().Header, this.BusinessLogic().Quote, this.BusinessLogic().Coverage, this.BusinessLogic().Structure.PropertyType, this.BusinessLogic().QHeader.H04Ui_V2);
            }
            response.quoteHeader = this.BusinessLogic().QHeader;
            response.NextPanel = AjaxPanel.Coverage;

            return response;
        }
        private void ProcessOLSEnrollmentQuestions(string quoteNumber, string storeId, bool? paperlessFlag)
        {
            System.Data.DataTable result = DirectWebDAC.GetOLSEnrollmentValues(quoteNumber);
            var EmailVerificationCode = GetEmailVerificationCode();
            bool paperlessSelected = paperlessFlag == true;
            bool callRecalc = false;
            IQuoteConfiguration config = IQuoteConfiguration.GetConfigurationInstance();
            string emailTemplateName = config.Setting("DiscountCodeEmailTemplate");
            // If OLSStatus is not in the correct status skip this logic and only update the row if it exists
            if (this.BusinessLogic().QHeader.OLSStatus >= OlsStatusPaperlessStoredId)
            {
                // New Quote insert the row into the table and send an email
                if (result.Rows.Count == 0)
                {
                    //  Need to call InitiateToken Call Here and pass in call below.
                    string token = InitiateOLSToken();

                    if (!token.Equals(String.Empty) && !String.IsNullOrEmpty(quoteNumber))
                    {
                        DirectWebDAC.InsertOLSEnrollmentValues(quoteNumber, storeId, paperlessSelected,
                                                               EmailVerificationCode, this.BusinessLogic().QData.email,
                                                               token);
                    }
                    else if (String.IsNullOrEmpty(quoteNumber))
                    {
                        //Call failed update OLSStatus
                        this.BusinessLogic().QHeader.OLSStatus = OlsStatusPaperlessStoredIdNegative;
                    }

                    QuoteServices olsServices = new QuoteServices();

                    if (!string.IsNullOrEmpty(QData.email) && !olsServices.ValidateOLSEmail(QData.email))
                    {
                        // Insert values into BatchEmailMessageQueue

                        DirectWebDAC.InsertValidationEmail(QHeader.PartnerId, quoteNumber, QData.email, QData.firstName, QData.lastName, EmailVerificationCode, storeId, paperlessSelected, config.PartnerName, emailTemplateName);
                    }
                    else
                    {
                        // User disregarded the error and will not get a discount
                        this.BusinessLogic().QHeader.OLSStatus = OlsStatusEmailAlreadyEnrolled; // OLSStatus for invalid email
                    }
                }
                // Quote exists in the table update the row
                else
                {
                    // Check if the email is a new email, if it is update the email and the email veri
                    if (!result.Rows[0]["emailAddress"].Equals(this.BusinessLogic().QData.email))
                    {
                        // Call to get new token from OLS and pass in call below
                        string token = InitiateOLSToken();

                        if (!token.Equals(String.Empty) && !String.IsNullOrEmpty(quoteNumber))
                        {
                            DirectWebDAC.UpdateOLSEnrollment(quoteNumber, storeId, paperlessSelected,
                                                                 EmailVerificationCode, this.BusinessLogic().QData.email,
                                                                   token);
                            UpdateDefaultWalmartDiscount("ASSOCIATE15");
                        }
                        else if (String.IsNullOrEmpty(quoteNumber))
                        {
                            //Call failed update OLSStatus
                            this.BusinessLogic().QHeader.OLSStatus = OlsStatusPaperlessStoredIdNegative;
                        }

                        QuoteServices olsServices = new QuoteServices();
                        if (!string.IsNullOrEmpty(QData.email) && !olsServices.ValidateOLSEmail(QData.email))
                        {
                            // Insert values into BatchEmailMessageQueue
                            DirectWebDAC.InsertValidationEmail(QHeader.PartnerId, quoteNumber, QData.email, QData.firstName, QData.lastName, EmailVerificationCode, storeId, paperlessSelected, config.PartnerName, emailTemplateName);

                            // Clear discount code and set callRecalc to true.
                            callRecalc = true;
                            //this.BusinessLogic().Quote.AutoPolicyNumber = String.Empty;
                            //this.BusinessLogic().QData.cvgPartnerDiscount = String.Empty;

                            if (qHeader.H04Ui_V2 == false)
                            {
                                // We do not need to call rating again for non-h04V2 states as this is called twice after the about you page.
                                callRecalc = false;
                            }

                            this.BusinessLogic().Quote.Save();
                        }
                        else
                        {
                            // User disregarded the error an will not get a discount
                            this.BusinessLogic().QHeader.OLSStatus = OlsStatusEmailAlreadyEnrolled; // OLSStatus for invalid email
                        }
                    }
                    // update the storeId as all other feilds will be unchanged.
                    else if (!result.Rows[0]["CustomerTrackingId"].Equals(this.BusinessLogic().QData.storeID))
                    {
                        DirectWebDAC.UpdateOLSEnrollment(quoteNumber, storeId, paperlessSelected,
                                                         result.Rows[0]["emailverificationcode"].ToString(),
                                                         this.BusinessLogic().QData.email, result.Rows[0]["Token"].ToString());
                    }
                    else if (!result.Rows[0]["PaperlessFlag"].Equals(this.BusinessLogic().QData.paperless))
                    {
                        DirectWebDAC.UpdateOLSEnrollment(quoteNumber, storeId, paperlessSelected,
                                                         result.Rows[0]["emailverificationcode"].ToString(),
                                                         this.BusinessLogic().QData.email, result.Rows[0]["Token"].ToString());
                        this.BusinessLogic().QHeader.OLSStatus = OlsStatusPaperlessStoredId;
                    }
                }
            }
            // update the row even if the OLSStatus is not 1 to update the storeId and Paperless.
            // Do not allow the email to be updated as this will cause issue if OLSStatus becomes 1.
            else if (result.Rows.Count != 0)
            {
                DirectWebDAC.UpdateOLSEnrollment(quoteNumber, storeId, paperlessSelected,
                                                         result.Rows[0]["emailverificationcode"].ToString(), result.Rows[0]["emailAddress"].ToString(), result.Rows[0]["Token"].ToString());

                // Check to see if the user removed their storeid or unselected paperless.
                if (string.IsNullOrEmpty(storeId) || paperlessSelected == false)
                {
                    if (this.BusinessLogic().QHeader.H04Ui_V2)
                    {
                        callRecalc = true;
                    }

                    this.BusinessLogic().Quote.AutoPolicyNumber = String.Empty;
                    this.BusinessLogic().QData.cvgPartnerDiscount = String.Empty;
                    this.BusinessLogic().Quote.Save();
                }
            }

            // If we make a change that requires a new rating call then call it here.
            if (callRecalc)
            {

                this.ServiceInterface.CallRatingService();
                //Strip out default
                if (this.BusinessLogic().Quote.AutoPolicyNumber.Equals("ASSOCIATE15"))
                {
                    this.BusinessLogic().Quote.AutoPolicyNumber = String.Empty;
                    this.BusinessLogic().QData.cvgPartnerDiscount = String.Empty;
                }

            }
        }
 public SubmittalPackageServices() : base()
 {
     htmlService    = new HtmlServices();
     projectService = new ProjectServices();
     quoteService   = new QuoteServices();
 }