Beispiel #1
0
        //EditDep Method
        public ActionResult EditDependent(int?Employee_id, int?FamilyMember_id, string RelationshipToInsured)
        {
            SpouseAndDependentInsVM spAndDepInsVM = new SpouseAndDependentInsVM();

            spAndDepInsVM.family   = db.Family_Info.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id);
            spAndDepInsVM.otherIns = db.Other_Insurance.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id);
            //spAndDepInsVM.dependent = db.Family_Info.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id && i.RelationshipToInsured == "Dependent");

            if (FamilyMember_id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Family_Info f = db.Family_Info.Find(FamilyMember_id);

            if (f == null)
            {
                return(HttpNotFound());
            }

            ViewBag.FamilyMember_id       = spAndDepInsVM.family.FamilyMember_id;
            ViewBag.Employee_id           = spAndDepInsVM.family.Employee_id;
            ViewBag.RelationshipToInsured = spAndDepInsVM.family.RelationshipToInsured;

            return(View(spAndDepInsVM));
        }
Beispiel #2
0
        //Get-DepDetail
        public ActionResult DependentDetail(int?Employee_id, int?FamilyMember_id, string MaritalStatus, string RelationshipToInsured)
        {
            //ViewBag.spouseExist = !(MaritalStatus == "Single" || MaritalStatus == "SinglewDep");
            SpouseAndDependentInsVM spAndDepInsVM = new SpouseAndDependentInsVM();

            spAndDepInsVM.family   = db.Family_Info.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id);
            spAndDepInsVM.otherIns = db.Other_Insurance.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id);

            if (FamilyMember_id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Family_Info f = db.Family_Info.Find(FamilyMember_id);

            if (family == null)
            {
                return(HttpNotFound());
            }

            ViewBag.FamilyMember_id       = f.FamilyMember_id;
            ViewBag.Employee_id           = f.Employee_id;
            ViewBag.RelationshipToInsured = f.RelationshipToInsured;

            return(View(spAndDepInsVM));
        }
