コード例 #1
0
ファイル: EmployeeGoalsController.cs プロジェクト: dCogs/HOTP
        // GET: Goals/Create
        public ActionResult Create(int? SelectedEmp)
        {
            if (SelectedEmp == null && TempData["SelectedEmp"] != null)
            {
                SelectedEmp = Convert.ToInt16(TempData["SelectedEmp"]);
            }
            string empName = "";
            try
            {
                //string employeeID = Request.QueryString["EmployeeID"];
                //selectedEmp = Convert.ToInt16(employeeID);
                empName = (db.tblHOTP_Employees.Where(e => e.EmployeeID == SelectedEmp).Select(e => e.FirstName + " " + e.LastName)).First();
                //(db.tblHOTP_Codes.Where(c => c.CodeKey == "YearEnding" && c.Code == year).Select(c => c.CodeId)).First();
            }
            catch { }
            if (SelectedEmp != null)
            {
                tblHOTP_Goals goal = new tblHOTP_Goals();
                goal.Rating1 = 0;
                goal.Rating2 = 0;
                goal.Rating3 = 0;
                goal.Rating4 = 0;
                goal.Rating5 = 0;
                goal.NumDecimals = 0;
                goal.Status = "Active";
                goal.GoalType = "Individual";
                TempData["SelectedEmp"] = SelectedEmp;
                ViewBag.Pillar = PopulateCodesDDL("Pillar");
                ViewBag.YearEnding = PopulateCodesDDL("YearEnding");
                ViewBag.ResultsMeasured = PopulateCodesDDL("ResultsMeasured");
                ViewBag.BestRating = PopulateCodesDDL("BestRating");
                ViewBag.YearEndCalculation = PopulateCodesDDL("YearEndCalculation");
                ViewBag.UnitsMeasuredIn = PopulateCodesDDL("UnitsMeasuredIn");
                ViewBag.ResultsEntered = PopulateCodesDDL("ResultsEntered");

                EvalViewModel evalViewModel = new EvalViewModel
                {
                    EmployeeID = (int)SelectedEmp,
                    EmployeeName = empName,
                    Goal = goal
                };
                return View(evalViewModel);
            }
            return View("index");
        }
コード例 #2
0
ファイル: OrgGoalsController.cs プロジェクト: dCogs/HOTP
 // GET: Goals/Create
 public ActionResult Create()
 {
     tblHOTP_Goals goal = new tblHOTP_Goals();
     goal.Rating1 = 0;
     goal.Rating2 = 0;
     goal.Rating3 = 0;
     goal.Rating4 = 0;
     goal.Rating5 = 0;
     goal.NumDecimals = 0;
     goal.Status = "Active";
     goal.GoalType = "Organizational";
     ViewBag.Pillar = PopulateCodesDDL("Pillar");
     ViewBag.YearEnding = PopulateCodesDDL("YearEnding");
     ViewBag.ResultsMeasured = PopulateCodesDDL("ResultsMeasured");
     ViewBag.BestRating = PopulateCodesDDL("BestRating");
     ViewBag.YearEndCalculation = PopulateCodesDDL("YearEndCalculation");
     ViewBag.UnitsMeasuredIn = PopulateCodesDDL("UnitsMeasuredIn");
     ViewBag.ResultsEntered = PopulateCodesDDL("ResultsEntered");
     return View(goal);
 }
