mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-05-09 23:28:02 +08:00
常规优化
This commit is contained in:
parent
bb5a49abd1
commit
f0e0ec09ce
@ -4,7 +4,6 @@ using System.Data;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using LeaRun.Util.WebControl;
|
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.App.SSO;
|
using OpenAuth.App.SSO;
|
||||||
using OpenAuth.App.ViewModel;
|
using OpenAuth.App.ViewModel;
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using LeaRun.Util.WebControl;
|
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.App.SSO;
|
using OpenAuth.App.SSO;
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.Domain;
|
||||||
using OpenAuth.Mvc.Controllers;
|
using OpenAuth.Mvc.Controllers;
|
||||||
|
using OpenAuth.Mvc.WebCtrls.Tree;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,11 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using LeaRun.Util.WebControl;
|
|
||||||
using OpenAuth.App;
|
using OpenAuth.App;
|
||||||
using OpenAuth.App.ViewModel;
|
using OpenAuth.App.ViewModel;
|
||||||
using OpenAuth.Domain;
|
using OpenAuth.Domain;
|
||||||
using OpenAuth.Mvc.Models;
|
using OpenAuth.Mvc.Models;
|
||||||
|
using OpenAuth.Mvc.WebCtrls.Tree;
|
||||||
|
|
||||||
namespace OpenAuth.Mvc.Controllers
|
namespace OpenAuth.Mvc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -167,10 +167,6 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Models\AuthenticateAttribute.cs" />
|
<Compile Include="Models\AuthenticateAttribute.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="WebCtrls\AjaxResult.cs" />
|
|
||||||
<Compile Include="WebCtrls\GridTree\TreeGridEntity.cs" />
|
|
||||||
<Compile Include="WebCtrls\GridTree\TreeGridJson.cs" />
|
|
||||||
<Compile Include="WebCtrls\Pagination.cs" />
|
|
||||||
<Compile Include="WebCtrls\Tree\TreeEntity.cs" />
|
<Compile Include="WebCtrls\Tree\TreeEntity.cs" />
|
||||||
<Compile Include="WebCtrls\Tree\TreeJson.cs" />
|
<Compile Include="WebCtrls\Tree\TreeJson.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LeaRun.Util.WebControl
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 表示Ajax操作结果
|
|
||||||
/// </summary>
|
|
||||||
public class AjaxResult
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 获取 Ajax操作结果类型
|
|
||||||
/// </summary>
|
|
||||||
public ResultType type { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取 Ajax操作结果编码
|
|
||||||
/// </summary>
|
|
||||||
public int errorcode { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取 消息内容
|
|
||||||
/// </summary>
|
|
||||||
public string message { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取 返回数据
|
|
||||||
/// </summary>
|
|
||||||
public object resultdata { get; set; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 表示 ajax 操作结果类型的枚举
|
|
||||||
/// </summary>
|
|
||||||
public enum ResultType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 消息结果类型
|
|
||||||
/// </summary>
|
|
||||||
info = 0,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 成功结果类型
|
|
||||||
/// </summary>
|
|
||||||
success = 1,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 警告结果类型
|
|
||||||
/// </summary>
|
|
||||||
warning = 2,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 异常结果类型
|
|
||||||
/// </summary>
|
|
||||||
error = 3
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LeaRun.Util.WebControl
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 树表格实体
|
|
||||||
/// </summary>
|
|
||||||
public class TreeGridEntity
|
|
||||||
{
|
|
||||||
public string parentId { get; set; }
|
|
||||||
public string id { get; set; }
|
|
||||||
public string text { get; set; }
|
|
||||||
public string entityJson { get; set; }
|
|
||||||
public bool expanded { get; set; }
|
|
||||||
public bool hasChildren { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LeaRun.Util.WebControl
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 构造树形表格Json
|
|
||||||
/// </summary>
|
|
||||||
public static class TreeGridJson
|
|
||||||
{
|
|
||||||
public static int lft = 1, rgt = 1000000;
|
|
||||||
/// <summary>
|
|
||||||
/// 转换树形Json
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="list">数据源</param>
|
|
||||||
/// <param name="ParentId">父节点</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string TreeJson(List<TreeGridEntity> ListData, int index, string ParentId)
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
var ChildNodeList = ListData.FindAll(t => t.parentId == ParentId);
|
|
||||||
if (ChildNodeList.Count > 0) { index++; }
|
|
||||||
foreach (TreeGridEntity entity in ChildNodeList)
|
|
||||||
{
|
|
||||||
string strJson = entity.entityJson;
|
|
||||||
strJson = strJson.Insert(1, "\"level\":" + index + ",");
|
|
||||||
strJson = strJson.Insert(1, "\"isLeaf\":" + (entity.hasChildren == true ? false : true).ToString().ToLower() + ",");
|
|
||||||
strJson = strJson.Insert(1, "\"expanded\":" + (entity.expanded).ToString().ToLower() + ",");
|
|
||||||
strJson = strJson.Insert(1, "\"lft\":" + lft++ + ",");
|
|
||||||
strJson = strJson.Insert(1, "\"rgt\":" + rgt-- + ",");
|
|
||||||
sb.Append(strJson);
|
|
||||||
sb.Append(TreeJson(ListData, index, entity.id));
|
|
||||||
}
|
|
||||||
return sb.ToString().Replace("}{", "},{");
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 转换树形Json
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="list">数据源</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string TreeJson(this List<TreeGridEntity> ListData)
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.Append("{ \"rows\": [");
|
|
||||||
sb.Append(TreeJson(ListData, -1, "0"));
|
|
||||||
sb.Append("]}");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LeaRun.Util.WebControl
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 分页参数
|
|
||||||
/// </summary>
|
|
||||||
public class Pagination
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 每页行数
|
|
||||||
/// </summary>
|
|
||||||
public int rows { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 当前页
|
|
||||||
/// </summary>
|
|
||||||
public int page { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 排序列
|
|
||||||
/// </summary>
|
|
||||||
public string sidx { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 排序类型
|
|
||||||
/// </summary>
|
|
||||||
public string sord { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 总记录数
|
|
||||||
/// </summary>
|
|
||||||
public int records { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 总页数
|
|
||||||
/// </summary>
|
|
||||||
public int total
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (records > 0)
|
|
||||||
{
|
|
||||||
return records % this.rows == 0 ? records / this.rows : records / this.rows + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 查询条件Json
|
|
||||||
/// </summary>
|
|
||||||
public string conditionJson { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace OpenAuth.Mvc.WebCtrls.Tree
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LeaRun.Util.WebControl
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 树实体
|
/// 树实体
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
using LeaRun.Util.WebControl;
|
using System.Collections.Generic;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace LeaRun.Util.WebControl
|
namespace OpenAuth.Mvc.WebCtrls.Tree
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造树形Json
|
/// 构造树形Json
|
||||||
|
Loading…
Reference in New Issue
Block a user