public ActionResult ConfirmDeleteLifeIns(int LifeInsurance_id) { Life_Insurance lifeIns = db.Life_Insurance.Find(LifeInsurance_id); //db.DeleteEmployeeAndDependents(LifeInsurance_id); db.Life_Insurance.Remove(lifeIns); //db.SaveChanges(); return(RedirectToAction("LifeInsuranceEnrollment")); }
//---------------------------------------------------------------------------------------- public ActionResult DeleteLifeInsurance(int?LifeInsurance_id, int?Employee_id) { ViewBag.Employee_id = Employee_id; ViewBag.LifeInsurance_id = LifeInsurance_id; if (LifeInsurance_id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Life_Insurance lifeIns = db.Life_Insurance.Find(LifeInsurance_id); if (lifeIns == null) { return(HttpNotFound()); } return(View(lifeIns)); }
//==================================== // Post: LifeInsEnrollmentNew //==================================== public JsonResult LifeInsEnrollmentNew(int Employee_id, string GroupPlanNumber, DateTime?BenefitsEffectiveDate, string InitialEnrollment, string ReEnrollment, string AddEmployeeAndDependents, string DropRefuseCoverage, string InformationChange, string IncreaseAmount, string FamilyStatusChange, string SubTotalCode, string Married, DateTime?DateOfMarriage, string OtherDependents, DateTime?DateOfAdoption, /*string AddDep, string DropDep,*/ string AddDropDep, string DropEmployee, string DropDependents, DateTime?LastDayOfCoverage, string TerminationEmploymentOfDropCoverage, string Retirement, DateTime?LastDayWorked, string OtherEvent, string OtherEventReason, DateTime?OtherEventDate, string DropBasicLife, string EmployeeDentalDrop, string SpouseDentalDrop, string DependentDentalDrop, string EmployeeVisionDrop, string SpouseVisionDrop, string DependentVisionDrop, string TerminationEmploymentLossOfOtherCoverage, DateTime?TerminationEmploymentDateLossOfOtherCoverage, string Divorce, DateTime?DivorceDate, string DeathOfSpouse, DateTime?DeathOfSpouseDate, string TerminationOrExpirationOfCoverage, DateTime?TerminationOrExpirationOfCoverageDate, string DentalCoverageLost, string VisionCoverageLost, string CoveredUnderOtherInsurance, string Other, string OtherReason, string DoNotWantDentalCoverage, string EmployeeCoveredUnderOtherDental, string SpouseCoveredUnderOtherDental, string DependentsCoveredUnderOtherDental, string DoNotWantVisionCoverage, string EmployeeCoveredUnderOtherVision, string SpouseCoveredUnderOtherVision, string DependentsCoveredUnderOtherVision, string PrimaryBeneficiary, string ContingentBeneficiary, string OwnerBasicLifeADandDPolicyAmount, string ManagerBasicLifeADandDPolicyAmount, string EmployeeBasicLifeADandDPolicyAmount, string DoNotWantBasicLifeCoverageADandD, string PreviousPolicyAmount, string DentalPlan, string VisionPlan, string EmployeeSignature, DateTime?EmployeeSignatureDate) { string response = ""; int record = (from life in db.Life_Insurance where life.Employee_id == Employee_id select life).Count(); if (record > 0) { response = "Record already exists."; } else { Life_Insurance lifeIns = new Life_Insurance(); lifeIns.Employee_id = Employee_id; lifeIns.GroupPlanNumber = GroupPlanNumber; lifeIns.BenefitsEffectiveDate = BenefitsEffectiveDate; lifeIns.InitialEnrollment = InitialEnrollment; lifeIns.ReEnrollment = ReEnrollment; lifeIns.AddEmployeeAndDependents = AddEmployeeAndDependents; lifeIns.DropRefuseCoverage = DropRefuseCoverage; lifeIns.InformationChange = InformationChange; lifeIns.IncreaseAmount = IncreaseAmount; lifeIns.FamilyStatusChange = FamilyStatusChange; lifeIns.SubTotalCode = SubTotalCode; lifeIns.MarriedOrHaveSpouse = Married; lifeIns.DateOfMarriage = DateOfMarriage; lifeIns.HaveChildrenOrHaveDependents = OtherDependents; lifeIns.PlacementDateOfAdoptedChild = DateOfAdoption; //lifeIns.AddDependent = AddDep; //lifeIns.DropDependent = DropDep; lifeIns.DropEmployee = DropEmployee; lifeIns.DropDependents = DropDependents; lifeIns.LastDayOfCoverage = LastDayOfCoverage; lifeIns.TerminationEmploymentOfDropCoverage = TerminationEmploymentOfDropCoverage; lifeIns.Retirement = Retirement; lifeIns.LastDayWorked = LastDayWorked; lifeIns.OtherEvent = OtherEvent; lifeIns.OtherEventReason = OtherEventReason; lifeIns.OtherEventDate = OtherEventDate; lifeIns.DropBasicLife = DropBasicLife; lifeIns.EmployeeDentalDrop = EmployeeDentalDrop; lifeIns.SpouseDentalDrop = SpouseDentalDrop; lifeIns.DependentDentalDrop = DependentDentalDrop; lifeIns.EmployeeVisionDrop = EmployeeVisionDrop; lifeIns.SpouseVisionDrop = SpouseVisionDrop; lifeIns.DependentVisionDrop = DependentVisionDrop; lifeIns.TerminationEmploymentLossOfOtherCoverage = TerminationEmploymentLossOfOtherCoverage; lifeIns.TerminationEmploymentDateLossOfOtherCoverage = TerminationEmploymentDateLossOfOtherCoverage; lifeIns.Divorce = Divorce; lifeIns.DivorceDate = DivorceDate; lifeIns.DeathOfSpouse = DeathOfSpouse; lifeIns.DeathOfSpouseDate = DeathOfSpouseDate; lifeIns.TerminationOrExpirationOfCoverage = TerminationOrExpirationOfCoverage; lifeIns.TerminationOrExpirationOfCoverageDate = TerminationOrExpirationOfCoverageDate; lifeIns.DentalCoverageLost = DentalCoverageLost; lifeIns.VisionCoverageLost = VisionCoverageLost; lifeIns.CoveredUnderOtherInsurance = CoveredUnderOtherInsurance; lifeIns.Other = Other; lifeIns.OtherReason = OtherReason; lifeIns.DentalCoverage = DentalPlan; lifeIns.VisionCoverage = VisionPlan; lifeIns.DoNotWantDentalCoverage = DoNotWantDentalCoverage; lifeIns.EmployeeCoveredUnderOtherDentalPlan = EmployeeCoveredUnderOtherDental; lifeIns.SpouseCoveredUnderOtherDentalPlan = SpouseCoveredUnderOtherDental; lifeIns.DependentsCoveredUnderOtherDentalPlan = DependentsCoveredUnderOtherDental; lifeIns.DoNotWantVisionCoverage = DoNotWantVisionCoverage; lifeIns.EmployeeCoveredUnderOtherVisionPlan = EmployeeCoveredUnderOtherVision; lifeIns.SpouseCoveredUnderOtherVisionPlan = SpouseCoveredUnderOtherVision; lifeIns.DependentsCoveredUnderOtherVisionPlan = DependentsCoveredUnderOtherVision; lifeIns.OwnerBasicLifeWithADandDPolicyAmount = OwnerBasicLifeADandDPolicyAmount; lifeIns.ManagerBasicLifeWithADandDPolicyAmount = ManagerBasicLifeADandDPolicyAmount; lifeIns.EmployeeBasicLifeWithADandDPolicyAmount = EmployeeBasicLifeADandDPolicyAmount; lifeIns.DoNotWantBasicLifeCoverageWithADandD = DoNotWantBasicLifeCoverageADandD; lifeIns.AmountOfPreviousPolicy = PreviousPolicyAmount; lifeIns.EmployeeSignature = EmployeeSignature; lifeIns.EmployeeSignatureDate = EmployeeSignatureDate; db.Life_Insurance.Add(lifeIns); db.SaveChanges(); } int result = Employee_id; return(Json(new { data = result, error = response }, JsonRequestBehavior.AllowGet)); }
//==================================== // Post: EditLifeInsUpdate //==================================== public JsonResult EditLifeInsUpdate(int?LifeInsurance_id, int?Employee_id, int?InsurancePlan_id, string GroupPlanNumber, DateTime?BenefitsEffectiveDate, string InitialEnrollment, string ReEnrollment, string AddEmployeeAndDependents, string DropRefuseCoverage, string InformationChange, string IncreaseAmount, string FamilyStatusChange, string SubTotalCode, string Married, DateTime?DateOfMarriage, string OtherDependents, DateTime?DateOfAdoption, /*string AddDep,*/ /*string DropDep,*/ string AddDropDep, string DropEmployee, string DropDependents, DateTime?LastDayOfCoverage, string TerminationEmploymentOfDropCoverage, string Retirement, DateTime?LastDayWorked, string OtherEvent, string OtherEventReason, DateTime?OtherEventDate, string DropBasicLife, string EmployeeDentalDrop, string SpouseDentalDrop, string DependentDentalDrop, string EmployeeVisionDrop, string SpouseVisionDrop, string DependentVisionDrop, string TerminationEmploymentLossOfOtherCoverage, DateTime?TerminationEmploymentDateLossOfOtherCoverage, string Divorce, DateTime?DivorceDate, string DeathOfSpouse, DateTime?DeathOfSpouseDate, string TerminationOrExpirationOfCoverage, DateTime TerminationOrExpirationOfCoverageDate, string DentalCoverageLost, string VisionCoverageLost, string CoveredUnderOtherInsurance, string Other, string OtherReason, string DentalCoverage, string DoNotWantDentalCoverage, string EmployeeCoveredUnderOtherDental, string SpouseCoveredUnderOtherDental, string DependentsCoveredUnderOtherDental, string VisionCoverage, string DoNotWantVisionCoverage, string EmployeeCoveredUnderOtherVision, string SpouseCoveredUnderOtherVision, string DependentsCoveredUnderOtherVision, string PrimaryBeneficiary, string ContingentBeneficiary, string OwnerBasicLifeADandDPolicyAmount, string ManagerBasicLifeADandDPolicyAmount, string EmployeeBasicLifeADandDPolicyAmount, string DoNotWantBasicLifeCoverageADandD, string PreviousPolicyAmount, string DentalPlan, string VisionPlan, string EmployeeSignature, DateTime?EmployeeSignatureDate) { Life_Insurance lifeIns = db.Life_Insurance .Where(i => i.Employee_id == Employee_id) .SingleOrDefault(); ViewBag.LifeInsurance_id = lifeIns.LifeInsurance_id; lifeIns.GroupPlanNumber = GroupPlanNumber; lifeIns.BenefitsEffectiveDate = BenefitsEffectiveDate; lifeIns.InitialEnrollment = InitialEnrollment; lifeIns.ReEnrollment = ReEnrollment; lifeIns.AddEmployeeAndDependents = AddEmployeeAndDependents; lifeIns.DropRefuseCoverage = DropRefuseCoverage; lifeIns.InformationChange = InformationChange; lifeIns.IncreaseAmount = IncreaseAmount; lifeIns.FamilyStatusChange = FamilyStatusChange; lifeIns.SubTotalCode = SubTotalCode; lifeIns.MarriedOrHaveSpouse = Married; lifeIns.DateOfMarriage = DateOfMarriage; lifeIns.HaveChildrenOrHaveDependents = OtherDependents; lifeIns.PlacementDateOfAdoptedChild = DateOfAdoption; //lifeIns.AddDependent = AddDep; //lifeIns.DropDependent = DropDep; lifeIns.DropEmployee = DropEmployee; lifeIns.DropDependents = DropDependents; lifeIns.LastDayOfCoverage = LastDayOfCoverage; lifeIns.TerminationEmploymentOfDropCoverage = TerminationEmploymentOfDropCoverage; lifeIns.Retirement = Retirement; lifeIns.LastDayWorked = LastDayWorked; lifeIns.OtherEvent = OtherEvent; lifeIns.OtherEventReason = OtherEventReason; lifeIns.OtherEventDate = OtherEventDate; lifeIns.DropBasicLife = DropBasicLife; lifeIns.EmployeeDentalDrop = EmployeeDentalDrop; lifeIns.SpouseDentalDrop = SpouseDentalDrop; lifeIns.DependentDentalDrop = DependentDentalDrop; lifeIns.EmployeeVisionDrop = EmployeeVisionDrop; lifeIns.SpouseVisionDrop = SpouseVisionDrop; lifeIns.DependentVisionDrop = DependentVisionDrop; lifeIns.TerminationEmploymentLossOfOtherCoverage = TerminationEmploymentLossOfOtherCoverage; lifeIns.TerminationEmploymentDateLossOfOtherCoverage = TerminationEmploymentDateLossOfOtherCoverage; lifeIns.Divorce = Divorce; lifeIns.DivorceDate = DivorceDate; lifeIns.DeathOfSpouse = DeathOfSpouse; lifeIns.DeathOfSpouseDate = DeathOfSpouseDate; lifeIns.TerminationOrExpirationOfCoverage = TerminationOrExpirationOfCoverage; lifeIns.TerminationOrExpirationOfCoverageDate = TerminationOrExpirationOfCoverageDate;//-- NonNullable error Parameter for DateTime lifeIns.DentalCoverageLost = DentalCoverageLost; lifeIns.VisionCoverageLost = VisionCoverageLost; lifeIns.CoveredUnderOtherInsurance = CoveredUnderOtherInsurance; lifeIns.Other = Other; lifeIns.OtherReason = OtherReason; lifeIns.DentalCoverage = DentalPlan; lifeIns.VisionCoverage = VisionPlan; lifeIns.DoNotWantDentalCoverage = DoNotWantDentalCoverage; lifeIns.EmployeeCoveredUnderOtherDentalPlan = EmployeeCoveredUnderOtherDental; lifeIns.SpouseCoveredUnderOtherDentalPlan = SpouseCoveredUnderOtherDental; lifeIns.DependentsCoveredUnderOtherDentalPlan = DependentsCoveredUnderOtherDental; lifeIns.DoNotWantVisionCoverage = DoNotWantVisionCoverage; lifeIns.EmployeeCoveredUnderOtherVisionPlan = EmployeeCoveredUnderOtherVision; lifeIns.SpouseCoveredUnderOtherVisionPlan = SpouseCoveredUnderOtherVision; lifeIns.DependentsCoveredUnderOtherVisionPlan = DependentsCoveredUnderOtherVision; lifeIns.OwnerBasicLifeWithADandDPolicyAmount = OwnerBasicLifeADandDPolicyAmount; lifeIns.ManagerBasicLifeWithADandDPolicyAmount = ManagerBasicLifeADandDPolicyAmount; lifeIns.EmployeeBasicLifeWithADandDPolicyAmount = EmployeeBasicLifeADandDPolicyAmount; lifeIns.DoNotWantBasicLifeCoverageWithADandD = DoNotWantBasicLifeCoverageADandD; lifeIns.AmountOfPreviousPolicy = PreviousPolicyAmount; lifeIns.EmployeeSignature = EmployeeSignature; lifeIns.EmployeeSignatureDate = EmployeeSignatureDate; //Family_Info depAddDrop = db.Family_Info // .Where(i => i.Employee_id == Employee_id) // .SingleOrDefault(); //depAddDrop.AddDropDepLifeIns = AddDropDep; //InsurancePlan insPlan = db.InsurancePlans // .Where(i => i.Employee_id == Employee_id) // .SingleOrDefault(); //ViewBag.InsurancePlan_id = insPlan.InsurancePlan_id; //insPlan.DentalPlan = DentalPlan; //insPlan.VisionPlan = VisionPlan; if (ModelState.IsValid) { db.Entry(lifeIns).State = System.Data.Entity.EntityState.Modified; try { db.SaveChanges(); } catch (Exception err) { Console.WriteLine(err); } } int result = lifeIns.LifeInsurance_id; return(Json(new { data = result }, JsonRequestBehavior.AllowGet)); }