コード例 #1
0
        private void SaveDetail(string PId)
        {
            IList <string>       entStrList = RequestData.GetList <string>("detail");
            IList <ImgNewDetail> ocdEnts    = ImgNewDetail.FindAllByProperty(ImgNewDetail.Prop_PId, ent.Id);

            foreach (ImgNewDetail ocdEnt in ocdEnts)
            {
                ocdEnt.DoDelete();
            }
            if (entStrList != null && entStrList.Count > 0)
            {
                ocdEnts = entStrList.Select(tent => JsonHelper.GetObject <ImgNewDetail>(tent) as ImgNewDetail).ToList();
                for (int i = 0; i < ocdEnts.Count; i++)
                {
                    ocdEnts[i].PId        = PId;
                    ocdEnts[i].CreateId   = UserInfo.UserID;
                    ocdEnts[i].CreateName = UserInfo.Name;
                    ocdEnts[i].CreateTime = DateTime.Now;
                    ocdEnts[i].DoCreate();
                    if (i == 0)
                    {
                        ent.ShowImg = ocdEnts[i].ImgPath;
                        ent.DoUpdate();
                    }
                }
            }
        }
コード例 #2
0
        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";
                }
            }
        }
コード例 #3
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);
            }
        }
コード例 #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);
        }