コード例 #3
0
ファイル: EmployeeGoalsController.cs プロジェクト: dCogs/HOTP
        public ActionResult Create(EvalViewModel returnedEvalViewModel)
        {
            if (ModelState.IsValid)
            {
                tblHOTP_Goals newGoal = new tblHOTP_Goals();
                //var goal = db.tblHOTP_Goals.Find(returnedEvalViewModel.Goal.GoalID);
                newGoal.YearEnding = returnedEvalViewModel.Goal.YearEnding;
                newGoal.GoalType = returnedEvalViewModel.Goal.GoalType;
                newGoal.Pillar = returnedEvalViewModel.Goal.Pillar;
                newGoal.GoalName = returnedEvalViewModel.Goal.GoalName;
                newGoal.PillarGoalName = returnedEvalViewModel.Goal.PillarGoalName;
                newGoal.Goal = returnedEvalViewModel.Goal.Goal;
                newGoal.Status = returnedEvalViewModel.Goal.Status;
                newGoal.ResultsMeasured = returnedEvalViewModel.Goal.ResultsMeasured;
                newGoal.BestRating = returnedEvalViewModel.Goal.BestRating;
                newGoal.YearEndCalculation = returnedEvalViewModel.Goal.YearEndCalculation;
                newGoal.UnitsMeasuredIn = returnedEvalViewModel.Goal.UnitsMeasuredIn;
                newGoal.NumDecimals = returnedEvalViewModel.Goal.NumDecimals;
                newGoal.ResultsEntered = returnedEvalViewModel.Goal.ResultsEntered;
                newGoal.EnteredBy = returnedEvalViewModel.Goal.EnteredBy;
                newGoal.NonEditableByLeader = returnedEvalViewModel.Goal.NonEditableByLeader;

                newGoal.Rating1 = returnedEvalViewModel.Goal.Rating1;
                newGoal.Rating2 = returnedEvalViewModel.Goal.Rating2;
                newGoal.Rating3 = returnedEvalViewModel.Goal.Rating3;
                newGoal.Rating4 = returnedEvalViewModel.Goal.Rating4;
                newGoal.Rating5 = returnedEvalViewModel.Goal.Rating5;
                newGoal.Rating1Suffix = returnedEvalViewModel.Goal.Rating1Suffix;
                newGoal.Rating2End = returnedEvalViewModel.Goal.Rating2End;
                newGoal.Rating3End = returnedEvalViewModel.Goal.Rating3End;
                newGoal.Rating4End = returnedEvalViewModel.Goal.Rating4End;
                newGoal.Rating5Suffix = returnedEvalViewModel.Goal.Rating5Suffix;

                newGoal.Jan = returnedEvalViewModel.Goal.Jan;
                newGoal.Feb = returnedEvalViewModel.Goal.Feb;
                newGoal.Mar = returnedEvalViewModel.Goal.Mar;
                newGoal.Apr = returnedEvalViewModel.Goal.Apr;
                newGoal.May = returnedEvalViewModel.Goal.May;
                newGoal.Jun = returnedEvalViewModel.Goal.Jun;
                newGoal.Jul = returnedEvalViewModel.Goal.Jul;
                newGoal.Aug = returnedEvalViewModel.Goal.Aug;
                newGoal.Sep = returnedEvalViewModel.Goal.Sep;
                newGoal.Oct = returnedEvalViewModel.Goal.Oct;
                newGoal.Nov = returnedEvalViewModel.Goal.Nov;
                newGoal.Dec = returnedEvalViewModel.Goal.Dec;
                db.tblHOTP_Goals.Add(newGoal);
                db.SaveChanges();
                int goalID = newGoal.GoalID;

                tblHOTP_EmployeeGoals newEmployeeGoal = new tblHOTP_EmployeeGoals(); // db.tblHOTP_EmployeeGoals.Find(returnedEvalViewModel.EmployeeGoalID);
                newEmployeeGoal.GoalID = goalID;
                newEmployeeGoal.EmployeeID = returnedEvalViewModel.EmployeeID;
                newEmployeeGoal.Weight = returnedEvalViewModel.Weight;
                newEmployeeGoal.ItemScore = 0; // returnedEvalViewModel.ItemScore;
                db.tblHOTP_EmployeeGoals.Add(newEmployeeGoal);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.Pillar = PopulateCodesDDL("Pillar");
            ViewBag.YearEnding = PopulateCodesDDL("YearEnding");
            ViewBag.ResultsMeasured = PopulateCodesDDL("ResultsMeasured");
            ViewBag.BestRating = PopulateCodesDDL("BestRating");
            ViewBag.YearEndCalculation = PopulateCodesDDL("YearEndCalculation");
            ViewBag.UnitsMeasuredIn = PopulateCodesDDL("UnitsMeasuredIn");
            ViewBag.ResultsEntered = PopulateCodesDDL("ResultsEntered");
            return View(returnedEvalViewModel);
        }