//
        // GET: /Performance/

        public ActionResult Index(string flag)
        {

            if (flag == null || flag=="0")
            {

                QuadrantMeasuresViewModel objQuadrantMeasure = new QuadrantMeasuresViewModel();
                try
                {
                    int LoginID = Convert.ToInt32(HttpContext.User.Identity.Name);
                    List<lstSetQuadMeasures> listQuadMeasure = new List<lstSetQuadMeasures>();
                    DataTable dt = cQuadrantMeasure.getSetQuadrantMeasuresList(LoginID);
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            listQuadMeasure.Add(new lstSetQuadMeasures { GoalID = Convert.ToInt32(dt.Rows[i]["varGoalID"].ToString()), Measures = dt.Rows[i]["varQuadrantMeasure"].ToString(), Count = i + 1, DeptID = dt.Rows[i]["varDepartmentType"].ToString(), dataCount = Convert.ToInt32(dt.Rows[i]["varcount"].ToString()), AllLevelFlag = dt.Rows[i]["varAllLevels"].ToString() });
                        }
                        objQuadrantMeasure.lstQudMeasuresList = listQuadMeasure;
                    }

                    objQuadrantMeasure.DepartmentTypeModel = getDepartmentTypeID();
                    objQuadrantMeasure.GoalTileModel = getGoalTitleList();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return View(objQuadrantMeasure);
            }
            else {
                try
                {
                    int LoginID = Convert.ToInt32(HttpContext.User.Identity.Name);
                    List<cQuadrantMeasure> aob = cQuadrantMeasure.Find(" objEmpLogin = "******" and objDepartmentType = " + flag);
                    List<lstSetQuadMeasures> listQuadMeasure = new List<lstSetQuadMeasures>();
                    if (aob.Count > 0)
                    {
                        int count = 0;
                        foreach (var item in aob)
                        {
                            count++;

                            listQuadMeasure.Add(new lstSetQuadMeasures { GoalID = item.objQuadrant.iObjectID, Measures = item.sMeasures, Count = count, DeptID = item.objFunctionalGroup.iObjectID.ToString(), dataCount = 0, AllLevelFlag = item.bIsAllLevel.ToString() });
                        }
                        objQuadrantMeasure.lstQudMeasuresList = listQuadMeasure;
                    }
                    objQuadrantMeasure.DepartmentTypeModel = getDepartmentTypeID();
                    objQuadrantMeasure.GoalTileModel = getGoalTitleList();
                    ViewBag.Depart = flag;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return View(objQuadrantMeasure);
            }

        }
        public ActionResult ReviewManagerCommentSubmit(QuadrantMeasuresViewModel objQuadViewModel)
        {
            try
            {
                string update = cEmployeeQuadrant.updateManagerFlag(objQuadViewModel.hdnEmployeeID);
                List<cReviewRating> aob = cReviewRating.Find(" objEmpLogin = "******"RevMgrSubmitComment"] = "Manager Comment submitted successfully.";
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RedirectToAction("ManagerReviewRating/" + objQuadViewModel.hdnEmployeeID);
        }
        public ActionResult UpdateEmployeeAcceptance(QuadrantMeasuresViewModel objQuadViewModel)
        {
            int loginID = Convert.ToInt32(HttpContext.User.Identity.Name);
            try
            {

                List<cReviewRating> aob = cReviewRating.Find(" objEmpLogin = "******"empAcceptanceUpdate"] = "Employee Acceptance updated successfully.";

            }
            catch (Exception ex)
            {
                throw ex;
            }


            return RedirectToAction("ReviewRatings");
        }
        public ActionResult UpdateManagerComment(QuadrantMeasuresViewModel objQuadViewModel)
        {
            int ID = objQuadViewModel.hdnEmployeeID;
            try
            {

                List<cReviewRating> aob = cReviewRating.Find(" objEmpLogin = "******"RevMgrUpdateComment"] = "Manager Comment updated successfully";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return RedirectToAction("ManagerReviewRating/" + ID);
        }
        public ActionResult ReviewManagersComment(QuadrantMeasuresViewModel objQuadViewModel)
        {
            try
            {
                cReviewRating objReviewRating = cReviewRating.Create();
                objReviewRating.sManagerComment = objQuadViewModel.objReviewRating.sManagerComment;
                objReviewRating.sManagerSignature = objQuadViewModel.ManagerName;
                objReviewRating.objRatings.iObjectID = objQuadViewModel.objReviewRating.objRatings;
                objReviewRating.objEmpLogin.iObjectID = objQuadViewModel.hdnEmployeeID;
                objReviewRating.Save();
                Session["RevMgrComment"] = "Manager Comment added successfully";
                objQuadrantMeasure.RatingModel = getRatingList();
                DataTable dt = cQuadrantMeasure.getEmployeeManagerName(objQuadViewModel.hdnEmployeeID);
                objQuadrantMeasure.ManagerName = dt.Rows[0]["ManagerName"].ToString();
                objQuadrantMeasure.EmployeeName = dt.Rows[0]["EmployeeName"].ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return RedirectToAction("ManagerReviewRating/" + objQuadViewModel.hdnEmployeeID);
            //  return View(objQuadrantMeasure);
            //return RedirectToAction("ManagerReviewRating");

            //return RedirectToAction("ManagerReviewRating", objQuadViewModel.hdnEmployeeID);
        }
        public ActionResult ReviewManagersComment(int ID)
        {
            QuadrantMeasuresViewModel objQuadViewModel = new QuadrantMeasuresViewModel();
            try
            {
                objQuadViewModel.hdnEmployeeID = ID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return View(objQuadViewModel);

        }
 public ActionResult ReviewDevelopmentGoal(QuadrantMeasuresViewModel objQuadViewModel)
 {
     try
     {
         for (int i = 0; i < objQuadViewModel.DevelopmentPlanID.Length; i++)
         {
             int ID = objQuadViewModel.DevelopmentPlanID[i];
             cCareerDevelopmentPlan objDevelopmentPlan = cCareerDevelopmentPlan.Get_ID(ID);
             objDevelopmentPlan.sManagerComment = objQuadViewModel.ManagerComments[i];
             objDevelopmentPlan.Save();
         }
         Session["ReviewDevGoal"] = "Manager Comment added successfully.";
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return RedirectToAction("ReviewDevelopmentGoal");
 }
 public ActionResult EmployeeReviewQuadrantsSubmit(QuadrantMeasuresViewModel objQuadViewModel)
 {
     int ID = objQuadViewModel.hdnEmployeeID;
     List<cEmployeeQuadrant> aob = cEmployeeQuadrant.Find(" objEmpLogin = "******"ReviewQuadSubmitManagerComment"] = "Manager Comment submitted successfully";
     }
     return RedirectToAction("ReviewQuadrantDetails/" + objQuadViewModel.hdnEmployeeID);
 }
 public ActionResult EmployeeReviewQuadrantsUpdate(QuadrantMeasuresViewModel objQuadViewModel)
 {
     for (int i = 0; i < objQuadViewModel.EmpUniqueGoalID.Length; i++)
     {
         cEmployeeQuadrant objEmpGoals = cEmployeeQuadrant.Get_ID(Convert.ToInt32(objQuadViewModel.EmpUniqueGoalID[i]));
         objEmpGoals.sManagerDescription = objQuadViewModel.ManagerComments[i];
         // objEmpGoals.objEmpLogin.iObjectID = objQuadViewModel.hdnEmployeeID;
         objEmpGoals.Save();               
     }
     Session["ReviewQuadUpdateManagerComment"] = "Manager Comment updated successfully";
     int empID = Convert.ToInt32(objQuadViewModel.hdnEmployeeID);
     return RedirectToAction("ReviewQuadrantDetails/" + empID);
 }
        public ActionResult EmployeeQuadrantsUpdate(QuadrantMeasuresViewModel objQuadViewModel)
        {
            //try
            //{
            //    for (int i = 0; i < objQuadViewModel.EmployeeGoalID.Length; i++)
            //    {
            //        cEmployeeQuadrant objEmpGoals = cEmployeeQuadrant.Get_ID(Convert.ToInt32(objQuadViewModel.EmployeeGoalID[i]));
            //        objEmpGoals.sDescription = objQuadViewModel.empComments[i];
            //        objEmpGoals.objEmpLogin.iObjectID = Convert.ToInt32(HttpContext.User.Identity.Name);
            //        objEmpGoals.Save();
            //    }
            //    Session["EmpQuadUpdate"] = "Employee Quadrants updated successfully";
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}

            return RedirectToAction("EmployeeQuadrants");
        }
        public ActionResult EmployeeQuadrantsSubmit(QuadrantMeasuresViewModel objQuadViewModel)
        {
            try
            {
                int LoginID = Convert.ToInt32(HttpContext.User.Identity.Name);
                List<cEmployeeQuadrant> aob = cEmployeeQuadrant.Find(" objEmpLogin = "******"EmpQuadSubmit"] = "Employee Quadrants submitted successfully.";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RedirectToAction("EmployeeQuadrants");
        }
 public ActionResult EmployeeQuadrants(QuadrantMeasuresViewModel objQuadViewModel)
 {
     //try
     //{
     //    for (int i = 0; i < objQuadViewModel.GoalID.Length; i++)
     //    {
     //        cEmployeeQuadrant objEmpGoals = cEmployeeQuadrant.Create();
     //        // objEmpGoals.objStatus.iObjectID = objQuadViewModel.goalStatusID[i];
     //        objEmpGoals.objGoals.iObjectID = Convert.ToInt32(objQuadViewModel.GoalID[i]);
     //        objEmpGoals.sMesaures = objQuadViewModel.Measures[i];
     //        objEmpGoals.sDescription = objQuadViewModel.empComments[i];
     //        objEmpGoals.objEmpLogin.iObjectID = Convert.ToInt32(HttpContext.User.Identity.Name);
     //        objEmpGoals.Save();                    
     //    }
     //    Session["EmpQudSave"] = "Employee Quadrants added successfully";
     //}
     //catch (Exception ex)
     //{
     //    throw ex;
     //}
     return RedirectToAction("EmployeeQuadrants");
 }
 public ActionResult EmployeeAcceptance(QuadrantMeasuresViewModel objQuadViewModel)
 {
     try
     {
         int LoginId = Convert.ToInt32(HttpContext.User.Identity.Name);
         string empAcceptance = objQuadViewModel.objReviewRating.sEmployeeAcceptance;
         string empSignature = objQuadViewModel.EmployeeName;
         string abc = cQuadrantMeasure.updateEmployeeAcceptance(LoginId, empAcceptance, empSignature);
         Session["empAcceptanceSave"] = "Employee Acceptance added successfully";
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return RedirectToAction("ReviewRatings");
 }
 public ActionResult ManagersComment(QuadrantMeasuresViewModel objQuadViewModel)
 {
     try
     {
         cReviewRating objReviewRating = cReviewRating.Create();
         objReviewRating.sManagerComment = objQuadViewModel.objReviewRating.sManagerComment;
         objReviewRating.sManagerSignature = objQuadViewModel.ManagerName;
         objReviewRating.objRatings.iObjectID = objQuadViewModel.objReviewRating.objRatings;
         objReviewRating.objEmpLogin.iObjectID = Convert.ToInt32(HttpContext.User.Identity.Name);
         objReviewRating.Save();
         ViewBag.DataSaved = "External head added successfully";
         //objQuadrantMeasure.RatingModel = getRatingList();
         //int LoginId = Convert.ToInt32(HttpContext.User.Identity.Name);
         //DataTable dt = cQuadrantMeasure.getEmployeeManagerName(LoginId);
         //objQuadrantMeasure.ManagerName = dt.Rows[0]["ManagerName"].ToString();    
         // return View(objQuadrantMeasure);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return RedirectToAction("ReviewRatings");
 }
        public ActionResult ReviewQuadrantDetails(QuadrantMeasuresViewModel objQuadViewModel)
        {
            int empID = objQuadViewModel.EmpUniqueGoalID[0];
            try
            {
                for (int i = 0; i < objQuadViewModel.EmpUniqueGoalID.Length; i++)
                {
                    int ID = objQuadViewModel.EmpUniqueGoalID[i];
                    cEmployeeQuadrant objEmpGoal = cEmployeeQuadrant.Get_ID(ID);
                      objEmpGoal.sManagerDescription = objQuadViewModel.ManagerComments[i];                                 
                      objEmpGoal.Save();                      
                }
                Session["ReviewQuadManagerComment"] = "Manager Comment added successfully";
              //  tempData.ReviewQuadManagerComment = "Manager Comment added successfully";
                objQuadrantMeasure.EmployeeModel = getEmployeeList();
                objQuadrantMeasure.StatusModel = getStatusList();
                //// string abc = getQuadrantName();

                DataTable dt = cQuadrantMeasure.reviewEmpQuadratants(empID);
                List<lstEmpQuadrantList> list = new List<lstEmpQuadrantList>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    list.Add(new lstEmpQuadrantList { GoalName = dt.Rows[i]["GoalName"].ToString(), Measures = dt.Rows[i]["Measures"].ToString(), Count = i + 1, GoalId = Convert.ToInt32(dt.Rows[i]["GoalId"].ToString()), StatusName = dt.Rows[i]["StatusName"].ToString(), empcomment = dt.Rows[i]["empcomment"].ToString(), EmpGoalID = Convert.ToInt32(dt.Rows[i]["EmpGoalID"].ToString()), ManagerComment = dt.Rows[i]["ManagerComment"].ToString(), ManagerFlag = Convert.ToBoolean(dt.Rows[i]["ManagerFlag"].ToString()) });
                }
                objQuadrantMeasure.QuadList = list;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RedirectToAction("ReviewQuadrantDetails", empID);
        }
        public JsonResult GetQuadrantList()
        {
            try
            {
                JsonResult result = new JsonResult();
                //int LoginID = Convert.ToInt32(HttpContext.User.Identity.Name);
                //List<ddlGoalTitleList> objGoalTitleList = new List<ddlGoalTitleList>();
                //List<cGoals> objGoalTitle = cGoals.Find(" objEmpLogin = "******"Value", "Text");

                QuadrantMeasuresViewModel objQuadrantMeasure = new QuadrantMeasuresViewModel();
                objQuadrantMeasure.DepartmentTypeModel = getDepartmentTypeID();
                objQuadrantMeasure.GoalTileModel = getGoalTitleList();
                result.Data = objQuadrantMeasure;
                result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                return result;
                //return Json(objEmpViewMod);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }