Exemple #1
0
        public async Task <IActionResult> SendCustomerLetterAsPdf(int id)
        {
            var vm = new InteractionViewModel();

            vm.Title = _db.Titles.Find(id);
            var viewName        = "InitialNotificationLetterAsPdf";
            var interactionType = "Initial Notification Letter";

            ////todo: check for all required Title fields for letter
            if (await _db.Interactions.AnyAsync(i => i.TitleId == id && i.InteractionType == "Initial Notification Letter"))
            { //check for prior notification letter sent
                interactionType = "Warning Letter";
                viewName        = "WarningLetterAsPdf";
            }

            var inter = new Interaction()
            {
                TitleId           = vm.Title.Id,
                InteractionDt     = DateTime.Now,
                InteractionUserId = _userManager.GetUserAsync(User).Result.Id.ToString(),
                InteractionType   = interactionType,
                VehYr             = vm.Title.VehYr,
                VehMake           = vm.Title.VehMake,
                VehModel          = vm.Title.VehModel,
                Vin                   = vm.Title.Vin,
                TitleState            = vm.Title.TitleState,
                IsNew                 = vm.Title.NewVeh,
                CustFName             = vm.Title.CustFName,
                CustLName             = vm.Title.CustLName,
                CustAddr1             = vm.Title.CustAddr1,
                CustAddr2             = vm.Title.CustAddr2,
                CustCity              = vm.Title.CustCity,
                CustState             = vm.Title.CustState,
                CustZip               = vm.Title.CustZip,
                CustPhone             = "PHONE",
                CustPhone2            = vm.Title.CustPhone2,
                CustFName2            = vm.Title.CustFName2,
                CustLName2            = vm.Title.CustLName2,
                CustFName3            = vm.Title.CustFName3,
                CustLName3            = vm.Title.CustLName3,
                ReceivedDt            = vm.Title.RecDt,
                TitleRecievedFromType = (Interaction.TitleReceivedFromTypes)vm.Title.TitleRecievedFromType
            };

            _db.Interactions.Add(inter);
            _db.SaveChanges();
            vm.Title.LastInteraction = inter.Id;
            vm.County = await _db.Counties.FirstOrDefaultAsync();

            vm.Location = await _db.Locations.FindAsync(vm.Title.InitialLocation);

            _db.Entry(vm.Title).State = EntityState.Modified;
            _db.SaveChanges();
            return(new ViewAsPdf(viewName, vm));
        }
Exemple #2
0
        public async Task <IActionResult> ViewTitleReturnLetterAsPdf(int id)
        {
            var vm = new InteractionViewModel();

            vm.Interaction = await _db.Interactions.FindAsync(id);

            const string viewName = "TitleReturnLetterAsPdfHistory";

            vm.County = await _db.Counties.FirstOrDefaultAsync();

            return(new ViewAsPdf(viewName, vm));
        }
Exemple #3
0
        public async Task <IActionResult> ViewCustomerLetterAsPdf(int id)
        {
            var vm = new InteractionViewModel();

            vm.Interaction = await _db.Interactions.FindAsync(id);

            vm.County = await _db.Counties.FirstOrDefaultAsync();

            var viewName = "WarningLetterAsPdfHistory";

            if (vm.Interaction.InteractionType == "Initial Notification Letter")
            {
                viewName = "InitialNotificationLetterAsPdfHistory";
            }
            return(new ViewAsPdf(viewName, vm));
        }