private RoleResourceMapping SetRoleResource()
        {
            RoleResourceMapping currentRoleResource = new RoleResourceMapping();

            if (cbResource.SelectedValue != null)
            {
                currentRoleResource.Resource.Id = cbResource.SelectedValue.ToString();
            }
            else
            {
                currentRoleResource.Resource.Id = null;
            }

            if (nrbRight.Checked == true)
            {
                currentRoleResource.ValidState = "1";
            }
            else
            {
                currentRoleResource.ValidState = "0";
            }

            if (controlRoleResource == null)
            {
                currentRoleResource.ParentId = "root";

                PrivilegeService _proxy = Common.Util.CreateProxy();
                using (_proxy as IDisposable)
                {
                    currentRoleResource.OrderNumber = _proxy.QueryRoleResource(pageJudge, "root").Count;
                }
            }
            else
            {
                if (pageUpdate == JudgeOperate)
                {
                    currentRoleResource.ParentId    = controlRoleResource.ParentId;
                    currentRoleResource.OrderNumber = controlRoleResource.OrderNumber;
                }
                else
                {
                    currentRoleResource.ParentId = controlRoleResource.Id;

                    PrivilegeService _proxy = Common.Util.CreateProxy();
                    using (_proxy as IDisposable)
                    {
                        //为根节点默认当前的角色
                        if (controlRoleResource.Id == "root")
                        {
                            controlRoleResource.Role = currentRole;
                            controlRoleResource.Type = pageJudge;
                        }
                        currentRoleResource.OrderNumber = _proxy.QueryByTypeParentRole(controlRoleResource).Count;
                    }
                }
            }

            if (pageUpdate == JudgeOperate)
            {
                currentRoleResource.Role.ID = controlRoleResource.Role.ID;
                currentRoleResource.Id      = controlRoleResource.Id;
            }
            else
            {
                currentRoleResource.Role.ID = currentRole.ID;
                currentRoleResource.Id      = new FrameWork.Management.DataBaseManger().GetSequence("PRIV.SEQ_ROLE_RESOURCE");
            }
            currentRoleResource.Parameter = tbparameter.Text.Trim();
            currentRoleResource.Type      = pageJudge;
            currentRoleResource.Name      = tbTypeName.Text.Trim();
            currentRoleResource.OperCode  = Neusoft.FrameWork.Management.Connection.Operator.ID;
            currentRoleResource.OperDate  = FrameWork.Function.NConvert.ToDateTime(new FrameWork.Management.DataBaseManger().GetSysDateTime());

            if (cmbImage.SelectedIndex != -1)
            {
                currentRoleResource.Icon = cmbImage.SelectedIndex.ToString();
            }
            //if (cmbImage.Text == string.Empty)
            //{
            //    currentRoleResource.Icon = null;
            //}
            return(currentRoleResource);
        }