Beispiel #1
0
    /// <summary>
    /// US:865 gets a checklist item permission data item
    /// </summary>
    /// <param name="lChecklistID"></param>
    /// <param name="lItemID"></param>
    /// <param name="diPermissions"></param>
    /// <returns></returns>
    public CStatus GetCLPermissionItem(
        long lChecklistID,
        long lItemID,
        out CChecklistItemPermissionsDataItem diPermissions)
    {
        diPermissions = new CChecklistItemPermissionsDataItem();
        DataSet dsRoles = null;
        CStatus status  = GetCLItemDSRolesDS(
            lChecklistID,
            lItemID,
            out dsRoles);

        if (!status.Status)
        {
            return(status);
        }

        status = diPermissions.LoadRoles(dsRoles);

        return(status);
    }
Beispiel #2
0
    /// <summary>
    /// US:865 sets UI permssions based on the users role
    /// </summary>
    public void SetPermissions()
    {
        //do permissions work
        CChecklistPermissionsDataItem pdi = null;
        CChecklistData clData             = new CChecklistData(BaseMstr.BaseData);

        clData.GetCheckListPermissionsDI(ChecklistID, out pdi);

        //does the user have read only permissions to this checklist
        if (pdi.HasPermission(BaseMstr.AppUser, k_CHECKLIST_PERMISSION.ReadOnly))
        {
            foreach (GridViewRow gr in gvPatCLItems.Rows)
            {
                Button btnOR = (Button)gr.FindControl("btnOverride");
                if (btnOR != null)
                {
                    btnOR.Enabled = false;
                }

                Button btnED = (Button)gr.FindControl("btnEdit");
                if (btnED != null)
                {
                    btnED.Enabled = false;
                }
            }
        }
        else
        {
            //loop over the items and determine if the user is allowed to override
            //decision state for each item
            foreach (GridViewRow gr in gvPatCLItems.Rows)
            {
                if (gvPatCLItems.DataKeys[gr.RowIndex].Value != null)
                {
                    //get the item id
                    long lItemID = Convert.ToInt32(gvPatCLItems.DataKeys[gr.RowIndex].Value);

                    //load a item permissions data item
                    CChecklistItemPermissionsDataItem pi = null;
                    CChecklistItemData cli    = new CChecklistItemData(BaseMstr.BaseData);
                    CStatus            status = new CStatus();
                    status = cli.GetCLPermissionItem(ChecklistID,
                                                     lItemID,
                                                     out pi);
                    if (status.Status)
                    {
                        if (!pi.HasPermission(BaseMstr.AppUser,
                                              k_CHECKLIST_PERMISSION.DSOverride))
                        {
                            Button btnOR = (Button)gr.FindControl("btnOverride");
                            if (btnOR != null)
                            {
                                btnOR.Enabled = false;
                            }

                            Button btnED = (Button)gr.FindControl("btnEdit");
                            if (btnED != null)
                            {
                            }
                        }
                    }
                }
            }
        }
    }