public IHttpActionResult SaveRateEmployee(SurveyRate survey)
        {
            if (string.IsNullOrWhiteSpace(survey.Comment))
            {
                return(Ok());
            }

            try
            {
                survey.Type = "Annually";

                survey.Period = "2016";

                survey.User = Generic.GetCurrentLogonUserName();

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

                var insertStatus = new SurveyUpdate().SurveyRating(survey);

                return(Ok(insertStatus));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IHttpActionResult ManagerVerifySingleQuestion(SurveyVerify survey)
        {
            var empSurveyObject = GetSurveyObject(survey.Survey_For);

            empSurveyObject.Survey_For = survey.Survey_For;

            survey.Verify = true;

            var surveyForList = new Surveys().getSurveyForVerifyAllRaters(empSurveyObject);

            surveyForList = surveyForList.Where(c => c.Question == survey.Question).ToList();

            survey.Type = empSurveyObject.Type;

            survey.Period = empSurveyObject.Period;

            foreach (var surveyObject in surveyForList)
            {
                survey.Rater = surveyObject.Rater;

                survey.User = Generic.GetCurrentLogonUserName();

                var manager = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == survey.User.ToLower()).First().Employee;

                survey.Manager = manager;

                var saveReviewQuestion = new SurveyUpdate().SurveyManagerVerify(survey);
            }
            return(Ok());
        }
示例#3
0
 public async Task IndicateSurveyChange(int surveyId)
 {
     SurveyUpdate update = new SurveyUpdate
     {
         SurveyId           = surveyId,
         QuestionPartViewId = 0,
         UpdateType         = "All"
     };
     await Clients.OthersInGroup($"Survey-{surveyId}").RefreshBuilderSurvey(update);
 }
        public IHttpActionResult ManagerVerifyAllQuestions(SurveyComplete survey)
        {
            var empSurveyObject = GetSurveyObject(survey.Survey_For);

            empSurveyObject.Survey_For = survey.Survey_For;

            var surveyForList = new Surveys().getSurveyForVerifyAllRaters(empSurveyObject);

            survey.Type = empSurveyObject.Type;

            survey.Period = empSurveyObject.Period;

            foreach (var surveyObject in surveyForList)
            {
                try
                {
                    survey.Rater = surveyObject.Rater;

                    survey.User = survey.User = Generic.GetCurrentLogonUserName();

                    var saveReviewQuestion = new SurveyUpdate().SurveyManagerVerifyAll(survey);
                }
                catch (Exception)
                {
                    throw;
                }
            }

            var adminFullName = ConfigurationManager.AppSettings["adminFullName"];

            var adminEmaillAddress = ConfigurationManager.AppSettings["adminEmailAddress"];

            var manager = new Surveys().getSurveyTeamEmployeeList().Where(c => c.Employee.ToLower() == survey.Survey_For.ToLower()).First().Manager_Name;

            var emailBody = GetEmailBodyVerification(adminFullName, survey.Survey_For, manager);

            var adUser = new ADUsers();

            //Testing - to be removed later
            //adminEmaillAddress = new ADUsers().GetEmailAddress(new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == survey.User.ToLower()).First().Employee);

            EmailSurveyVerificationNotification(emailBody, adminEmaillAddress);

            return(Ok());
        }
        public IHttpActionResult VerifySurveyQuestion(SurveyVerify surveyQuestion)
        {
            try
            {
                surveyQuestion.Type = "Annually";

                surveyQuestion.Period = "2016";

                surveyQuestion.User = Generic.GetCurrentLogonUserName();

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

                var updateStatus = new SurveyUpdate().SurveyManagerVerify(surveyQuestion);

                return(Ok());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public IHttpActionResult ReOpenSurvey(SurveyComplete survey)
        {
            try
            {
                survey.Type = "Annually";

                survey.Period = "2016";

                survey.Comment = string.Empty;

                survey.User = Generic.GetCurrentLogonUserName();

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

                var insertStatus = new SurveyUpdate().SurveyReOpen(survey);

                return(Ok());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IHttpActionResult UpdateSurveyRaters(SurveyQuestionRaterList surveyQuestionRaterList)
        {
            try
            {
                surveyQuestionRaterList.Type = "Annually";

                surveyQuestionRaterList.Period = "2016";

                surveyQuestionRaterList.AD_User = Generic.GetCurrentLogonUserName();

                if (!string.IsNullOrWhiteSpace(surveyQuestionRaterList.Question) && !string.IsNullOrWhiteSpace(surveyQuestionRaterList.Rater_List) && !string.IsNullOrWhiteSpace(surveyQuestionRaterList.Survey_For))
                {
                    var updateStatus = new SurveyUpdate().SurveyUpdateRaters(surveyQuestionRaterList);

                    return(Ok(updateStatus));
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(Ok());
        }