public void StartFlow(string formId) { string code = ""; News ent = News.TryFind(formId); ImgNews imgnew = null; string[] entarry = new string[4]; string formUrl = ""; if (ent != null) { if (ent.TypeId == "fa67b910-a692-4df7-83a2-50711ba4bfa5") { code = "ImgNewsAudit"; } else { code = "NewsAudit"; } formUrl = "/Modules/PubNews/NewsCreateEdit.aspx?op=u&id=" + formId; entarry[0] = ent.Title; entarry[1] = ent.CreateName; entarry[2] = ent.CreateId; entarry[3] = ent.CreateName; } else { imgnew = ImgNews.TryFind(formId); code = "ImgNewsAudit"; if (imgnew != null) { entarry[0] = imgnew.Title; entarry[1] = imgnew.CreateName; entarry[2] = imgnew.CreateId; entarry[3] = imgnew.CreateName; formUrl = "/Modules/PubNews/ImgNews/FrmImgNewsCreateEdit.aspx?op=u&id=" + formId; } } Guid guid = Aim.WorkFlow.WorkFlow.StartWorkFlow(formId, formUrl, "信息发布【" + entarry[0] + "】申请人【" + entarry[1] + "】", code, entarry[2], entarry[3]); //返回流程的Id PageState.Add("FlowId", guid.ToString()); if (ent != null) { ent.WFState = "Flowing"; ent.WFResult = ""; ent.Save(); } else if (imgnew != null) { imgnew.WFState = "Flowing"; imgnew.WFResult = ""; imgnew.Save(); } }
public void StartFlow(string formId) { ImgNews ent = ImgNews.Find(formId); string code = "ImgNewsAudit"; string formUrl = "/Modules/PubNews/ImgNews/FrmImgNewsCreateEdit.aspx?op=u&id=" + formId; Guid guid = Aim.WorkFlow.WorkFlow.StartWorkFlow(formId, formUrl, "信息发布【" + ent.Title + "】申请人【" + ent.CreateName + "】", code, ent.CreateId, ent.CreateName); //返回流程的Id PageState.Add("FlowId", guid.ToString()); ent.WFState = "Flowing"; ent.WFResult = ""; ent.Save(); }
private void DoBatchDelete() { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { foreach (object obj in idList) { ImgNewDetail.DeleteAll(" PId='" + obj + "' "); } ImgNews.DoBatchDelete(idList.ToArray()); } }
public ActionResult GetImgNews(String id) { if (id == null) { return(BadRequest()); } ImgNews imgNews = _db.GetImgNews(id).Result; if (imgNews != null) { return(Ok(imgNews)); } return(NotFound()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Id = Request.QueryString["id"]; ImgNews news = ImgNews.TryFind(Id); if (news == null) { return; } if (news.State == "2") { news.Ext1 = news.Ext1 == null ? "1" : (Convert.ToInt32(news.Ext1) + 1) + ""; news.DoUpdate(); } if (news != null) { this.lbltitle.InnerText = news.Title; this.lblPostDeptName.InnerText = news.PostDeptName; this.lblAuthorName.InnerText = news.CreateName; this.lblPostTime.InnerText = news.PostTime != null?news.PostTime.ToString() : ""; this.lblReadCount.InnerText = news.Ext1; if ((news.Ext2 + "").Contains(UserInfo.UserID)) { lblreadstate.Attributes.Add("style", "display:none"); } ImgNewDetail[] imgdetails = ImgNewDetail.FindAllByProperty("PId", news.Id); int index = 0; foreach (ImgNewDetail ent in imgdetails) { litimg.Text += "<img src='/Document/" + ent.ImgPath + "' width='780' height='570'/>"; litcontent.Text += "<p id='p" + index + "' style='margin-top:20px;'>" + ent.Content + "</p>"; litimgs.Text += "<li><img src='/Document/" + ent.ImgPath + "'/><tt></tt></li>"; index++; } CollectionToUser[] cts = CollectionToUser.FindAllByProperties("MsgId", news.Id, "UserId", UserInfo.UserID); hidcollection.Value = cts.Length > 0 ? "on" : "off"; } } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); typeId = RequestData.Get <string>("TypeId", String.Empty); switch (RequestActionString) { case "batchdelete": IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { NewsRule.BatchRemoveByPrimaryKeys(idList); foreach (object obj in idList) { ImgNewDetail.DeleteAll(" PId='" + obj + "' "); VideoNewDetail.DeleteAll(" PId='" + obj + "' "); string delsql = "delete WorkflowInstance where RelateId='" + obj + "' delete Task where EFormName like '%" + obj + "%'"; DataHelper.ExecSql(delsql); } ImgNews.DoBatchDelete(idList.ToArray()); VideoNews.DoBatchDelete(idList.ToArray()); } break; case "submitnews": object news = null; string NewsType = RequestData.Get <string>("NewsType"); if (NewsType == "视频") { ne = VideoNews.Find(this.RequestData["Id"].ToString()); ne.State = this.RequestData["state"].ToString(); ne.Save(); news = ne; } else if (NewsType == "图片") { imgnew = ImgNews.Find(this.RequestData["Id"].ToString()); imgnew.State = this.RequestData["state"].ToString(); imgnew.Save(); news = imgnew; } else { ent = News.Find(this.RequestData["Id"].ToString()); ent.State = this.RequestData["state"].ToString(); ent.Save(); news = ent; } if (this.RequestData["state"].ToString() == "1") { PageState.Add("message", "提交成功"); } else { string nid = ""; if (news is News) { ent = news as News; ent.WFState = ""; ent.WFResult = ""; ent.Update(); nid = ent.Id; } else if (news is ImgNews) { ImgNews imgent = news as ImgNews; imgent.WFState = ""; imgent.WFResult = ""; imgent.Update(); nid = imgent.Id; } else if (news is VideoNews) { VideoNews videoent = news as VideoNews; videoent.WFState = ""; videoent.WFResult = ""; videoent.Update(); nid = videoent.Id; } string delsql = "delete WorkflowInstance where RelateId='" + nid + "' delete Task where EFormName like '%" + nid + "%'"; DataHelper.ExecSql(delsql); PageState.Add("message", "收回成功"); } break; case "submit": StartFlow(RequestData.Get <string>("id")); break; case "autoexecute": Task[] tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId")); if (tasks.Length == 0) { System.Threading.Thread.Sleep(1000); tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId")); } if (tasks.Length > 0) { this.PageState.Add("TaskId", tasks[0].ID); string AuditUserId = RequestData.Get <string>("AuditUserId"); string AuditUserName = RequestData.Get <string>("AuditUserName"); if (!string.IsNullOrEmpty(AuditUserId)) { Aim.WorkFlow.WorkFlow.AutoExecute(tasks[0], new string[] { AuditUserId, AuditUserName }); } else { PageState.Add("error", "自动提交申请人失败,请手动提交"); } } else { PageState.Add("error", "自动提交申请人失败,请手动提交"); } break; case "CancelFlow": string id = RequestData.Get <string>("id"); string NId = ""; ent = News.TryFind(id); if (ent != null) { NId = ent.Id; } else { imgnew = ImgNews.TryFind(id); if (imgnew != null) { NId = imgnew.Id; } } if (DataHelper.QueryDataTable("Select Id from Task where EFormName like '%" + NId + "%' and OwnerId='" + this.UserInfo.UserID + "' and Status=0 ").Rows.Count == 0) { PageState.Add("error", "单据未打回给您或未启动流程,不能作废!"); } else { if (ent != null) { ent.WFState = ""; ent.WFResult = "已撤销"; ent.Update(); } else if (imgnew != null) { imgnew.WFState = ""; imgnew.WFResult = "已撤销"; imgnew.Update(); } string delsql = "delete WorkflowInstance where RelateId='" + NId + "' delete Task where EFormName like '%" + NId + "%'"; DataHelper.ExecSql(delsql); } break; default: PageState.Add("WorkFlowState", SysEnumeration.GetEnumDict("WorkFlowState")); if (op == "r") { string path = DataHelper.QueryValue("select g.Path from SysGroup g inner join sysusergroup ug on ug.GroupId=g.GroupId where UserId='" + UserInfo.UserID + "'") + ""; string sql = @"select n.Id, n.TypeId, n.BelongDeptId, n.Title, n.KeyWord, n.Content, n.ContentType, n.AuthorName, n.PostUserId, n.PostUserName, n.PostDeptId, n.PostDeptName, n.ReceiveDeptId, n.ReceiveDeptName, n.ReceiveUserId, n.ReceiveUserName, n.PostTime, n.ExpireTime, n.SaveTime, n.Pictures, n.Attachments, n.MHT, n.State, n.ImportantGrade, n.ReadCount, n.HomePagePopup, n.LinkPortalImage, n.Class, n.PopupIds, n.Grade, n.AuthorId, n.CreateTime, n.CreateId, n.CreateName, n.Type, n.ReleaseState, n.PId, n.SubmitState, n.NewType, n.ReadState, n.RemindDays, n.RdoType, n.FileType, n.MhtFile from News n inner join NewsType nt on nt.Id=n.TypeId where TypeId='{2}' and State='2' and isnull(ExpireTime,'2099-01-01')>=getdate() and (charindex('{0}',n.ReceiveUserId)>0 or charindex('{0}',n.AuthorId)>0 or charindex('{0}',nt.AllowQueryId)>0 or exists (select Id from Competence c where c.Ext1=n.Id and charindex(PId,'{1}')>0) or exists (select Id from Competence c where c.Ext1=nt.Id and charindex(PId,'{1}')>0)) {3}"; //合并老系统的新闻和公告 if (typeId == "fa67b910-a692-4df7-83a2-50711ba4bfa5" || typeId == "eb9db227-6adc-4dd1-8783-467aadc2d11b") { if (typeId == "fa67b910-a692-4df7-83a2-50711ba4bfa5") { sql += @" union all select [Id],'fa67b910-a692-4df7-83a2-50711ba4bfa5' [CatalogId],[BelongDeptId],[Title],[KeyWord],[Content],[ContentType] ,[AuthorName],[PostUserId],[PostUserName],[PostDeptId],[PostDeptName] ,[ReceiveDeptId],[ReceiveDeptName],[ReceiveUserId],[ReceiveUserName] ,[PostTime],[ExpireTime],[SaveTime],[Pictures],[Attachments],[MHT] ,2,[ImportantGrade],[ReadCount],[HomePagePopup],[LinkPortalImage], '' s,[PopupIds],[Grade],'' authorid,null createtime,null createid,null t,class,null a,null b,null c,null d,null e,null f,null g,null h,null i from BJKY_BeOfficeAuto..PublicInformation WHERE CatalogId = 'OPIC0020' and state=1 {3}"; } else { sql += @" union all select [Id],'eb9db227-6adc-4dd1-8783-467aadc2d11b' [CatalogId],[BelongDeptId],[Title],[KeyWord],[Content],[ContentType] ,[AuthorName],[PostUserId],[PostUserName],[PostDeptId],[PostDeptName] ,[ReceiveDeptId],[ReceiveDeptName],[ReceiveUserId],[ReceiveUserName] ,[PostTime],[ExpireTime],[SaveTime],[Pictures],[Attachments],[MHT] ,2,[ImportantGrade],[ReadCount],[HomePagePopup],[LinkPortalImage], '' s,[PopupIds],[Grade],'' authorid,null createtime,null createid,null t,class,null a,null b,null c,null d,null e,null f,null g,null h,null i from BJKY_BeOfficeAuto..PublicInformation WHERE CatalogId = 'OPIC0021' and state=1 {3}"; } } string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (item.Value + "" != "") { where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; } } sql = string.Format(sql, UserInfo.UserID, path, typeId, where); PageState.Add("SysUserList", GetPageData(sql, SearchCriterion)); } else { string where = " and isnull(ExpireTime,'2099-01-01')>=getdate() "; if (RequestData.Get <string>("Expire") == "true") { where = " and isnull(ExpireTime,'2099-01-01')<getdate() "; } foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (item.Value + "" != "") { where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; } } if (!string.IsNullOrEmpty(typeId)) { SearchCriterion.SetSearch("TypeId", typeId); News[] ents = NewsRule.FindAll(SearchCriterion, Expression.Sql(" AuthorId = '" + UserInfo.UserID + "' " + where)).OrderByDescending(o => o.SaveTime).ToArray(); this.PageState.Add("SysUserList", ents); } //图片新闻、视频新闻 不需要过滤(不同的页面) else { string sql = @"select * from (select Id, TypeId, Title, AuthorId, AuthorName, PostDeptId,ReadCount, PostDeptName, PostTime, ExpireTime, SaveTime, [State],'普通' as NewsType, AuditUserId, AuditUserName, WFState, WFResult, (select top 1 ApprovalNodeName from task where [Status]='0' and EFormName like '%'+News.Id+'%') as WFCurrentNode from News union all select Id, TypeId, Title, CreateId,CreateName, PostDeptId,Ext1, PostDeptName, PostTime, ExpireTime, CreateTime, [State],'图片', AuditUserId, AuditUserName, WFState, WFResult, (select top 1 ApprovalNodeName from task where [Status]='0' and EFormName like '%'+ImgNews.Id+'%') as WFCurrentNode from ImgNews union all select Id, TypeId, Title, CreateId,CreateName, PostDeptId,Ext1, PostDeptName, PostTime, ExpireTime, CreateTime, [State],'视频', AuditUserId, AuditUserName, WFState, WFResult, (select top 1 ApprovalNodeName from task where [Status]='0' and EFormName like '%'+VideoNews.Id+'%') as WFCurrentNode from VideoNews) t "; this.PageState.Add("SysUserList", GetPageData(sql + " where AuthorId = '" + UserInfo.UserID + "' " + where, SearchCriterion)); } } break; } if (!IsAsyncRequest) { NewsType[] types = NewsType.FindAll(); Dictionary <string, string> dt = new Dictionary <string, string>(); foreach (NewsType type in types) { dt.Add(type.Id, type.TypeName); } PageState.Add("EnumType", dt); } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); typeId = RequestData.Get <string>("TypeId", String.Empty); News ent = null; switch (this.RequestAction) { case RequestActionEnum.Delete: ent = this.GetTargetData <News>(); ent.Delete(); break; case RequestActionEnum.Custom: if (RequestActionString == "batchdelete") { IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { NewsRule.BatchRemoveByPrimaryKeys(idList); foreach (object obj in idList) { ImgNewDetail.DeleteAll(" PId='" + obj + "' "); VideoNewDetail.DeleteAll(" PId='" + obj + "' "); } ImgNews.DoBatchDelete(idList.ToArray()); VideoNews.DoBatchDelete(idList.ToArray()); } } else if (this.RequestActionString.ToLower() == "submitnews") { string NewsType = RequestData.Get <string>("NewsType"); if (NewsType == "视频") { VideoNews ne = VideoNews.Find(this.RequestData["Id"].ToString()); ne.PostTime = DateTime.Now; ne.State = this.RequestData["state"].ToString(); string state = this.RequestData["state"] + ""; if (state == "2") { ne.PostUserId = UserInfo.UserID; ne.PostUserName = UserInfo.Name; ne.PostTime = DateTime.Now; PageState.Add("message", "发布成功"); } else if (state == "0") { PageState.Add("message", "退回成功"); } else { ne.PostUserId = ""; ne.PostUserName = ""; ne.PostTime = null; PageState.Add("message", "撤销成功"); } ne.Save(); } else if (NewsType == "图片") { ImgNews ne = ImgNews.Find(this.RequestData["Id"].ToString()); ne.PostTime = DateTime.Now; ne.State = this.RequestData["state"].ToString(); string state = this.RequestData["state"] + ""; if (state == "2") { ne.PostUserId = UserInfo.UserID; ne.PostUserName = UserInfo.Name; ne.PostTime = DateTime.Now; PageState.Add("message", "发布成功"); } else if (state == "0") { PageState.Add("message", "退回成功"); } else { ne.PostUserId = ""; ne.PostUserName = ""; ne.PostTime = null; PageState.Add("message", "撤销成功"); } ne.Save(); } else { News ne = News.Find(this.RequestData["Id"].ToString()); ne.PostTime = DateTime.Now; ne.State = this.RequestData["state"].ToString(); string state = this.RequestData["state"] + ""; if (state == "2") { ne.PostUserId = UserInfo.UserID; ne.PostUserName = UserInfo.Name; ne.PostTime = DateTime.Now; PageState.Add("message", "发布成功"); } else if (state == "0") { PageState.Add("message", "退回成功"); } else { ne.PostUserId = ""; ne.PostUserName = ""; ne.PostTime = null; PageState.Add("message", "撤销成功"); } ne.Save(); } return; } break; default: string where = " and isnull(ExpireTime,'2099-01-01')>=getdate() "; if (RequestData.Get <string>("checkstate") == "0") { where += " and State='1' "; } else { where += " and State='2' "; } if (RequestData.Get <string>("Expire") == "true") { where = " and isnull(ExpireTime,'2099-01-01')<getdate() "; } foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { default: where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; break; } } } if (RequestData.Get <string>("checktype") == "Dept") { string sql = @"select top 1 [Path] from View_SysUserGroup where UserId='" + UserInfo.UserID + "' order by Type desc"; where += " and '" + (DataHelper.QueryValue(sql) + "") + "' like '%'+PostDeptId+'%'"; } if (!string.IsNullOrEmpty(typeId)) { SearchCriterion.SetSearch("TypeId", typeId); ents = NewsRule.FindAll(SearchCriterion, Expression.Sql(" (State='1' or State='2') " + where)).OrderByDescending(o => o.SaveTime).ToArray(); this.PageState.Add("SysUserList", ents); } //图片新闻、视频新闻 不需要过滤(不同的页面) else { string sql = @"select * from (select Id, TypeId, Title, AuthorName, PostDeptId,ReadCount, PostDeptName, PostTime, ExpireTime, SaveTime, [State],'普通' as NewsType from News union all select Id, TypeId, Title, CreateName, PostDeptId,Ext1, PostDeptName, PostTime, ExpireTime, CreateTime, [State],'图片' from ImgNews union all select Id, TypeId, Title, CreateName, PostDeptId,Ext1, PostDeptName, PostTime, ExpireTime, CreateTime, [State],'视频' from VideoNews) t "; this.PageState.Add("SysUserList", GetPageData(sql + " where 1=1 " + where, SearchCriterion)); } break; } if (!IsAsyncRequest) { NewsType[] types = NewsType.FindAll(); Dictionary <string, string> dt = new Dictionary <string, string>(); foreach (NewsType type in types) { dt.Add(type.Id, type.TypeName); } this.PageState.Add("EnumType", dt); } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); typeid = RequestData.Get <string>("TypeId"); JsonString = RequestData.Get <string>("JsonString"); if (!string.IsNullOrEmpty(id)) { ent = ImgNews.Find(id); } switch (RequestActionString) { case "update": if (!string.IsNullOrEmpty(JsonString)) { ImgNews tempEnt = JsonHelper.GetObject <ImgNews>(JsonString); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(JsonString); DataHelper.MergeData <ImgNews>(ent, tempEnt, dic.Keys); ent.SaveAndFlush(); } else { ent = GetMergedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.SaveAndFlush(); if (RequestData["param"] + "" == "tj") { PageState.Add("rtnId", ent.Id); } } SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case "create": ent = this.GetPostedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.CreateId = UserInfo.UserID; ent.CreateName = UserInfo.Name; ent.CreateTime = DateTime.Now; ent.State = "0"; ent.CreateAndFlush(); if (RequestData["param"] + "" == "tj") { //ent.State = "1"; //提交流程 PageState.Add("rtnId", ent.Id); } SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case "ImportFile": string fileIds = RequestData.Get <string>("fileIds"); if (!string.IsNullOrEmpty(fileIds)) { sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0"; sql = string.Format(sql, fileIds); PageState.Add("Result", DataHelper.QueryDictList(sql)); } break; case "autoexecute": Task[] tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId")); if (tasks.Length == 0) { System.Threading.Thread.Sleep(1000); tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId")); } if (tasks.Length > 0) { this.PageState.Add("TaskId", tasks[0].ID); string AuditUserId = RequestData.Get <string>("AuditUserId"); string AuditUserName = RequestData.Get <string>("AuditUserName"); if (!string.IsNullOrEmpty(AuditUserId)) { Aim.WorkFlow.WorkFlow.AutoExecute(tasks[0], new string[] { AuditUserId, AuditUserName }); } else { PageState.Add("error", "自动提交申请人失败,请手动提交"); } } else { PageState.Add("error", "自动提交申请人失败,请手动提交"); } break; case "submitfinish": string ApproveResult = RequestData.Get <string>("ApproveResult"); ent = ImgNews.Find(id); ent.WFState = "End"; ent.WFResult = ApproveResult; ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; if (ApproveResult == "同意") { ent.State = "2"; } ent.PostTime = DateTime.Now; ent.Update(); break; case "submit": StartFlow(id); break; default: DoSelect(); break; } }
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, ent == null ? 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")); //2 如果是带有图片的发布的院内新闻,需经宣传部审批 取该部门下的角色 且名称是'部门正职', '部门副职', '部门领导' 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 = ImgNews.Find(id); typeid = ent.TypeId; //详细列表数据 PageState.Add("DetailList", ImgNewDetail.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, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); typeid = RequestData.Get <string>("TypeId"); ImgNews ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.SaveAndFlush(); SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <ImgNews>(); 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); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Delete: ent = this.GetTargetData <ImgNews>(); ent.DeleteAndFlush(); this.SetMessage("删除成功!"); return; 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 = ImgNews.Find(id); typeid = ent.TypeId; //详细列表数据 PageState.Add("DetailList", ImgNewDetail.FindAllByProperty("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); }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); string link = RequestData.Get <string>("link"); typeId = RequestData.Get <string>("TypeId", String.Empty); ImgNews ent = null; switch (this.RequestAction) { case RequestActionEnum.Delete: ent = this.GetTargetData <ImgNews>(); ent.Delete(); this.SetMessage("删除成功!"); break; case RequestActionEnum.Custom: if (this.RequestActionString.ToLower() == "submitnews") { ImgNews ne = ImgNews.Find(this.RequestData["Id"].ToString()); ne.State = this.RequestData["state"].ToString(); ne.Save(); if (this.RequestData["state"].ToString() == "1") { PageState.Add("message", "提交成功"); } else { PageState.Add("message", "收回成功"); } return; } else if (RequestActionString == "batchdelete") { DoBatchDelete(); } break; default: if (link == "home") { string path = DataHelper.QueryValue("select g.Path from SysGroup g inner join sysusergroup ug on ug.GroupId=g.GroupId where UserId='" + UserInfo.UserID + "'") + ""; string sql = @"select n.* from ImgNews n inner join NewsType nt on nt.Id=n.TypeId where TypeId='{2}' and State='2' and isnull(ExpireTime,'2099-01-01')>=getdate() and (charindex('{0}',n.CreateId)>0 or charindex('{0}',n.ReceiveUserId)>0 or charindex('{0}',nt.AllowQueryId)>0 or exists (select Id from Competence c where c.Ext1=n.Id and charindex(PId,'{1}')>0) or exists (select Id from Competence c where c.Ext1=nt.Id and charindex(PId,'{1}')>0))"; sql = string.Format(sql, UserInfo.UserID, path, typeId); PageState.Add("DataList", GetPageData(sql, SearchCriterion)); } else { string where = " and isnull(ExpireTime,'2099-01-01')>=getdate() "; if (RequestData.Get <string>("Expire") == "true") { where = " and isnull(ExpireTime,'2099-01-01')<getdate() "; } foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { default: where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; break; } } } SearchCriterion.SetSearch("TypeId", typeId); ents = ImgNews.FindAll(SearchCriterion, Expression.Sql(" CreateId = '" + UserInfo.UserID + "' " + where)).OrderByDescending(o => o.CreateTime).ToArray(); this.PageState.Add("DataList", ents); } break; } if (!IsAsyncRequest) { NewsType[] types = NewsType.FindAll(); Dictionary <string, string> dt = new Dictionary <string, string>(); foreach (NewsType type in types) { dt.Add(type.Id, type.TypeName); } this.PageState.Add("EnumType", dt); } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); typeId = RequestData.Get <string>("TypeId", String.Empty); ImgNews ent = null; switch (this.RequestAction) { case RequestActionEnum.Delete: ent = this.GetTargetData <ImgNews>(); ent.Delete(); break; case RequestActionEnum.Custom: //启动流程 if (this.RequestActionString.ToLower() == "startflow") { ImgNews ne = ImgNews.Find(this.RequestData["Id"].ToString()); //启动流程 string key = "NewsPub"; //表单路径,后面加上参数传入 string formUrl = "/Modules/PubNews/NewsEdit.aspx?op=u&&Id=" + ne.Id; Aim.WorkFlow.WorkFlow.StartWorkFlow(ne.Id, formUrl, ne.Title, key, this.UserInfo.UserID, this.UserInfo.Name); PageState.Add("message", "启动成功"); return; } else if (RequestActionString == "batchdelete") { DoBatchDelete(); } else if (this.RequestActionString.ToLower() == "submitnews") { ImgNews ne = ImgNews.Find(this.RequestData["Id"].ToString()); ne.PostTime = DateTime.Now; ne.State = this.RequestData["state"].ToString(); string state = this.RequestData["state"] + ""; if (state == "2") { ne.PostUserId = UserInfo.UserID; ne.PostUserName = UserInfo.Name; ne.PostTime = DateTime.Now; PageState.Add("message", "发布成功"); } else if (state == "0") { PageState.Add("message", "退回成功"); } else { ne.PostUserId = ""; ne.PostUserName = ""; ne.PostTime = null; PageState.Add("message", "撤销成功"); } ne.Save(); return; } break; default: string where = " and isnull(ExpireTime,'2099-01-01')>=getdate() "; if (RequestData.Get <string>("Expire") == "true") { where = " and isnull(ExpireTime,'2099-01-01')<getdate() "; } foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { default: where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; break; } } } SearchCriterion.SetSearch("TypeId", typeId); ents = ImgNews.FindAll(SearchCriterion, Expression.Sql(" (State='1' or State='2') " + where)).OrderByDescending(o => o.CreateTime).ToArray(); this.PageState.Add("DataList", ents); break; } if (!IsAsyncRequest) { NewsType[] types = NewsType.FindAll(); Dictionary <string, string> dt = new Dictionary <string, string>(); foreach (NewsType type in types) { dt.Add(type.Id, type.TypeName); } this.PageState.Add("EnumType", dt); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (context.Request["opera"] == "batchcollection") { string Id = context.Request["id"]; if (!string.IsNullOrEmpty(Id)) { //收藏 try { //object[] pram = { new SqlParameter("MsgId", RequestData["Id"]), new SqlParameter("UserId", UserInfo.UserID) }; CollectionToUser[] Ctus = CollectionToUser.FindAll("from CollectionToUser where MsgId='" + Id + "' and UserId='" + UserInfo.UserID + "'"); if (Ctus.Length == 0) { CollectionToUser Ctu = new CollectionToUser(); Ctu.MsgId = Id + ""; Ctu.UserId = UserInfo.UserID; Ctu.CreateId = UserInfo.UserID; Ctu.CreateName = UserInfo.Name; Ctu.DoSave(); context.Response.Write("已收藏"); } else { CollectionToUser.DoBatchDelete(Ctus[0].Id); context.Response.Write("已取消收藏"); } } catch (Exception ex) { context.Response.Write(ex.Message); } } } else if (context.Request["opera"] == "readstate") { string Id = context.Request["id"]; if (!string.IsNullOrEmpty(Id)) { try { ImgNews news = ImgNews.TryFind(Id); if (news != null) { if ((news.Ext2 + "").Contains(UserInfo.UserID)) { return; } news.Ext2 += UserInfo.UserID; news.DoUpdate(); context.Response.Write("标记成功!"); } } catch (Exception ex) { context.Response.Write(ex.Message); } } } }