コード例 #1
0
ファイル: WorkgroupResource.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            long groupId = 0; long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                if (long.TryParse(Request.QueryString["id"], out id))
                {
                    thisGroupRes = userBll.GetGroupResource(id);
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["groupId"]))
            {
                if (long.TryParse(Request.QueryString["groupId"], out groupId))
                {
                    thisGroup = userBll.GetGroup(groupId);
                }
            }
            if (thisGroupRes != null)
            {
                isAdd     = false;
                thisGroup = userBll.GetGroup(thisGroupRes.workgroup_id);
            }
            if (thisGroup == null)
            {
                Response.Write("<script>alert('未获取到工作组信息');window.close();</script>");
                return;
            }
            groupResList = userBll.GetGroupResList(thisGroup.id);
            if (resList != null && resList.Count > 0)
            {
                if (thisGroupRes != null)
                {
                    resList = resList.Where(_ => _.is_active != 0 || _.id == thisGroupRes.resource_id).ToList();
                }
                else
                {
                    resList = resList.Where(_ => _.is_active != 0).ToList();
                }
            }

            if (groupResList != null && groupResList.Count > 0 && resList != null && resList.Count > 0)
            {
                foreach (var groupRes in groupResList)
                {
                    if (thisGroupRes != null && thisGroupRes.id == groupRes.id)
                    {
                        continue;
                    }
                    var thisRes = resList.FirstOrDefault(_ => _.id == groupRes.resource_id);
                    if (thisRes != null)
                    {
                        resList.Remove(thisRes);
                    }
                }
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                if (long.TryParse(Request.QueryString["id"], out id))
                {
                    thisGroup = userBll.GetGroup(id);
                }
            }
            if (thisGroup != null)
            {
                isAdd = false; groupResList = userBll.GetGroupResList(thisGroup.id);
            }
        }