コード例 #1
0
    protected void gvUsers_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            lblFeedback.Text = "";

            if (gvUsers.SelectedValue != null)
            {
                string permissions = SystemUsers.GetUserPermissions(int.Parse(gvUsers.SelectedValue.ToString()));
                if (string.IsNullOrEmpty(permissions) || permissions.Length < 6)
                {
                    lblFeedback.Text = Feedback.NoData();
                }
                else
                {
                    // parse permissions
                    chkGeneralInfo.Checked = (permissions[0] == '1');
                    chkDistresses.Checked  = (permissions[1] == '1');

                    chkUDI.Checked            = (permissions[2] == '1');
                    chkMaintDecisions.Checked = (permissions[3] == '1');
                    chkMaintPrio.Checked      = (permissions[4] == '1');

                    chkSurveyingInfo.Checked = (permissions[5] == '1');
                    chkSystemAdmin.Checked   = (permissions[6] == '1');

                    chkReports.Checked    = (permissions[7] == '1');
                    chkOperations.Checked = (permissions[8] == '1');
                }
            }

            pnlUserDetails.Visible = (gvUsers.SelectedValue != null);
        }
        catch (Exception ex)
        {
            lblFeedback.Text = ex.Message;
        }
    }