/// <summary>
 /// 新增数据
 /// </summary>
 /// <param name="RoleObj"></param>
 /// <returns></returns>
 public bool Add(tblMenu_Permission_Role tblMenu_Permission_RoleObj)
 {
     tblMenu_Permission_RoleObj.ID = System.Guid.NewGuid();
     string userHostAddress = HttpContext.Current.Request.UserHostAddress;
     int counts = 0;
     //插入数据
     try
     {
         using (MWDatabaseEntities MWDB = new MWDatabaseEntities())
         {
             MWDB.tblMenu_Permission_Role.AddObject(tblMenu_Permission_RoleObj);
             counts = MWDB.SaveChanges();
             if (counts > 0)
             {
                 DbLoggerBLL.SysLogger.Info("Increase menu and the role relationship successfully! ID: '"
                     + tblMenu_Permission_RoleObj.ID + "'. User host address: '"+ userHostAddress + "'");
                 return true;
             }
         }
     }
     catch (Exception ex)
     {
         DbLoggerBLL.SysLogger.Error("Increase menu and the role relationship failed! ID: '"
             + tblMenu_Permission_RoleObj.ID + "'. User host address: '" + userHostAddress + "' . Exception info"
             + ex.Message);
         return false;
     }
     return false;
 }
    protected void Save(string strRoleID)
    {
        if (strRoleID != string.Empty)
        {
            using (MWDatabaseEntities MWDB = new MWDatabaseEntities())
            {
                System.Guid gu = new Guid(strRoleID);
                tblRole objRole = MWDB.tblRole.First(r => r.RoleID == gu);
                if (objRole != null)
                {
                    MenuPermissionRoleBLL Menu_Permission_RoleBLLs = new MenuPermissionRoleBLL();
                    Menu_Permission_RoleBLLs.DeleteT(strRoleID);

                    IList<RadTreeNode> nodeCollection = RadTreeView_Rigth.CheckedNodes;
                    //删除
                    //循环选中的节点并获取值
                    foreach (RadTreeNode node in nodeCollection)
                    {
                        if (node.Value != string.Empty)
                        {
                            tblMenu_Permission_Role tblp = new tblMenu_Permission_Role();
                            System.Guid guMenuID = new Guid(node.Value);
                            tblp.MenuID = guMenuID;
                            tblp.RoleID = gu;
                            Menu_Permission_RoleBLLs.Add(tblp);
                        }
                    }
                }
            }
        }
    }
示例#3
0
 /// <summary>
 /// 创建新的 tblMenu_Permission_Role 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 public static tblMenu_Permission_Role CreatetblMenu_Permission_Role(global::System.Guid id)
 {
     tblMenu_Permission_Role tblMenu_Permission_Role = new tblMenu_Permission_Role();
     tblMenu_Permission_Role.ID = id;
     return tblMenu_Permission_Role;
 }
示例#4
0
 /// <summary>
 /// 用于向 tblMenu_Permission_Role EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTotblMenu_Permission_Role(tblMenu_Permission_Role tblMenu_Permission_Role)
 {
     base.AddObject("tblMenu_Permission_Role", tblMenu_Permission_Role);
 }