Ejemplo n.º 1
0
        public ActionResult Allocations()
        {
            var stringArray = PerformCalcs.StoredProcedureReturnServiceAndCost("TechServicesEmployeeCost");

            ViewBag.Collection = stringArray;

            // Get Item Count of ViewBag
            var testing = (Enumerable.Count(ViewBag.Collection));

            return(View());
        }
Ejemplo n.º 2
0
        // GET: Employees
        public ActionResult Index()
        {
            //PerformCalcs.StoredProcedureRetDecimal("employees")
            decimal TotalSalary = PerformCalcs.StoredProcedureRetDecimal("SumEmployeeSalary", 0);

            ViewBag.TotalAnnualSal = TotalSalary;

            // Explicit loading of related data using the include method
            var employees = db.Employees.Include(e => e.BusinessUnit);

            return(View(employees.ToList()));
        }
        // The create below also creates the new object named junction_emp_ts  of type junction_emp_ts
        public ActionResult Create([Bind(Include = "JETID,EMPID,TechServiceID,Percentage_Allocation")] Junction_EMP_TS junction_EMP_TS)
        {
            // Trying to allow somebody to type in non decimal versions of a percentage
            if (junction_EMP_TS.Percentage_Allocation > 1)
            {
                junction_EMP_TS.Percentage_Allocation = junction_EMP_TS.Percentage_Allocation / 100;
            }

            // Call function to check Employee utilisation
            var TotalUtilisation = PerformCalcs.StoredProcedureRetDecimal("SumEmployeeSalary", junction_EMP_TS.EMPID);



            if (ModelState.IsValid)
            {
                db.Junction_EMP_TS.Add(junction_EMP_TS);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EMPID         = new SelectList(db.Employees, "EMPID", "SurName", junction_EMP_TS.EMPID);
            ViewBag.TechServiceID = new SelectList(db.TechnologyServices, "TechServiceID", "ServiceName", junction_EMP_TS.TechServiceID);
            return(View(junction_EMP_TS));
        }