Example #1
0
        //Create-InsPrem---Finish Html page for Admin. Employee will only view Ins Cost and Vision and Dental pdf
        public JsonResult GrpHealthInsPremiumNew(int Employee_id, int InsurancePlan_id, int InsurancePremium_id, string EmployeeOnly, string EmployeeAndSpouse,
                                                 string EmployeeAndDependent, string EmployeeAndFamily, decimal YearlyPremiumCost, string InsMECPlan, string InsStndPlan, string InsBuyUpPlan)
        {
            InsurancePremium insPremium = new InsurancePremium();

            insPremium.EmployeeOnly         = EmployeeOnly;
            insPremium.EmployeeAndSpouse    = EmployeeAndSpouse;
            insPremium.EmployeeAndDependent = EmployeeAndDependent;
            insPremium.EmployeeAndFamily    = EmployeeAndFamily;
            insPremium.YearlyPremiumCost    = YearlyPremiumCost;

            ViewBag.insPremium = insPremium;

            Employee e = db.Employees
                         .Where(i => i.Employee_id == Employee_id)
                         .Single();

            db.InsurancePremiums.Add(insPremium);

            db.SaveChanges();

            InsurancePlan insPlan = new InsurancePlan();

            //insPlan.InsurancePlan_id = InsurancePlan_id;
            insPlan.MECPlan      = InsMECPlan;
            insPlan.StandardPlan = InsStndPlan;
            insPlan.BuyUpPlan    = InsBuyUpPlan;

            ViewBag.insPlan = insPlan;

            int result = e.Employee_id;

            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        //----------------------------------------------------------------------------------------

        //Edit-InsPrem
        public ActionResult EditGrpHealthInsPremium(int?InsurancePremium_id)
        {
            if (InsurancePremium_id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            InsurancePremium insPremium = db.InsurancePremiums.Find(InsurancePremium_id);

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

            ViewBag.InsurancePremium = insPremium.InsurancePremium_id;

            return(View(insPremium));
        }
Example #3
0
        //EditUpdate-InsPrem
        public JsonResult GrpHealthInsPremiumEditUpdate(int Employee_id, int InsurancePremium_id, string EmployeeOnly,
                                                        string EmployeeAndSpouse, string EmployeeAndDependent, string EmployeeAndFamily, decimal YearlyPremiumCost)
        {
            var e = db.Employees
                    .Where(i => i.Employee_id == Employee_id)
                    .Single();

            InsurancePremium insPremium = db.InsurancePremiums
                                          .Where(i => i.InsurancePremium_id == InsurancePremium_id)
                                          .Single();

            insPremium.EmployeeOnly         = EmployeeOnly;
            insPremium.EmployeeAndSpouse    = EmployeeAndSpouse;
            insPremium.EmployeeAndDependent = EmployeeAndDependent;
            insPremium.EmployeeAndFamily    = EmployeeAndFamily;
            insPremium.YearlyPremiumCost    = YearlyPremiumCost;

            ViewBag.insPremium = insPremium;

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

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

                RedirectToAction("EmpOverview", new { e.Employee_id });
            }

            int result = e.Employee_id;

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