public IHttpActionResult GetEmployeeInformationForNotificationByTeam(string adGroupName)
        {
            var employeeObject = new Employee();

            adGroupName = adGroupName.Replace(" and ", " & ");

            var employeeList = new List <Employee>();

            SurveyTeam teamObject = new SurveyTeam();

            teamObject.Team = adGroupName;

            SurveyRaterList raterInfo = new SurveyRaterList();

            var ADUserName = Generic.GetCurrentLogonUserName();

            raterInfo.Type = "Annually";

            raterInfo.Period = "2016";

            raterInfo.Team_Desc = adGroupName;

            // raterInfo.Rater = "Zukiso Diko"; // new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == ADUserName.ToLower()).First().Employee;

            var employeeWithSurveys = new Surveys().getSurveysListByTeam(raterInfo);

            employeeWithSurveys = employeeWithSurveys.Where(c => c.Team_Desc == adGroupName && c.Verified == true && c.Reviewed == true).ToList();

            string data = JsonConvert.SerializeObject(employeeWithSurveys);

            return(Ok(data));
        }
        public IHttpActionResult GetAllEmployeeStatusSurveyReportPerRater(string rater)
        {
            SurveyRaterList survePeriodObject = new SurveyRaterList();

            survePeriodObject.Type = "Annually";

            survePeriodObject.Period = "2016";

            survePeriodObject.Rater = rater;

            var surveyList = new Surveys().getSurveyCompletionStatusRater(survePeriodObject);

            return(Ok(surveyList));
        }
        public IHttpActionResult GetEmployeesWithSurveyPerTeam(string team)
        {
            SurveyRaterList raterInfo = new SurveyRaterList();

            var ADUserName = Generic.GetCurrentLogonUserName();

            raterInfo.Type = "Annually";

            raterInfo.Period = "2016";

            raterInfo.Rater = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == ADUserName.ToLower()).First().Employee;

            var surveyList = new Surveys().getSurveysListStatus(raterInfo);

            surveyList = surveyList.Where(c => c.Team_Desc == team).Distinct().ToList();

            return(Ok(surveyList));
        }
        public IHttpActionResult GetEmployeesWithSurvey()
        {
            SurveyRaterList raterInfo = new SurveyRaterList();

            var ADUserName = Generic.GetCurrentLogonUserName();

            raterInfo.Type = "Annually";

            raterInfo.Period = "2016";

            raterInfo.Rater = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == ADUserName.ToLower()).First().Employee;

            var surveyList = new Surveys().getSurveysListStatus(raterInfo).Where(c => c.Verified == true && c.Reviewed == true).ToList();

            // var employeeData = new Surveys().getSurveysListStatus(raterInfo);

            //To calculate overall rating, first get a survey for each employee
            //var surveyObject = new SurveyRaterSurvey();

            //surveyObject.Type = raterInfo.Type;

            //surveyObject.Period = raterInfo.Period;

            //surveyObject.Rater = raterInfo.Rater;

            //foreach (var survey in surveyList)
            //{
            //    surveyObject.Ratee = survey.Survey_For;

            //    var employeeSurvey = new Surveys().getSurveyFor(surveyObject);

            //    var noOfCompletedQuestions = Convert.ToInt32(employeeSurvey.Where(c => c.Rating > 0).Count());

            //    var noOfQuestionsPerSurvey = Convert.ToInt32(employeeSurvey.Count());

            //    var total = noOfQuestionsPerSurvey > 0 ?  GetOverallRating(noOfCompletedQuestions, noOfQuestionsPerSurvey) : 0;

            //   // employeeData[counter].Rating = total;

            //    counter++;
            //}

            return(Ok(surveyList));
        }
        public IHttpActionResult GetSurveyForListByRater(string rater)
        {
            var employeeObject = new Employee();

            SurveyRaterList raterInfo = new SurveyRaterList();

            var ADUserName = Generic.GetCurrentLogonUserName();

            raterInfo.Type = "Annually";

            raterInfo.Period = "2016";

            raterInfo.Rater = rater;

            var employeeWithSurveys = new Surveys().getSurveysListStatus(raterInfo);

            employeeWithSurveys = employeeWithSurveys.Where(c => c.Verified == true && c.Reviewed == true).ToList();

            string data = JsonConvert.SerializeObject(employeeWithSurveys);

            return(Ok(data));
        }
        public IHttpActionResult CompletionStatusByRaterCompleted(string rater, string status)
        {
            //SurveyForList raterInfo = new SurveyForList();

            //var ADUserName = Generic.GetCurrentLogonUserName();

            //raterInfo.Type = "Annually";

            //raterInfo.Period = "2016";

            //var surveyList = new Surveys().getSurveyForVerifyAllRaters(raterInfo);

            //return Ok(surveyList);

            ////SurveyRaterList raterInfo = new SurveyRaterList();

            ////var ADUserName = Generic.GetCurrentLogonUserName();

            ////raterInfo.Type = "Annually";

            ////raterInfo.Period = "2016";

            ////raterInfo.Rater = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == ADUserName.ToLower()).First().Employee;

            ////var surveyList = new Surveys().getSurveysListStatus(raterInfo);

            ////return Ok(surveyList);

            //var Survey = new Surveys();

            //var surveyObject = new SurveyForList();

            //surveyObject.Type = "Annually";

            //surveyObject.Period = "2016";

            //SurveyRaterList surveyObject2 = new SurveyRaterList();

            //surveyObject2.Period = surveyObject.Period;

            //surveyObject2.Type = surveyObject.Type;

            //surveyObject2.Rater = rater;


            //var f = new Surveys().getRaterSurveys(surveyObject2);

            //return Ok(f);

            SurveyRaterList raterInfo = new SurveyRaterList();

            var ADUserName = Generic.GetCurrentLogonUserName();

            raterInfo.Type = "Annually";

            raterInfo.Period = "2016";

            raterInfo.Rater = rater;

            if (status == "Reviewed")
            {
                var surveyList = new Surveys().getSurveysListStatus(raterInfo).Where(c => c.Reviewed == true && c.Verified == true && c.Survey_For != rater).ToList();

                return(Ok(surveyList));
            }
            else if (status == "Completed")
            {
                var surveyList = new Surveys().getSurveysListStatus(raterInfo).Where(c => c.Completed == true && c.Verified == true && c.Reviewed == true && c.Survey_For != rater).ToList();

                return(Ok(surveyList));
            }
            else if (status == "Incomplete")
            {
                var surveyList = new Surveys().getSurveysListStatus(raterInfo).Where(c => c.Completed == false && c.Reviewed == true && c.Verified == true && c.Survey_For != rater).ToList();

                return(Ok(surveyList));
            }

            return(Ok());
        }