Exemplo n.º 1
0
        //private OrgAccess[] _orgAccess = null;
        public static Role GetRole(MRole role)
        {
            Role r = new Role();

            r.IsAccessAllOrgs     = role.IsAccessAllOrgs();
            r.IsAdministrator     = role.IsAdministrator();
            r.AD_Client_ID        = role.GetAD_Client_ID();
            r.AD_User_ID          = role.GetAD_User_ID();
            r.UserLevel           = role.GetUserLevel();
            r.IsCanExport         = role.IsCanExport();
            r.IsCanReport         = role.IsCanReport();
            r.IsUseBPRestrictions = role.IsUseBPRestrictions();
            r.IsPersonalAccess    = role.IsPersonalAccess();
            r.Name             = role.GetName();
            r.IsShowPreference = role.IsShowPreference();
            r.PreferenceType   = role.GetPreferenceType();

            r.IsDisplayClient        = role.IsDisplayClient();
            r.IsDisplayOrg           = role.IsDisplayOrg();
            r.IsPersonalLock         = role.IsPersonalLock();
            r.IsOverwritePriceLimit  = role.IsOverwritePriceLimit();
            r.IsOverrideReturnPolicy = role.IsOverrideReturnPolicy();

            r.tableAccessLevel = role.GetTableAccessLevel();
            r.tableName        = role.GetTableNames();
            r.orgAccess        = role.GetOrgAccess();
            r.windowAccess     = role.GetWindowAccess();
            r.formAccess       = role.GetFormAccess();
            r.processAccess    = role.GetProcessAccess();

            r.tableAccess           = TableAccess.Get(role.GetTableAccess());
            r.columnAccess          = ColumnAccess.Get(role.GetColumnAccess());
            r.recordAccess          = RecordAccess.Get(role.GetRecordAccess());
            r.recordDependentAccess = RecordAccess.Get(role.GetRecordDependentAccess());

            r.MaxQueryRecords = role.GetMaxQueryRecords();
            r.IsShowAcct      = role.IsShowAcct();
            r.IsDisableMenu   = role.IsDisableMenu();
            r.HomePage        = role.GetHomePage_ID();

            /* Prepare Pre Setting of Table*/

            r.tableData = TableData.Get();


            return(r);
        }
Exemplo n.º 2
0
        /// <summary>
        /// set node properties
        /// </summary>
        /// <param name="Node_ID">node key id</param>
        /// <param name="Parent_ID">parent node id</param>
        /// <param name="seqNo">seq no</param>
        /// <param name="onBar">node in favorite tree</param>
        /// <returns>VTreeNode </returns>

        private VTreeNode GetNodeDetail(int Node_ID, int Parent_ID, int seqNo, bool onBar)
        {
            int AD_Window_ID    = 0;
            int AD_Process_ID   = 0;
            int AD_Form_ID      = 0;
            int AD_Workflow_ID  = 0;
            int AD_Task_ID      = 0;
            int AD_Workbench_ID = 0;

            VTreeNode retValue = null;

            string strColumnName = "";

            if (treeType == TreeType.MM)
            {
                strColumnName = "Ad_Menu_Id";
            }
            else
            {
                strColumnName = "Ad_ORG_ID";
            }

            // Serch For Node details
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int node1 = Utility.Util.GetValueOfInt(dt.Rows[i][0].ToString());
                if (Node_ID != node1)   //	search for correct one
                {
                    continue;
                }
                DataRow dr = dt.Rows[i];

                int node  = Utility.Util.GetValueOfInt(dr[0].ToString());
                int index = 1;

                string name        = dr[index++].ToString();
                string description = dr[index++].ToString();
                bool   isSummary   = "Y".Equals(dr[index++].ToString());
                string actionColor = "";
                //	Menu only
                //if (getTreeType().equals(TREETYPE_Menu) && !isSummary)
                if (!isSummary)
                {
                    bool?blnAccess = null;
                    if (treeType == TreeType.MM)
                    {
                        actionColor  = dr[index++].ToString();
                        AD_Window_ID = (dr[index].ToString().Trim() == "") ? 0 : Utility.Util.GetValueOfInt(dr[index].ToString());
                        index++;
                        AD_Process_ID = (dr[index].ToString().Trim() == "") ? 0 : Utility.Util.GetValueOfInt(dr[index].ToString());
                        index++;
                        AD_Form_ID = (dr[index].ToString().Trim() == "") ? 0 : Utility.Util.GetValueOfInt(dr[index].ToString());
                        index++;
                        AD_Workflow_ID = (dr[index].ToString().Trim() == "") ? 0 : Utility.Util.GetValueOfInt(dr[index].ToString());
                        index++;
                        AD_Task_ID = (dr[index].ToString().Trim() == "") ? 0 : Utility.Util.GetValueOfInt(dr[index].ToString());
                        index++;
                        AD_Workbench_ID = (dr[index].ToString().Trim() == "") ? 0 : Utility.Util.GetValueOfInt(dr[index].ToString());
                        index++;
                        MRole role = MRole.GetDefault(ctx);
                        if (VTreeNode.ACTION_WINDOW.Equals(actionColor))
                        {
                            blnAccess = role.GetWindowAccess(AD_Window_ID);
                        }
                        else if (VTreeNode.ACTION_PROCESS.Equals(actionColor) ||
                                 VTreeNode.ACTION_REPORT.Equals(actionColor))
                        {
                            blnAccess = role.GetProcessAccess(AD_Process_ID);
                        }
                        else if (VTreeNode.ACTION_FORM.Equals(actionColor))
                        {
                            blnAccess = role.GetFormAccess(AD_Form_ID);
                        }
                        else if (VTreeNode.ACTION_WORKFLOW.Equals(actionColor))
                        {
                            blnAccess = role.GetWorkflowAccess(AD_Workflow_ID);
                        }
                        else if (VTreeNode.ACTION_TASK.Equals(actionColor))
                        {
                            blnAccess = role.GetTaskAccess(AD_Task_ID);
                        }
                    }
                    if (blnAccess != null || _editable)         //	rw or ro for Role
                    {
                        retValue = new VTreeNode(Node_ID, seqNo,
                                                 name, description, Parent_ID, isSummary,
                                                 actionColor, onBar); //	menu has no color
                    }
                }
                else
                {
                    retValue = new VTreeNode(Node_ID, seqNo,
                                             name, description, Parent_ID, isSummary,
                                             actionColor, onBar);
                }
                break;
            }

            if (retValue != null && treeType == TreeType.MM)
            {
                // set VTreeNode ID's
                retValue.AD_Window_ID    = AD_Window_ID;
                retValue.AD_Process_ID   = AD_Process_ID;
                retValue.AD_Form_ID      = AD_Form_ID;
                retValue.AD_Workflow_ID  = AD_Workflow_ID;
                retValue.AD_Task_ID      = AD_Task_ID;
                retValue.AD_Workbench_ID = AD_Workbench_ID;
            }
            return(retValue);
        }