public async Task <IEnumerable <SurveyComplete> > GetAllSurveyComplete(int SettingsId) { using (var sqlConnection = new SqlConnection(connectionString)) { await sqlConnection.OpenAsync(); var dynamicParameters = new DynamicParameters(); dynamicParameters.Add("SettingsId", SettingsId); dynamic returns = await sqlConnection.QueryAsync <dynamic>( "SP_GetAllSurveyComplete", dynamicParameters, commandType : CommandType.StoredProcedure); List <SurveyComplete> details = new List <SurveyComplete>(); foreach (var ret in returns) { SurveyComplete surveyComplete = new SurveyComplete(); surveyComplete.Action = ret.Action; surveyComplete.MobileNo = ret.MobileNo; surveyComplete.QualityRate = ret.QualityRate; surveyComplete.QualityComment = ret.QualityComment; surveyComplete.ValueRate = ret.ValueRate; surveyComplete.ValueComment = ret.ValueComment; surveyComplete.ServiceRate = ret.ServiceRate; surveyComplete.ServiceComment = ret.ServiceComment; surveyComplete.AmbienceRate = ret.AmbienceRate; surveyComplete.AmbienceComment = ret.AmbienceComment; surveyComplete.RecommendRate = ret.RecommendRate; surveyComplete.RecommendPoorArea = ret.RecommendPoorArea; surveyComplete.RecommendImprovements = ret.RecommendImprovements; surveyComplete.RecommendSuggestions = ret.RecommendSuggestions; surveyComplete.LastVisit = ret.LastVisit; surveyComplete.LastVisitComment = ret.LastVisitComment; surveyComplete.Action = ret.Action; surveyComplete.Status = ret.Status; surveyComplete.DateTime = ret.DateTime; surveyComplete.Customer = ret.Customer; surveyComplete.MobileNo = ret.MobileNo; surveyComplete.Email = ret.Email; surveyComplete.CheckNo = ret.CheckNo; surveyComplete.TableNo = ret.TableNo; surveyComplete.ManagerId = ret.ManagerId; surveyComplete.StaffId = ret.StaffId; surveyComplete.OutletId = ret.OutletId; surveyComplete.OutletCountry = ret.OutletCountry; surveyComplete.OutletName = ret.OutletName; surveyComplete.Staff = ret.Staff; surveyComplete.Manager = ret.Manager; details.Add(surveyComplete); } return(details.AsEnumerable()); } }
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 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 async Task <SurveyComplete> GetSurveyCompleteById(int SurveyId) { using (var sqlConnection = new SqlConnection(connectionString)) { await sqlConnection.OpenAsync(); var dynamicParameters = new DynamicParameters(); dynamicParameters.Add("@SurveyId", SurveyId); dynamic list = await sqlConnection.QueryAsync <dynamic>( "SP_GetSurveyCompleteById", dynamicParameters, commandType : CommandType.StoredProcedure); foreach (var ret in list) { SurveyComplete surveyComplete = new SurveyComplete(); surveyComplete.Action = ret.Action; surveyComplete.MobileNo = ret.MobileNo; surveyComplete.QualityRate = ret.QualityRate; surveyComplete.QualityComment = ret.QualityComment; surveyComplete.ValueRate = ret.ValueRate; surveyComplete.ValueComment = ret.ValueComment; surveyComplete.ServiceRate = ret.ServiceRate; surveyComplete.ServiceComment = ret.ServiceComment; surveyComplete.AmbienceRate = ret.AmbienceRate; surveyComplete.AmbienceComment = ret.AmbienceComment; surveyComplete.RecommendRate = ret.RecommendRate; surveyComplete.RecommendPoorArea = ret.RecommendPoorArea; surveyComplete.RecommendImprovements = ret.RecommendImprovements; surveyComplete.RecommendSuggestions = ret.RecommendSuggestions; surveyComplete.LastVisit = ret.LastVisit; surveyComplete.LastVisitComment = ret.LastVisitComment; surveyComplete.Action = ret.Action; surveyComplete.Status = ret.Status; surveyComplete.DateTime = ret.DateTime; surveyComplete.Customer = ret.Customer; surveyComplete.MobileNo = ret.MobileNo; surveyComplete.Email = ret.Email; surveyComplete.CheckNo = ret.CheckNo; surveyComplete.TableNo = ret.TableNo; surveyComplete.ManagerId = ret.ManagerId; surveyComplete.StaffId = ret.StaffId; surveyComplete.OutletId = ret.OutletId; surveyComplete.OutletCountry = ret.OutletCountry; surveyComplete.OutletName = ret.OutletName; surveyComplete.Staff = ret.Staff; surveyComplete.Manager = ret.Manager; surveyComplete.Complaint = ret.Complaint; surveyComplete.Feedback = ret.Feedback; surveyComplete.Compliment = ret.Compliment; surveyComplete.UTCDate = ret.DateTime.ToString("yyyy-MM-dd"); surveyComplete.UTCTime = ret.DateTime.ToString("HH:mm:ss"); return(surveyComplete); } return(null); } }