예제 #1
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            sys_workgroup pageGroup = AssembleModel <sys_workgroup>();

            if (!string.IsNullOrEmpty(Request.Form["isActive"]) && Request.Form["isActive"] == "on")
            {
                pageGroup.status_id = 1;
            }
            else
            {
                pageGroup.status_id = 0;
            }

            if (!isAdd)
            {
                thisGroup.name        = pageGroup.name;
                thisGroup.status_id   = pageGroup.status_id;
                thisGroup.description = pageGroup.description;
            }
            var result = false;

            if (isAdd)
            {
                result = userBll.AddGroup(pageGroup, LoginUserId);
            }
            else
            {
                result = userBll.EditGroup(thisGroup, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');window.close();</script>");
        }
예제 #2
0
        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);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 新增工作组
        /// </summary>
        public bool AddGroup(sys_workgroup group, long userId)
        {
            sys_workgroup_dal swDal = new sys_workgroup_dal();

            group.id             = swDal.GetNextIdCom();
            group.create_time    = group.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            group.create_user_id = group.update_user_id = userId;
            swDal.Insert(group);
            OperLogBLL.OperLogAdd <sys_workgroup>(group, group.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SYS_WORKGROUP, "");
            return(true);
        }
예제 #4
0
        /// <summary>
        /// 编辑工作组
        /// </summary>
        public bool EditGroup(sys_workgroup group, long userId)
        {
            sys_workgroup_dal swDal = new sys_workgroup_dal();
            var oldGroup            = swDal.FindNoDeleteById(group.id);

            if (oldGroup == null)
            {
                return(false);
            }
            group.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            group.update_user_id = userId;
            swDal.Update(group);
            OperLogBLL.OperLogUpdate <sys_workgroup>(group, oldGroup, group.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SYS_WORKGROUP, "");
            return(true);
        }
예제 #5
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);
            }
        }