private void EventSelectUser(string target)
    {
        if (target == "BtnSelectUser")
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            int arg = WebParmKit.GetFormValue("__EVENTARGUMENT", 0);
            if (arg > 0)
            {
                var user = new SysUserInfoBus().QueryModel("Id=" + arg);

                var l = _selectedUserList;

                if (user != null)
                {
                    bool contain = (from a in l where a.Id == user.Id select a).Count() > 0;
                    if (!contain)
                    {
                        l.Add(user);

                        _selectedUserList = l;
                        BindSelectedList();
                    }
                }
            }
            sw.Stop();
            Logger.Debug("BtnSelectUser:"******"ms");
        }
    }
Beispiel #2
0
    private void EventProcess()
    {
        string target   = WebParmKit.GetFormValue("__EVENTTARGET", "");
        string argument = WebParmKit.GetFormValue("__EVENTARGUMENT", "");

        switch (target)
        {
        case "addOrg":
            if (this.CurrentUserInfo.Sn == "319ccd97-9af5-4eaf-9316-8ef9af273915" ||
                this.CurrentUserInfo.Sn == "5105d065-40a8-482a-baa2-5c9829cbe93f")
            {
                SysLinkUserOrgBus ubus    = new SysLinkUserOrgBus();
                string[]          orgArgs = argument.Split(',');
                foreach (string arg in orgArgs)
                {
                    ubus.Insert(new SysLinkUserOrg()
                    {
                        UserId = Convert.ToInt32(this.Id.Value),
                        OrgId  = int.Parse(arg)
                    });
                }
                BindOrgList();
            }
            else
            {
                this.Alert("用户权限不足,请联系管理员处理。");
                return;
            }
            break;

        case "addRole":
            if (this.CurrentUserInfo.Sn == "319ccd97-9af5-4eaf-9316-8ef9af273915" ||
                this.CurrentUserInfo.Sn == "5105d065-40a8-482a-baa2-5c9829cbe93f")
            {
                SysLinkUserRoleBus rbus     = new SysLinkUserRoleBus();
                string[]           roleArgs = argument.Split(',');
                foreach (string arg in roleArgs)
                {
                    rbus.Insert(new SysLinkUserRole()
                    {
                        UserId = Convert.ToInt32(this.Id.Value),
                        RoleId = int.Parse(arg)
                    });
                }
                BindRoleList();
            }
            else
            {
                this.Alert("用户权限不足,请联系管理员处理。");
                return;
            }
            break;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.NPager1.PageSize = 20;

            BindOrgTree();
            BindUser();
        }

        this.NPager1.PageClick += (o, args) => {
            BindUser();
        };

        string target = WebParmKit.GetFormValue("__EVENTTARGET", "");

        EventSelectUser(target);
        EventDeleteSelected(target);
    }
    private void EventDeleteSelected(string target)
    {
        if (target == "BtnDeleteSelected")
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            int arg = WebParmKit.GetFormValue("__EVENTARGUMENT", 0);
            if (arg > 0)
            {
                var l    = this._selectedUserList;
                var user = (from a in l where a.Id == arg select a).FirstOrDefault();
                if (user != null)
                {
                    l.Remove(user);
                    this._selectedUserList = l;

                    BindSelectedList();
                }
            }
            sw.Stop();
            Logger.Debug("BtnDeleteSelected:" + sw.Elapsed.TotalMilliseconds + "ms");
        }
    }