public async Task <IActionResult> PutDeceased(int id, Deceased deceased)
        {
            if (id != deceased.DeceasedId)
            {
                return(BadRequest());
            }

            _context.Entry(deceased).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DeceasedExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutParentFuneralHome(int id, ParentFuneralHome parentFuneralHome)
        {
            if (id != parentFuneralHome.Id)
            {
                return(BadRequest());
            }

            _context.Entry(parentFuneralHome).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ParentFuneralHomeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #3
0
        public async Task <IActionResult> PutFuneralHomeContact(int id, FuneralHomeContact funeralHomeContact)
        {
            if (id != funeralHomeContact.FuneralHomeContactId)
            {
                return(BadRequest());
            }

            _context.Entry(funeralHomeContact).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FuneralHomeContactExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #4
0
        public async Task <IActionResult> PutVaultOrder(int id, VaultOrder vaultOrder)
        {
            if (id != vaultOrder.VaultOrderId)
            {
                return(BadRequest());
            }

            _context.Entry(vaultOrder).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VaultOrderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("TruckId,AcquisitionDate,PlantId,DriverEmployeeId,DriverName,Make,Model,Year,Type,RegCounty,Vin,Tonnage,LicPlateRenewal,RegFee,TruckNumber,Inactive,InactiveReason")] Truck truck)
        {
            if (ModelState.IsValid)
            {
                var plant = new Plant();
                plant = await _context.Plants.FindAsync(truck.PlantId);

                truck.AssignedPlant = new Plant();
                truck.AssignedPlant = plant;

                Employee e = new Employee();
                e = await _context.Employee.FindAsync(truck.DriverEmployeeId);

                if (e.FirstName != null)
                {
                    truck.DriverName = e.FirstName + " " + e.LastName;
                }

                _context.Add(truck);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(RedirectToAction(nameof(Create)));
        }
        public async Task <IActionResult> PutTruck(string id, Truck truck)
        {
            if (id != truck.TruckId)
            {
                return(BadRequest());
            }

            _context.Entry(truck).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TruckExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #7
0
        public async Task <IActionResult> PutInteraction(int id, Interaction interaction)
        {
            if (id != interaction.InteractionId)
            {
                return(BadRequest());
            }

            _context.Entry(interaction).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InteractionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("EmployeeId,CanDoFollowUps,Title,FirstName,LastName,MiddleName,Address,City,State,ZipCode,County,Email,Phone1,PhoneType1,Active,PhotoImage,PlantId,SelectedAnswer")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                if (employee.SelectedAnswer == 1)
                {
                    employee.Active = "Yes";
                }
                else
                {
                    employee.Active = "No";
                }

                var plant = new Plant();
                plant = await _context.Plants.FindAsync(employee.PlantId);

                employee.PlantEmployee = new Plant();
                employee.PlantEmployee = plant;
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(RedirectToAction(nameof(Create)));
        }
Exemple #9
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(BadRequest());
            }

            _context.Entry(employee).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #10
0
        public async Task <IActionResult> PutPlant(int id, Plant plant)
        {
            if (id != plant.PlantId)
            {
                return(BadRequest());
            }

            _context.Entry(plant).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlantExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutCemetary(int id, Cemetary cemetary)
        {
            if (id != cemetary.CemetaryId)
            {
                return(BadRequest());
            }

            _context.Entry(cemetary).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CemetaryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #12
0
        public async Task <IActionResult> Create([Bind("PlantId,PlantName,PlantManagerEmail,PlantManagerTxtNum,PlantManager,Address,Address2,City,State,ZipCode,County,PrintCompletedOrders,Phone1,Phone2,PhoneType1,PhoneType2")] Plant plant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(plant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(plant));
        }
        public async Task <IActionResult> Create([Bind("FuneralHomeId,ParentFuneralHomeId,PlantId,Name,Address,Address2,City,State,ZipCode,County,Email,Website,Phone1,Phone2,Phone3,PhoneType1,PhoneType2,PhoneType3,IsParent,ParentName,PlantName")] FuneralHome funeralHome)
        {
            if (ModelState.IsValid)
            {
                // If no parent funeralhomes exist...
                if (_context.ParentFuneralHomes.Count() == 0)
                {
                    // if this funeralhome is a parent funeral home...
                    if (funeralHome.IsParent)
                    {
                        // 1) initialize a list of funeral homes.
                        initParentList(funeralHome);
                        // 2) add to list of funeral homes.
                        addParent(funeralHome);
                    }
                    else
                    {
                        // if this funeralhome is a parent funeral home...
                        initParentList(funeralHome);
                    }
                }
                else
                {
                    if (funeralHome.IsParent)
                    {
                        // add to list of funeral homes.
                        addParent(funeralHome);
                    }
                }

                if (funeralHome.ParentFuneralHomeId != null)
                {
                    var pfh = new ParentFuneralHome();
                    pfh = await _context.ParentFuneralHomes.FindAsync(funeralHome.ParentFuneralHomeId);

                    funeralHome.ParentName = pfh.ParentFuneralhomeName;
                }

                if (funeralHome.PlantId != 0)
                {
                    Plant plt = await _context.Plants.FindAsync(funeralHome.PlantId);

                    funeralHome.PlantName = plt.PlantName;
                }

                _context.FuneralHomes.Add(funeralHome);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            //   ViewData["PlantId"] = new SelectList(_context.Plants, "PlantId", "PlantId", funeralHome.PlantId);
            return(View(funeralHome));
        }
Exemple #14
0
        public async Task <IActionResult> AddToVaultOrder(int Id, [Bind("ProductId,Description,Ovation,Decoration,Legacy,Size,Price,ProductCode," +
                                                                        "AllowedToSelectId,UpChargeForLegacy,UpChargeAmount,ProductCategory," +
                                                                        "Color,Color1,Color2,Comments,PhotoImage,VaultOrderId")] Product product)
        {
            if (Id != 0)
            {
                // Find VaultOrder in VaultOrder table
                var VO = await _context.VaultOrder.FindAsync(Id);

                if (VO != null)
                {
                    var POVO = new ProductsOnVaultOrder();
                    POVO.VaultOrderId      = VO.VaultOrderId;
                    POVO.ProductCode       = product.ProductCode;
                    POVO.ProductCategory   = product.ProductCategory;
                    POVO.VenetianCarapace  = product.VenetianCarapace;
                    POVO.Description       = product.Description;
                    POVO.Size              = product.Size;
                    POVO.Price             = product.Price;
                    POVO.AllowedToSelectId = product.AllowedToSelectId;
                    POVO.UpChargeForLegacy = product.UpChargeForLegacy;
                    POVO.UpChargeAmount    = product.UpChargeAmount;
                    POVO.Legacy            = product.Legacy;
                    POVO.Decoration        = product.Decoration;
                    POVO.Ovation           = product.Ovation;
                    POVO.Color             = product.Color;
                    POVO.Color1            = product.Color1;
                    POVO.Color2            = product.Color2;
                    POVO.PhotoImage        = product.PhotoImage;

                    try
                    {
                        _context.ProductsOnVaultOrder.Add(POVO);
                        await _context.SaveChangesAsync();
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!ProductExists(product.ProductId))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                }
                return(RedirectToAction(nameof(Details), "VaultOrders", new { id = Id }));
            }
            return(View());
        }
Exemple #15
0
        public async Task <IActionResult> Create([Bind("VaultOrderId,strFuneralDate,FuneralDate," +
                                                       "CemetaryTime,strCemeteryTime,Location,GraveLocationSection,OrderingPlantId," +
                                                       "OrderingPlantName,DeliveringPlantId,DeliveringPlantName,ZipCode,FuneralHomeId," +
                                                       "NewFuneralHome,FuneralDirector,NewFuneralDirector,CemetaryId,Status,Category,VaultId," +
                                                       "VenetianCarapace,TentWith6Chairs,ExtraChairs,RegisterStand,MilitarySetup,AwningOverCasket," +
                                                       "Fdrequest,VaultOrderNotes,PlantId,ContactId," +
                                                       "Salutation,FirstName,MiddleName,LastName,FullName,Suffix,BornDate,DiedDate")] VaultOrder vaultOrder)
        {
            if (ModelState.IsValid)
            {
                if (vaultOrder.OrderingPlantId != 0)
                {
                    var ordPlant = new Plant();
                    ordPlant = await _context.Plants.FindAsync(vaultOrder.OrderingPlantId);

                    vaultOrder.OrderingPlantName = ordPlant.PlantName;
                }
                if (vaultOrder.DeliveringPlantId != 0)
                {
                    var delPlant = new Plant();
                    delPlant = await _context.Plants.FindAsync(vaultOrder.DeliveringPlantId);

                    vaultOrder.DeliveringPlantName = delPlant.PlantName;
                }

                if (vaultOrder.FuneralHomeId != 0)
                {
                    vaultOrder.funeralhome = (from f in _context.FuneralHomes.Where(i => i.FuneralHomeId == vaultOrder.FuneralHomeId)
                                              select f.Name).FirstOrDefault();
                }

                if (vaultOrder.FuneralHomeContactId != 0)
                {
                    vaultOrder.FuneralDirector = (from f in _context.FuneralHomeContacts.Where(i => i.FuneralHomeContactId == vaultOrder.FuneralHomeContactId)
                                                  select f.FullName).FirstOrDefault();
                }

                _context.Add(vaultOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vaultOrder));
        }
        public async Task <IActionResult> Create(int Id, [Bind("FuneralHomeContactId,FuneralHomeId,FirstName,LastName,NickName,Email,Phone1," +
                                                               "Phone2,Phone3,PhoneType1,PhoneType2,PhoneType3,Spouse," +
                                                               "ShowPrices,ContactRole,Interests,Photo")] FuneralHomeContact funeralHomeContact)
        {
            if (Id == 0)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                funeralHomeContact.FullName = funeralHomeContact.FirstName + " " + funeralHomeContact.LastName;
                _context.Add(funeralHomeContact);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "FuneralHomes", new { Id = funeralHomeContact.FuneralHomeId }));
            }
            return(View(funeralHomeContact));
        }
Exemple #17
0
        public async Task <IActionResult> Create([Bind("CemetaryId,Name,Address,City,State,ZipCode,County," +
                                                       "Phone1,PhoneType1,PlantId,PlantName,Directions,Lattitude,Longitude,Map,UseCoordinates")] Cemetary cemetary)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cemetary);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            if (cemetary.PlantId != 0)
            {
                Plant plt = await _context.Plants.FindAsync(cemetary.PlantId);

                cemetary.PlantName = plt.PlantName;
            }

            return(View(cemetary));
        }
        public async Task <IActionResult> Create([Bind("InteractionId,Date,Nature,Notes,FollowUpDate,Reason,Completed,Outcome,FuneralHomeId,SelectedAnswer")] Interaction interaction)
        {
            if (ModelState.IsValid)
            {
                if (interaction.SelectedAnswer == 1)
                {
                    interaction.Completed = "Yes";
                }
                else
                {
                    interaction.Completed = "No";
                }

                _context.Add(interaction);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "FuneralHomes", new { Id = interaction.FuneralHomeId }));
            }
            return(View(interaction));
        }