private void DoSelect() { //SurveyQuestion[] Ent = SurveyQuestion.FindAll(SearchCriterion); string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { case "StartTime": where += " and StartTime>='" + item.Value + "' "; break; case "EndTime": where += " and StartTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; break; } } } //创建人或在角色组中的才可查看 string SQL = @"select T1.MustCheckFlow As IsCheck,T.* from FL_Culture..SurveyQuestion As T left join FL_Culture..SurveyType AS T1 on T.SurveyTypeId=T1.Id where IsFixed='0' and ( SurveyTitile is not null or SurveyTitile<>'' ) "; CommPowerSplit ps = new CommPowerSplit();//角色组 or HR if (!ps.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName) || !ps.IsHR(UserInfo.UserID, UserInfo.LoginName)) { SQL += " and ( T.CreateId='{0}' or T.CompanyId in ({1}) ) "; //UserContextInfo UC = new UserContextInfo(); //加到公司权限的才能看到对应公司发布的问卷,否则只能看自己的 string Corps = ps.GetCorps(UserInfo.UserID) + ""; Corps = string.IsNullOrEmpty(Corps.TrimEnd(',')) ? "NULL" : string.Join(",", Corps.TrimEnd(',').Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(ten => "'" + ten + "'").ToArray()); SQL = string.Format(SQL, UserInfo.UserID, Corps); } SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB); SQL += where; this.PageState.Add("DataList", GetPageData(SQL, SearchCriterion)); }