Exemple #1
0
        public void StartFlow(string formId)
        {
            VideoNews ent     = VideoNews.Find(formId);
            string    code    = "ImgNewsAudit";
            string    formUrl = "/Modules/PubNews/VideoNews/FrmVideoNewsCreateEdit.aspx?op=u&id=" + formId;
            Guid      guid    = Aim.WorkFlow.WorkFlow.StartWorkFlow(formId, formUrl, "信息发布【" + ent.Title + "】申请人【" + ent.CreateName + "】", code, ent.CreateId, ent.CreateName);

            //返回流程的Id
            this.PageState.Add("FlowId", guid.ToString());
            ent.WFState  = "Flowing";
            ent.WFResult = "";
            ent.Save();
        }
        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);

            VideoNews ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <VideoNews>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                if (this.RequestActionString.ToLower() == "submitnews")
                {
                    VideoNews ne = VideoNews.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 VideoNews 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 = VideoNews.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);
            }
        }
Exemple #3
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);
            }
        }
Exemple #4
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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            op     = RequestData.Get <string>("op");
            typeId = RequestData.Get <string>("TypeId", String.Empty);

            VideoNews ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <VideoNews>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                //启动流程
                if (this.RequestActionString.ToLower() == "startflow")
                {
                    VideoNews ne = VideoNews.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")
                {
                    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();
                    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 = VideoNews.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);
            }
        }
        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();
            }
        }
Exemple #7
0
        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 = VideoNews.Find(id);
            }
            switch (RequestActionString)
            {
            case "update":
                if (!string.IsNullOrEmpty(JsonString))
                {
                    VideoNews      tempEnt = JsonHelper.GetObject <VideoNews>(JsonString);
                    EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(JsonString);
                    DataHelper.MergeData <VideoNews>(ent, tempEnt, dic.Keys);
                    ent.SaveAndFlush();
                }
                else
                {
                    ent = this.GetMergedData <VideoNews>();
                    ent.HomePagePopup = RequestData.Get <string>("HomePagePopup");
                    ent.SaveAndFlush();
                    if (RequestData["param"] + "" == "tj")
                    {
                        PageState.Add("rtnId", ent.Id);
                    }
                }
                SaveDetail(ent.Id, ent.ShowImg);
                InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName);
                break;

            case "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         = "0";
                ent.CreateAndFlush();
                if (RequestData["param"] + "" == "tj")
                {
                    PageState.Add("rtnId", ent.Id);
                }
                SaveDetail(ent.Id, ent.ShowImg);
                InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName);
                break;

            case "submit":
                StartFlow(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 "submitfinish":
                string ApproveResult = RequestData.Get <string>("ApproveResult");
                ent              = VideoNews.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 "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));
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Exemple #8
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, 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);
        }
Exemple #9
0
        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);
        }