public int[] GetSurveyToUsers(ResSurveyInfo surveyInfo) { int[] userIds; if (surveyInfo.RelUserType == 0) { userIds = new UserManager().GetAllUsers(surveyInfo.TenantId).Select(p => p.UserId).ToArray(); } else { //找到所有部门 var sql = "select UserId FROM Res_SurveyToUser WHERE SurveyId=" + surveyInfo.SurveyID; userIds = _dataAccess.FetchListBySql <int>(sql).ToArray(); } return(userIds); }
public void GetJoinCount(ResSurveyInfo info) { var userManager = new UserManager(); if (info.RelUserType == 0) { int totalUserCount = userManager.GetUserCount(info.TenantId); info.JoinCount = totalUserCount; } else { info.JoinCount = (int) _dataAccess.ExecuteScalar("SELECT COUNT(1) FROM Res_SurveyToUser WHERE SurveyId=" + info.SurveyID); } //查找已做的问卷 info.CompleteCount = _dataAccess.GetCount <ResParticipateSurvey>("Res_ParticipateSurvey.Path=0 AND Res_ParticipateSurvey.SurveyID =" + info.SurveyID); }
public bool UpdateSurveyInfo(ResSurveyInfo info) { return(_dataAccess.UpdateEntity(info) > 0); }
public int AddSurveyInfo(ResSurveyInfo surveyInfo) { return(_dataAccess.AddEntity(surveyInfo)); }
public void LoadSurveyToUsers(ResSurveyInfo survey) { var sqlwhere = "Res_SurveyToUser.SurveyId=" + survey.SurveyID; survey.ToUsers.AddRange(_dataAccess.GetList <Res_SurveyToUser>(sqlwhere)); }