/// <summary>
 /// 如果资源是已绑定的操作,则选中
 /// </summary>
 private void SelectingOperate()
 {
     IList<Owen.Model.Model_Privilege> list = new Owen.BLL.BLL_Privilege().GetEntities(
         string.Format(" resourceId = {0} ", resourceId));
     foreach (var v in list)
     {
         //选择
         foreach (ListItem li in this.cblOperate.Items)
         {
             if (v.OperateID.ToString().Equals(li.Value))
             {
                 li.Selected = true;
             }
         }
     }
 }
        /// <summary>
        /// 删除
        /// </summary>
        public bool Delete(int resourceId)
        {
            bool b = false;
            using (TransactionScope tranScope = new TransactionScope())
            {
                //先查询Resource表
                DataTable tableResource = dataFactory.ResourceDal.QueryOperateResourceId(resourceId);
                string rIDs = string.Empty;
                int rCount = tableResource.Rows.Count;
                for (int i = 0; i < rCount; i++)
                {
                    rIDs += tableResource.Rows[i]["ResourceID"].ToString();
                    if (i != rCount - 1)
                    {
                        rIDs += ",";
                    }

                }

                //删除授权表Authorize相关数据
                DataTable table = new BLL_Privilege().QueryDataResourceId(rIDs);
                foreach (DataRow r in table.Rows)
                {
                    int privilegeID = Convert.ToInt32(r["PrivilegeID"].ToString());
                    new BLL_RolesAuthorize().DeleteEntity(privilegeID);
                }

                //先删除该页面的所有操作
                new BLL_Privilege().DeleteEntity(rIDs);

                //删除资源 
                dataFactory.ResourceDal.DeleteEntity(resourceId);


                tranScope.Complete();
                b = true;

            }
            return b;
        }