private void DoSelect() { //1 先取当前人所在的部门 一个人可能有多个部门 sql = @"select GroupId from SysGroup where Type='2' and GroupId in (select GroupId from SysUserGroup where UserId='{0}')"; sql = string.Format(sql, op == "c" ? UserInfo.UserID : ent.CreateId); IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); string groupids = ""; foreach (EasyDictionary dic in dics) { groupids += (string.IsNullOrEmpty(groupids) ? "" : ",") + dic.Get <string>("GroupId"); } //2 取该部门下的角色 且名称是'部门正职', '部门副职', '部门领导' sql = @"select GroupId from SysGroup where PatIndex('%'+ParentId+'%','" + groupids + "')>0 and Name in ('部门正职', '部门副职', '部门领导')"; IList <EasyDictionary> dic2s = DataHelper.QueryDictList(sql); groupids = ""; foreach (EasyDictionary dic2 in dic2s) { groupids += (string.IsNullOrEmpty(groupids) ? "" : ",") + dic2.Get <string>("GroupId"); } //3 取该角色下所有的人 sql = @"select UserId,Name from SysUser where UserId In (select UserId from SysUserGroup where PatIndex('%'+GroupId+'%','{0}')>0)"; sql = string.Format(sql, groupids); PageState.Add("AuditEnum", DataHelper.QueryDict(sql, "UserId", "Name")); sql = @"select GroupId from SysGroup where PatIndex('%'+ParentId+'%','037b894a-198f-47fe-8d05-d8f136362dfa')>0 and Name in ('部门正职', '部门副职', '部门领导')"; IList <EasyDictionary> dic3s = DataHelper.QueryDictList(sql); groupids = ""; foreach (EasyDictionary dic3 in dic3s) { groupids += (string.IsNullOrEmpty(groupids) ? "" : ",") + dic3.Get <string>("GroupId"); } //3 取该角色下所有的人 sql = @"select UserId,Name from SysUser where UserId In (select UserId from SysUserGroup where PatIndex('%'+GroupId+'%','{0}')>0)"; sql = string.Format(sql, groupids); PageState.Add("SecondApproveEnum", DataHelper.QueryDict(sql, "UserId", "Name")); if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = VideoNews.Find(id); typeid = ent.TypeId; //详细列表数据 PageState.Add("DetailList", VideoNewDetail.FindAllByProperty("PId", ent.Id)); if (RequestData.Get <string>("InFlow") == "T") { sql = @"select * from Task where PatIndex('%" + ent.Id + "%',EFormName)>0 and Status='4' order by FinishTime asc"; IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql); PageState.Add("Opinion", taskDics); string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见 if (!string.IsNullOrEmpty(taskId)) { Task tEnt = Task.Find(taskId); if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description)) { PageState.Add("UnSubmitOpinion", tEnt.Description); } } } } SetFormData(ent); } else { sql = "select DeptId,ChildDeptName,ParentId,ParentDeptName,len(Path) LenPath from dbo.View_SysUserGroup where UserId='" + UserInfo.UserID + "' and Type=2"; DataTable dtt = DataHelper.QueryDataTable(sql); if (dtt.Rows.Count > 0) { var DeptInfo = new { groupId = dtt.Rows[0]["DeptId"] + "", groupName = dtt.Rows[0]["ChildDeptName"] + "", deptId = dtt.Rows[0]["ParentId"] + "", deptName = dtt.Rows[0]["ParentDeptName"] + "" }; PageState.Add("DeptInfo", DeptInfo); } } IList <NewsType> ntEnts = NewsType.FindAllByProperty(NewsType.Prop_TypeName, "视频新闻"); PageState.Add("TypeId", ntEnts[0].Id); }
protected void Page_Load(object sender, System.EventArgs e) { if (this.Request["Id"] != null) { VideoNews msg = VideoNews.Find(this.Request["Id"]); if (msg != null) { if (msg.State == "2") { msg.Ext1 = msg.Ext1 == null ? "1" : (Convert.ToInt32(msg.Ext1) + 1) + ""; msg.Save(); } if (msg.PostTime != null && msg.PostTime.HasValue) { msg.CreateName = ((DateTime)msg.PostTime).ToString("yyyy-MM-dd HH:mm"); } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", msg.Id, "UserId", UserInfo.UserID); PageState.Add("collection", cts.Length > 0 ? "on" : "off"); this.SetFormData(msg); VideoNewDetail[] imgdetails = VideoNewDetail.FindAllByProperty("PId", msg.Id); if (imgdetails.Length > 0) { Url = imgdetails[0].ImgPath.TrimEnd(','); for (int i = 0; i < imgdetails.Length; i++) { litcontent.Text += "<p id='p" + i + "' style='margin-top: 20px;' tag='" + imgdetails[i].ImgPath + "'>" + imgdetails[i].Content + "</p>"; litimgs.Text += "<li><img src='" + imgdetails[i].Ext1 + "' /><tt></tt></li>"; } } } } if (RequestActionString == "batchcollection") { //收藏 try { //object[] pram = { new SqlParameter("MsgId", RequestData["Id"]), new SqlParameter("UserId", UserInfo.UserID) }; CollectionToUser[] Ctus = CollectionToUser.FindAll("from CollectionToUser where MsgId='" + RequestData["Id"] + "' and UserId='" + UserInfo.UserID + "'"); if (Ctus.Length == 0) { CollectionToUser Ctu = new CollectionToUser(); Ctu.MsgId = RequestData["Id"] + ""; Ctu.UserId = UserInfo.UserID; Ctu.CreateId = UserInfo.UserID + ""; Ctu.CreateName = UserInfo.Name + ""; Ctu.DoSave(); this.PageState.Add("result", "已收藏"); } else { CollectionToUser.DoBatchDelete(Ctus[0].Id); this.PageState.Add("result", "已取消收藏"); } } catch (Exception ex) { this.PageState.Add("result", ex.Message); } } else if (RequestActionString == "readstate") { VideoNews msg = VideoNews.Find(this.RequestData["Id"]); //添加阅读状态 msg.Ext2 = (msg.Ext2 + "").Contains(UserInfo.UserID) ? msg.Ext2 : msg.Ext2 + UserInfo.UserID + ","; msg.DoUpdate(); } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); typeid = RequestData.Get <string>("TypeId"); VideoNews ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <VideoNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.State = "1"; if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.SaveAndFlush(); SaveDetail(ent.Id, ent.ShowImg); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <VideoNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.CreateId = UserInfo.UserID; ent.CreateName = UserInfo.Name; ent.CreateTime = DateTime.Now; ent.State = "1"; if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.CreateAndFlush(); SaveDetail(ent.Id, ent.ShowImg); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Delete: ent = this.GetTargetData <VideoNews>(); ent.DeleteAndFlush(); this.SetMessage("删除成功!"); break; } if (RequestActionString == "ImportFile") { string fileIds = RequestData.Get <string>("fileIds"); if (!string.IsNullOrEmpty(fileIds)) { string sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0"; sql = string.Format(sql, fileIds); PageState.Add("Result", DataHelper.QueryDictList(sql)); } } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = VideoNews.Find(id); typeid = ent.TypeId; //详细列表数据 PageState.Add("DetailList", VideoNewDetail.FindAllByProperty(VideoNewDetail.Prop_PId, ent.Id)); } this.SetFormData(ent); } else { string sql = "select DeptId,ChildDeptName,ParentId,ParentDeptName,len(Path) LenPath from dbo.View_SysUserGroup where UserId='" + UserInfo.UserID + "' and Type=2"; DataTable dtt = DataHelper.QueryDataTable(sql); if (dtt.Rows.Count > 0) { var DeptInfo = new { groupId = dtt.Rows[0]["DeptId"] + "", groupName = dtt.Rows[0]["ChildDeptName"] + "", deptId = dtt.Rows[0]["ParentId"] + "", deptName = dtt.Rows[0]["ParentDeptName"] + "" }; PageState.Add("DeptInfo", DeptInfo); } } if (!String.IsNullOrEmpty(typeid)) { NewsType newsType = NewsType.TryFind(typeid); PageState.Add("NewsType", newsType); } EasyDictionary es = new EasyDictionary(); DataTable dt = DataHelper.QueryDataTable("select Id,TypeName from NewsType where IsEfficient='1'"); foreach (DataRow row in dt.Rows) { es.Add(row["Id"].ToString(), row["TypeName"].ToString()); } PageState.Add("NewsTypeEnum", es); }