public IHttpActionResult GetEmployeeSurveyQuestions(string id) { //First get a list of all the questions var Survey = new Surveys(); var surveyObject = new SurveyRaterSurvey(); surveyObject.Type = "Annually"; surveyObject.Period = "2016"; surveyObject.Rater = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == Generic.GetCurrentLogonUserName().ToLower()).First().Employee; surveyObject.Ratee = id; try { var surveyList = new Surveys().getSurveyFor(surveyObject); //for (int i = 0; i < surveyList.Count(); i++) //{ // surveyList[counter].Q_No = counter; // counter++; //} return(Ok(surveyList.Distinct().ToList())); } catch (Exception ex) { throw new Exception(ex.Message); } }
public IHttpActionResult GetEmployeeQuestionsByRater(string rater) { var empSurveyObject = GetSurveyObject(); var Survey = new Surveys(); var surveyObject = new SurveyRaterSurvey(); surveyObject.Type = "Annually"; surveyObject.Period = "2016"; surveyObject.Rater = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == Generic.GetCurrentLogonUserName().ToLower()).First().Employee; surveyObject.Ratee = rater; var raterListString = string.Empty; var surveyForList = new Surveys().getSurveyForVerifyAllRaters(empSurveyObject); foreach (var surveyObj in surveyForList) { raterListString += surveyObj.Rater + ";"; } var list = new Surveys().getSurveyFor(surveyObject); list[0].Rater = raterListString; return(Ok(list.Distinct().ToList())); }
public SurveyRaterSurvey GetSurveyVerifyObject(string survey_For) { var surveyObject = new SurveyRaterSurvey(); surveyObject.Type = "Annually"; surveyObject.Period = "2016"; return(surveyObject); }
public IHttpActionResult GetSurveyForVerifybyRater(string id) { //First get a list of all the questions var Survey = new Surveys(); var surveyObject = new SurveyRaterSurvey(); surveyObject.Type = "Annually"; surveyObject.Period = "2016"; surveyObject.Manager = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == Generic.GetCurrentLogonUserName().ToLower()).First().Employee; surveyObject.Ratee = id; surveyObject.Rater = surveyObject.Manager; try { var surveyList = new Surveys().getSurveyForVerifybyRater(surveyObject); return(Ok(surveyList.Distinct().ToList())); } catch (Exception ex) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("fgnotes.futuregrowth.co.za"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add("*****@*****.**"); mail.Subject = "HR Performance System - Verify Survey - Manager"; mail.Body = ex.Message + "User: " + Generic.GetCurrentLogonUserName(); SmtpServer.Port = 25; SmtpServer.Send(mail); throw new Exception(ex.Message); } }
public IHttpActionResult GetNextQuestion(string id, int questionNumber, string direction) { try { var surveyObject = new SurveyRaterSurvey(); surveyObject.Type = "Annually"; surveyObject.Period = "2016"; surveyObject.Rater = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == Generic.GetCurrentLogonUserName().ToLower()).First().Employee; surveyObject.Ratee = id; var surveyList = new Surveys().getSurveyFor(surveyObject); surveyList = direction == "Next" ? surveyList.Where(c => c.Q_No == questionNumber + 1).Distinct().ToList() : surveyList.Where(c => c.Q_No == questionNumber - 1).Distinct().ToList(); // surveyList = surveyList.Where(c => c.Q_No == questionNumber + 1).Distinct().ToList(); var nextQuestionObject = new SurveyQuestionnaire(); if (surveyList.Count() > 0) { nextQuestionObject.Q_No = surveyList[0].Q_No; nextQuestionObject.Question = surveyList[0].Question; nextQuestionObject.Rating = surveyList[0].Rating; nextQuestionObject.Question_ID = surveyList[0].Question_ID; nextQuestionObject.Rater_Comment = surveyList[0].Rater_Comment; } return(Ok(nextQuestionObject)); } catch (Exception ex) { throw new Exception(ex.Message); } }