public static bool Delete(Right right) { const string sql = @" DELETE FROM T_RIGHT WHERE SYSID=@Sysid "; return Dapper.Save(right, sql); }
public static bool DeleteByFunctionSysid(Right right, SqlConnection conn, SqlTransaction trans) { const string sql = @" DELETE FROM T_RIGHT WHERE FUNCTION_SYSID=@FunctionSysid "; return Dapper.Save(right, sql, conn, trans); }
public static bool UpdateRight(Right right, out string msg) { if (!RightDal.Update(right)) { msg = "修改失败"; return false; } msg = "修改成功"; return true; }
public static bool InsertRight(Right right, out string msg) { if (!RightDal.Insert(right)) { msg = "新增失败"; return false; } msg = "新增成功"; return true; }
public static bool Insert(Right right) { const string sql = @" INSERT INTO T_RIGHT(SYSID,USER_GROUP_SYSID,FUNCTION_GROUP_SYSID,FUNCTION_SYSID,COMMAND_SYSID,CREATED_ON,CREATED_BY) VALUES(@Sysid,@UserGroupSysid,@FunctionGroupSysid,@FunctionSysid,@CommandSysid,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy) "; return Dapper.Save(right, sql); }
public static bool DeleteByUserGroupSysid(Right right, SqlConnection conn, SqlTransaction trans) { const string sql = @" DELETE FROM T_RIGHT WHERE USER_GROUP_SYSID=@UserGroupSysid "; return Dapper.Save(right, sql, conn, trans); }
public static bool Update(Right right, SqlConnection conn, SqlTransaction trans) { const string sql = @" UPDATE T_RIGHT SET USER_GROUP_SYSID=@UserGroupSysid,FUNCTION_GROUP_SYSID=@FunctionGroupSysid,FUNCTION_SYSID=@FunctionSysid,COMMAND_SYSID=@CommandSysid,CREATED_BY=@CreatedBy WHERE SYSID=@Sysid "; return Dapper.Save(right, sql, conn, trans); }
public static bool DeleteRight(Right right) { return RightDal.Delete(right); }
//用编辑框数据填充实体 /// <summary> /// 用编辑框数据填充实体 /// </summary> private List<Right> BuildEntity() { var rights = new List<Right>(); var userGroupSysid = UI.GetValue(ddlUserGroup); foreach (var groupNode in treeRight.Nodes) { foreach (var functionNode in groupNode.Nodes) { foreach (var commandNode in functionNode.Nodes) { if (!commandNode.Checked) continue; var rightMenu = commandNode.Tag as RightMenu; if (rightMenu == null) continue; var right = new Right { Sysid = Sysid.NewId(""), UserGroupSysid = userGroupSysid, FunctionGroupSysid = rightMenu.GroupSysid, FunctionSysid = rightMenu.FunctionSysid, CommandSysid = rightMenu.CommandSysid, CreatedBy = GloableData.Instance.UserId }; rights.Add(right); } } } return rights; }