コード例 #1
0
    /// <summary>
    /// US:864 US:876 loads a dropdown list with patient checklists, will screen out
    /// check lists that the user does not have view permissions for.
    /// </summary>
    /// <param name="BaseMastr"></param>
    /// <param name="strPatientID"></param>
    /// <param name="ddl"></param>
    /// <returns></returns>
    public CStatus LoadPatientChecklists(CBaseMaster BaseMstr, string strPatientID, DropDownList ddl)
    {
        CPatientChecklistLogic pcl = new CPatientChecklistLogic(BaseMstr.BaseData);
        CStatus status             = pcl.RunLogic(strPatientID);

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

        CPatChecklistData pc = new CPatChecklistData(BaseMstr.BaseData);
        DataSet           ds = null;

        status = pc.GetPatChecklistDS(strPatientID, out ds);
        if (!status.Status)
        {
            return(status);
        }

        //remove records from the ds that the user is not allowed to view
        foreach (DataTable table in ds.Tables)
        {
            foreach (DataRow dr in table.Rows)
            {
                long lChecklistID = CDataUtils.GetDSLongValue(dr, "CHECKLIST_ID");

                CChecklistPermissionsDataItem pdi = null;
                CChecklistData clData             = new CChecklistData(BaseMstr.BaseData);
                clData.GetCheckListPermissionsDI(lChecklistID, out pdi);

                //is the user allowed to view this checklist
                if (!pdi.HasPermission(BaseMstr.AppUser, k_CHECKLIST_PERMISSION.Viewable))
                {
                    dr.Delete();
                }
            }
        }
        ds.AcceptChanges();

        //render the dataset
        status = CDropDownList.RenderDataSet(
            ds,
            ddl,
            "CHECKLIST_LABEL",
            "PAT_CL_ID");
        if (!status.Status)
        {
            return(status);
        }

        return(new CStatus());
    }
コード例 #2
0
    /// <summary>
    /// US:864 US:876 gets a loaded checklist permissions data item
    /// </summary>
    /// <param name="lCheckListID"></param>
    /// <param name="cli"></param>
    /// <returns></returns>
    public CStatus GetCheckListPermissionsDI(long lCheckListID,
                                             out CChecklistPermissionsDataItem cli)
    {
        //initialize parameters
        cli = new CChecklistPermissionsDataItem();

        //create a status object and check for valid dbconnection
        CStatus status = DBConnValid();

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

        //get the viewable roles
        DataSet dsViewable = null;

        status = GetCLViewableRolesDS(lCheckListID, out dsViewable);

        //get the readonly roles
        DataSet dsReadOnly = null;

        status = GetCLReadOnlyRolesDS(lCheckListID, out dsReadOnly);

        //get the closeable roles
        DataSet dsCloseable = null;

        status = GetCLCloseableRolesDS(lCheckListID, out dsCloseable);

        //get the TIU roles
        DataSet dsTIU = null;

        status = GetCLTIURolesDS(lCheckListID, out dsTIU);

        //

        //load the dataitem from the datasets
        status = cli.LoadRoles(dsViewable, dsReadOnly, dsCloseable, dsTIU);

        return(status);
    }
コード例 #3
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)
                            {
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #4
0
    /// <summary>
    /// US:864 US:876 sets UI permssions based on the users role
    /// </summary>
    public void SetPermissions(bool bHasNoteTitle)
    {
        //do permissions work
        CChecklistPermissionsDataItem pdi = null;
        CChecklistData clData             = new CChecklistData(BaseMstr.BaseData);
        CStatus        status             = clData.GetCheckListPermissionsDI(ChecklistID, out pdi);

        if (!status.Status)
        {
            ddlChecklistState.Enabled = false;
            btnSaveCL.Enabled         = false;
            ddlChecklistState.Enabled = false;
            tbProcedureDate.Enabled   = false;
            calProcedureDate.Enabled  = false;
            ucProcedureTime.Enabled   = false;
            ShowStatusInfo(status);
            return;
        }

        //does the user have read only permissions to this checklist
        if (pdi.HasPermission(BaseMstr.AppUser, k_CHECKLIST_PERMISSION.ReadOnly))
        {
            ddlChecklistState.Enabled = false;
            btnSaveCL.Enabled         = false;
            ddlChecklistState.Enabled = false;
            tbProcedureDate.Enabled   = false;
            calProcedureDate.Enabled  = false;
            ucProcedureTime.Enabled   = false;
        }
        else
        {
            ddlChecklistState.Enabled = (ChecklistStateID == k_CHECKLIST_STATE_ID.Open) ? true : false;
            btnSaveCL.Enabled         = true;
            btnTIU.Enabled            = true;

            ddlChecklistState.Enabled = true;
            tbProcedureDate.Enabled   = true;
            calProcedureDate.Enabled  = true;
            ucProcedureTime.Enabled   = true;

            //do not allow the user to edit a closed checklist.
            if (ChecklistStateID == k_CHECKLIST_STATE_ID.Closed)
            {
                ddlChecklistState.Enabled = false;
                tbProcedureDate.Enabled   = false;
                calProcedureDate.Enabled  = false;
                ucProcedureTime.Enabled   = false;
                btnTIU.Enabled            = false;
                //btnSaveCL.Enabled = false;
            }
        }

        EnableTIU();

        //is the user allowed to close this checklist
        if (!pdi.HasPermission(BaseMstr.AppUser, k_CHECKLIST_PERMISSION.Closeable))
        {
            ddlChecklistState.Enabled = false;
        }

        //does the user have permission to write a note for this checklist
        if (bHasNoteTitle &&
            !pdi.HasPermission(BaseMstr.AppUser, k_CHECKLIST_PERMISSION.TIUNote))
        {
            btnTIU.Enabled = false;
        }
    }