Beispiel #3
0
        //Create-DepEnrollment
        public JsonResult DepEnrollmentNew(int Employee_id, int?FamilyMember_id, string RelationshipToInsured, string SSN, string DepFirstName, string DepLastName,
                                           DateTime DateOfBirth, string Gender, string MailingAddress, string City, string State, string ZipCode, string County, string Student, string Disabled,
                                           string NonStandardDependent, string AddDropDepLifeIns)
        {
            Family_Info dep = new Family_Info();

            dep.Employee_id           = Employee_id;
            dep.RelationshipToInsured = RelationshipToInsured;
            dep.SSN                  = SSN;
            dep.FirstName            = DepFirstName;
            dep.LastName             = DepLastName;
            dep.DateOfBirth          = DateOfBirth;
            dep.Gender               = Gender;
            dep.MailingAddress       = MailingAddress;
            dep.City                 = City;
            dep.State                = State;
            dep.ZipCode              = ZipCode;
            dep.County               = County;
            dep.Student              = Student;
            dep.Disabled             = Disabled;
            dep.NonStandardDependent = NonStandardDependent;
            dep.AddDropDepLifeIns    = AddDropDepLifeIns;

            db.Family_Info.Add(dep);
            db.SaveChanges();

            int result = dep.FamilyMember_id;

            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public ActionResult DepDeleteConfirm(int?FamilyMember_id)
        {
            Family_Info dep = db.Family_Info.Find(FamilyMember_id);

            //Other_Insurance other = db.Other_Insurance.Find(FamilyMember_id);

            db.DeleteEmployeeAndDependents(FamilyMember_id);
            db.Family_Info.Remove(dep);
            //db.Other_Insurance.Remove(other);

            return(RedirectToAction("FamilyOverview", new { dep.Employee_id }));
        }
Beispiel #5
0
        public ActionResult SpDeleteConfirmed(int?FamilyMember_id)
        {
            Family_Info sp = db.Family_Info.Find(FamilyMember_id);

            if (sp == null)
            {
                return(HttpNotFound());
            }

            db.Family_Info.Remove(db.Family_Info.FirstOrDefault(f => f.FamilyMember_id == FamilyMember_id));
            db.SaveChanges();

            //db.Other_Insurance.Find(FamilyMember_id);
            //db.DeleteEmployeeAndDependents(FamilyMember_id);
            //db.Family_Info.Remove(sp);
            //db.Other_Insurance.Remove(other);

            return(RedirectToAction("FamilyOverview", new { sp.Employee_id }));
        }
Beispiel #6
0
        //----------------------------------------------------------------------------------------

        //DeleteSp Method
        public ActionResult DeleteSpouse(int?Employee_id, int?FamilyMember_id)
        {
            SpouseAndDependentInsVM spAndDepInsVM = new SpouseAndDependentInsVM();

            spAndDepInsVM.family   = db.Family_Info.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id);
            spAndDepInsVM.otherIns = db.Other_Insurance.FirstOrDefault(i => i.FamilyMember_id == FamilyMember_id);

            if (FamilyMember_id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Family_Info sp = db.Family_Info.Find(FamilyMember_id);

            if (sp == null)
            {
                return(HttpNotFound());
            }

            return(View(spAndDepInsVM));
        }
Beispiel #7
0
        //Create-SpouseEnrollment
        public JsonResult SpEnrollmentNew(int Employee_id, int?FamilyMember_id, string RelationshipToInsured, string MaritalStatus, string SSN,
                                          string FirstName, string LastName, DateTime DateOfBirth, string Gender)
        {
            string response = "";

            //int record = (from fi in db.Family_Info
            //              where fi.Employee_id == Employee_id
            //              select fi).Count();

            //if (record > 0)
            //{
            //    response = "Record already exists.";

            //}
            //else
            //{ }

            Family_Info sp = new Family_Info();

            sp.Employee_id           = Employee_id;
            sp.RelationshipToInsured = RelationshipToInsured;
            sp.MaritalStatus         = MaritalStatus;
            sp.SSN         = SSN;
            sp.FirstName   = FirstName;
            sp.LastName    = LastName;
            sp.DateOfBirth = DateOfBirth;
            sp.Gender      = Gender;

            sp.DateOfBirth = DateTime.Now.Date;

            db.Family_Info.Add(sp);
            db.SaveChanges();


            int result = sp.FamilyMember_id;

            return(Json(new { data = result, error = response }, JsonRequestBehavior.AllowGet));
        }
Beispiel #8
0
        //EditUpdate-DepEdit
        public JsonResult DepEditUpdate(int?Employee_id, int?FamilyMember_id, string RelationshipToInsured, string SSN, string DepFirstName, string DepLastName,
                                        DateTime DateOfBirth, string Gender, string EmpNumber, string MailingAddress, string City, string State, string ZipCode, string County, string Student,
                                        string Disabled, string NonStandardDependent, string AddDropDepLifeIns, string depInsuranceCoverage, string depInsCarrier, string depInsPolicyNumber,
                                        string depInsPhoneNumber)
        {
            Family_Info dep = db.Family_Info
                              .Where(i => i.FamilyMember_id == FamilyMember_id)
                              .Where(i => i.RelationshipToInsured == "Dependent")
                              .Single();

            dep.RelationshipToInsured = RelationshipToInsured;
            dep.SSN                  = SSN;
            dep.FirstName            = DepFirstName;
            dep.LastName             = DepLastName;
            dep.DateOfBirth          = DateOfBirth;
            dep.Gender               = Gender;
            dep.MailingAddress       = MailingAddress;
            dep.City                 = City;
            dep.State                = State;
            dep.ZipCode              = ZipCode;
            dep.County               = County;
            dep.Student              = Student;
            dep.Disabled             = Disabled;
            dep.NonStandardDependent = NonStandardDependent;
            dep.AddDropDepLifeIns    = AddDropDepLifeIns;

            var emp = new Employee()
            {
                SSN = EmpNumber
            };

            ViewBag.EmpNumber = emp;

            Other_Insurance depOtherIns = db.Other_Insurance
                                          .Where(i => i.FamilyMember_id == FamilyMember_id)
                                          .Single();

            depOtherIns.CoveredByOtherInsurance = depInsuranceCoverage;
            depOtherIns.InsuranceCarrier        = depInsCarrier;
            depOtherIns.PolicyNumber            = depInsPolicyNumber;
            depOtherIns.PhoneNumber             = depInsPhoneNumber;


            int result = dep.Employee_id;

            if (ModelState.IsValid)
            {
                db.Entry(dep).State         = System.Data.Entity.EntityState.Modified;
                db.Entry(depOtherIns).State = System.Data.Entity.EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (Exception error)
                {
                    Console.WriteLine(error);
                }

                RedirectToAction("FamilyOverview", new { dep.Employee_id });
            }

            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }