示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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);
        }