/// <summary> /// 问卷类型枚举 /// </summary> private void SurveyTypeEnum() { string SQL = string.Empty; CommPowerSplit ps = new CommPowerSplit(); if (ps.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName)) //admin or surveyRole { SQL = @"select '' As Id, '请选择...' As TypeName union all select Id,TypeName from FL_Culture..SurveyType"; this.PageState.Add("TypeEnum", DataHelper.QueryDict(SQL)); } else { // SQL = @" select '' As Id, '请选择...' As TypeName // union all // select Id,TypeName from FL_Culture..SurveyType // where ( EnabledState='1' or (EnabledState='1' and (AccessPower is null or len(AccessPower)=0))) // and Id in (select distinct TypeId from FL_Culture..View_SuryTypeUsr where UserID='{0}') "; SQL = @" select '' As Id, '请选择...' As TypeName union all select Id,TypeName from FL_Culture..SurveyType where ( EnabledState='1') and Id in (select distinct TypeId from FL_Culture..View_SuryTypeUsr where UserID='{0}') "; SQL = string.Format(SQL, UserInfo.UserID); this.PageState.Add("TypeEnum", DataHelper.QueryDict(SQL)); } }
private void DoSelect() { CommPowerSplit ps = new CommPowerSplit(); if (ps.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName)) { this.PageState.Add("IsCanGrant", "1"); SearchCriterion.SetSearch("IsFixed", "1"); // SurveyQuestion[] Ents = SurveyQuestion.FindAll(SearchCriterion); this.PageState.Add("DataList", Ents); } else { string SQL = @"select * from SysRole As A inner join SysUserRole As B on A.RoleID=B.RoleID where A.Code='PubSurvey' and B.UserId='{0}'"; SQL = string.Format(SQL, UserInfo.UserID); object obj = DataHelper.QueryValue(SQL); if (obj == null) { if (Session["CompanyId"] != null) { string CorpId = Session["CompanyId"].ToString(); CorpId = !string.IsNullOrEmpty(CorpId) ? CorpId : "1007"; SearchCriterion.SetSearch("CompanyId", CorpId); } } SearchCriterion.SetSearch("IsFixed", "1"); // SurveyQuestion[] Ents = SurveyQuestion.FindAll(SearchCriterion); this.PageState.Add("DataList", Ents); } }
private void DoSelect() { CommPowerSplit ps = new CommPowerSplit(); if (ps.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName)) { SearchCriterion.SetSearch("IsFixed", "2"); //固定问卷 SurveyQuestion[] Ents = SurveyQuestion.FindAll(SearchCriterion); this.PageState.Add("DataList", Ents); } else { SearchCriterion.SetSearch("IsFixed", "2"); //固定问卷 string CompanyId = string.Empty; //公司ID //first depend login corpid var Ent = SysUser.Find(UserInfo.UserID); UserContextInfo UC = new UserContextInfo(); CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID); SearchCriterion.AddSearch("CompanyId", CompanyId); SurveyQuestion[] Ents = SurveyQuestion.FindAll(SearchCriterion); this.PageState.Add("DataList", Ents); } }
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)); }
// //问卷模板 private void GetTplEnum() { string SQL = string.Empty; CommPowerSplit ps = new CommPowerSplit(); if (ps.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName)) //admin or surveyRole { SQL = @"select Id,SurveyTitile As Name from FL_Culture..SurveyQuestion where IsFixed='1' and State='1'"; SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB); PageState.Add("tplEnum", DataHelper.QueryDict(SQL)); } else { var Ent = SysUser.Find(UserInfo.UserID); SQL = @" select Id,SurveyTitile As Name from FL_Culture..SurveyQuestion where IsFixed='1' and State='1' and CompanyId='{0}' Or charindex('{0}',GrantCorpId ) >0 "; SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB); SQL = string.Format(SQL, Ent.Pk_corp); PageState.Add("tplEnum", DataHelper.QueryDict(SQL)); } }
private void Doeselect() { 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 = string.Empty; //问卷角色或管理员 CommPowerSplit Role = new CommPowerSplit(); if (Role.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName)) { SQL = @" select A.*,B.SummitCount from FL_Culture..SurveyQuestion As A left join ( select SurveyId ,count(*) As SummitCount from FL_Culture..SurveyCommitHistory group by SurveyId ) As B on A.Id=B.SurveyId where A.IsFixed='0' and ( A.state='1' or A.state='2' ) "; } else { string CompanyId = string.Empty; UserContextInfo UC = new UserContextInfo(); CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID); //判断公司登陆 //(A.state='1' or A.state='2') 开始 结束 SQL = @" select A.*,B.SummitCount from FL_Culture..SurveyQuestion As A left join ( select SurveyId ,count(*) As SummitCount from FL_Culture..SurveyCommitHistory group by SurveyId ) As B on A.Id=B.SurveyId where A.IsFixed='0' and A.CompanyId='{0}' and (A.state='1' or A.state='2') "; SQL = string.Format(SQL, CompanyId); } SQL += where; this.PageState.Add("DataList", GetPageData(SQL, SearchCriterion)); }
private void Doeselect() { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { case "StartTime": where += " and CreateTime>='" + item.Value + "' "; break; case "EndTime": where += " and CreateTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; break; } } } string SQL = string.Empty; //问卷角色或管理员 获取HR CommPowerSplit Role = new CommPowerSplit(); if (Role.IsHR(UserInfo.UserID, UserInfo.LoginName) || Role.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName)) { SQL = @" select A.*,B.SummitCount from FL_Culture..SurveyQuestion As A left join ( select SurveyId ,count(*) As SummitCount from FL_Culture..SurveyCommitHistory group by SurveyId ) As B on A.Id=B.SurveyId where A.IsFixed='2' and A.State='1' "; } else { string CompanyId = string.Empty;//判断公司登陆 UserContextInfo UC = new UserContextInfo(); CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID); SQL = @" select A.*,B.SummitCount from FL_Culture..SurveyQuestion As A left join ( select SurveyId ,count(*) As SummitCount from FL_Culture..SurveyCommitHistory As A left join FL_PortalHR..sysuser As B on A.SurveyedUserId=B.UserId where B.Pk_corp='{0}' group by SurveyId ) As B on A.Id=B.SurveyId where A.IsFixed='2' and A.state='1'"; // --- 常用问卷不需要此限制条件 and A.CompanyId='{0}' SQL = string.Format(SQL, CompanyId); } SQL += where; //SearchCriterion.SetOrder("CreateTime", false); //IList<SurveyQuestion> Ents = SurveyQuestion.FindAll(SearchCriterion); this.PageState.Add("DataList", GetPageData(SQL, SearchCriterion)); }