layui 2.02

This commit is contained in:
yubaolee 2017-08-30 16:49:28 +08:00
parent 5a47357f22
commit c1e84d7334
1093 changed files with 1153 additions and 226292 deletions

View File

@ -1,69 +1,72 @@
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
<%@ Assembly Src="Model.cs" %>
<%@ Assembly Src="Extensions.cs" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<%@ Import Namespace="SchemaMapper" %>
<%@ Property Name="Entity"
Type="SchemaMapper.Entity" %>
<%@ Property Name="EntityNamespace"
Type="System.String" %>
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// Author:Yubao Li
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace <%= EntityNamespace %>
{
/// <summary>
/// <%= Entity.Description %>
/// </summary>
public partial class <%= Entity.ClassName.ToSafeName() %>
{
public <%= Entity.ClassName.ToSafeName() %>()
{
<% foreach(var p in Entity.Properties) {
string type = p.SystemType.ToNullableType(p.IsNullable == true);
if(type =="int" || type=="decimal")
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= 0;");
else if(type =="string")
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= string.Empty;");
else if(type.ToLower().Contains("datetime"))
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= DateTime.Now;");
} // foreach %>
<% foreach(var r in Entity.Relationships.Where(e => e.ThisCardinality == Cardinality.Many)) { %>
<%= r.ThisPropertyName.ToSafeName() %> = new List<<%= r.OtherEntity.ToSafeName() %>>();
<% } // foreach %>
}
<% foreach(var p in Entity.Properties) { %>
/// <summary>
/// <%=p.Description %>
/// </summary>
public <%= p.SystemType.ToNullableType(p.IsNullable == true) %> <%= p.PropertyName.ToSafeName() %> { get; set; }
<% } // foreach %>
<% foreach(var r in Entity.Relationships) { %>
<% if(r.ThisCardinality == Cardinality.Many) { %>
public virtual ICollection<<%= r.OtherEntity.ToSafeName() %>> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
<% } else { %>
public virtual <%= r.OtherEntity.ToSafeName() %> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
<% } %>
<% } // foreach %>
}
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
<%@ Assembly Src="Model.cs" %>
<%@ Assembly Src="Extensions.cs" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<%@ Import Namespace="SchemaMapper" %>
<%@ Property Name="Entity"
Type="SchemaMapper.Entity" %>
<%@ Property Name="EntityNamespace"
Type="System.String" %>
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a CodeSmith Template.
//
// DO NOT MODIFY contents of this file. Changes to this
// file will be lost if the code is regenerated.
// Author:Yubao Li
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace <%= EntityNamespace %>
{
/// <summary>
/// <%= Entity.Description %>
/// </summary>
public partial class <%= Entity.ClassName.ToSafeName() %> : Entity
{
public <%= Entity.ClassName.ToSafeName() %>()
{
<% foreach(var p in Entity.Properties) {
if(p.IsPrimaryKey ==true) continue;
string type = p.SystemType.ToNullableType(p.IsNullable == true);
if(type =="int" || type=="decimal")
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= 0;");
else if(type =="string")
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= string.Empty;");
else if(type.ToLower().Contains("datetime"))
Response.WriteLine(" this."+p.PropertyName.ToSafeName()+"= DateTime.Now;");
} // foreach %>
<% foreach(var r in Entity.Relationships.Where(e => e.ThisCardinality == Cardinality.Many)) { %>
<%= r.ThisPropertyName.ToSafeName() %> = new List<<%= r.OtherEntity.ToSafeName() %>>();
<% } // foreach %>
}
<% foreach(var p in Entity.Properties) {
if(p.IsPrimaryKey ==true) continue;
%>
/// <summary>
/// <%=p.Description %>
/// </summary>
public <%= p.SystemType.ToNullableType(p.IsNullable == true) %> <%= p.PropertyName.ToSafeName() %> { get; set; }
<% } // foreach %>
<% foreach(var r in Entity.Relationships) { %>
<% if(r.ThisCardinality == Cardinality.Many) { %>
public virtual ICollection<<%= r.OtherEntity.ToSafeName() %>> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
<% } else { %>
public virtual <%= r.OtherEntity.ToSafeName() %> <%= r.ThisPropertyName.ToSafeName() %> { get; set; }
<% } %>
<% } // foreach %>
}
}

View File

@ -1,167 +1,167 @@
// ***********************************************************************
// Assembly : OpenAuth.App
// Author : yubaolee
// Created : 07-08-2016
//
// Last Modified By : yubaolee
// Last Modified On : 07-08-2016
// Contact : Microsoft
// File: AuthUtil.cs
// ***********************************************************************
using System;
using System.Configuration;
using System.Web;
using Infrastructure;
using OpenAuth.App.ViewModel;
namespace OpenAuth.App.SSO
{
/// <summary>
/// 第三方网站登录验证类
/// <para>登录时:</para>
/// <code>
/// var result = AuthUtil.Login(AppKey, username, password);
/// if (result.Success)
/// return Redirect("/home/index?Token=" + result.Token);
/// </code>
/// </summary>
public class AuthUtil
{
static HttpHelper _helper = new HttpHelper(ConfigurationManager.AppSettings["SSOPassport"]);
private static string GetToken()
{
string token = HttpContext.Current.Request.QueryString["Token"];
if (!String.IsNullOrEmpty(token)) return token;
var cookie = HttpContext.Current.Request.Cookies["Token"];
return cookie == null ? String.Empty : cookie.Value;
}
public static bool CheckLogin(string token, string remark = "")
{
if (String.IsNullOrEmpty(token) || String.IsNullOrEmpty(GetToken()))
return false;
var requestUri = String.Format("/api/Check/GetStatus?token={0}&requestid={1}", token, remark);
try
{
var value = _helper.Get(null, requestUri);
return Boolean.Parse(value);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 检查用户登录状态
/// <para>通过URL中的Token参数或Cookie中的Token</para>
/// </summary>
/// <param name="remark">备注信息</param>
public static bool CheckLogin(string remark="")
{
return CheckLogin(GetToken(), remark);
}
/// <summary>
/// 获取当前登录的用户信息
/// <para>通过URL中的Token参数或Cookie中的Token</para>
/// </summary>
/// <param name="remark">The remark.</param>
/// <returns>LoginUserVM.</returns>
public static UserWithAccessedCtrls GetCurrentUser(string remark = "")
{
var requestUri = String.Format("/api/Check/GetUser?token={0}&requestid={1}", GetToken(), remark);
try
{
var value = _helper.Get<UserWithAccessedCtrls>(null, requestUri);
return value;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取当前登录的用户名
/// <para>通过URL中的Token参数或Cookie中的Token</para>
/// </summary>
/// <param name="remark">The remark.</param>
/// <returns>System.String.</returns>
public static string GetUserName(string remark = "")
{
var requestUri = String.Format("/api/Check/GetUserName?token={0}&requestid={1}", GetToken(), remark);
try
{
var value = _helper.Get<string>(null, requestUri);
return value;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 登陆接口
/// </summary>
/// <param name="appKey">应用程序key.</param>
/// <param name="username">用户名</param>
/// <param name="pwd">密码</param>
/// <returns>System.String.</returns>
public static LoginResult Login(string appKey, string username, string pwd)
{
var requestUri = "/api/Check/Login";
try
{
var value = _helper.Post(new
{
AppKey = appKey,
UserName = username,
Password = pwd
}, requestUri);
var result = JsonHelper.Instance.Deserialize<LoginResult>(value);
return result;
}
catch (Exception ex)
{
return null;
}
}
/// <summary>
/// 注销
/// </summary>
public static bool Logout()
{
var token = GetToken();
if (String.IsNullOrEmpty(token)) return true;
var requestUri = String.Format("/api/Check/Logout?token={0}&requestid={1}", token, "");
try
{
var value = _helper.Post(null, requestUri);
return true;
}
catch (Exception ex)
{
return false;
}
}
}
// ***********************************************************************
// Assembly : OpenAuth.App
// Author : yubaolee
// Created : 07-08-2016
//
// Last Modified By : yubaolee
// Last Modified On : 07-08-2016
// Contact : Microsoft
// File: AuthUtil.cs
// ***********************************************************************
using System;
using System.Configuration;
using System.Web;
using Infrastructure;
using OpenAuth.App.ViewModel;
namespace OpenAuth.App.SSO
{
/// <summary>
/// 第三方网站登录验证类
/// <para>登录时:</para>
/// <code>
/// var result = AuthUtil.Login(AppKey, username, password);
/// if (result.Success)
/// return Redirect("/home/index?Token=" + result.Token);
/// </code>
/// </summary>
public class AuthUtil
{
static HttpHelper _helper = new HttpHelper(ConfigurationManager.AppSettings["SSOPassport"]);
private static string GetToken()
{
string token = HttpContext.Current.Request.QueryString["Token"];
if (!String.IsNullOrEmpty(token)) return token;
var cookie = HttpContext.Current.Request.Cookies["Token"];
return cookie == null ? String.Empty : cookie.Value;
}
public static bool CheckLogin(string token, string remark = "")
{
if (String.IsNullOrEmpty(token) || String.IsNullOrEmpty(GetToken()))
return false;
var requestUri = String.Format("/api/Check/GetStatus?token={0}&requestid={1}", token, remark);
try
{
var value = _helper.Get(null, requestUri);
return Boolean.Parse(value);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 检查用户登录状态
/// <para>通过URL中的Token参数或Cookie中的Token</para>
/// </summary>
/// <param name="remark">备注信息</param>
public static bool CheckLogin(string remark="")
{
return CheckLogin(GetToken(), remark);
}
/// <summary>
/// 获取当前登录的用户信息
/// <para>通过URL中的Token参数或Cookie中的Token</para>
/// </summary>
/// <param name="remark">The remark.</param>
/// <returns>LoginUserVM.</returns>
public static UserWithAccessedCtrls GetCurrentUser(string remark = "")
{
var requestUri = String.Format("/api/Check/GetUser?token={0}&requestid={1}", GetToken(), remark);
try
{
var value = _helper.Get<UserWithAccessedCtrls>(null, requestUri);
return value;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取当前登录的用户名
/// <para>通过URL中的Token参数或Cookie中的Token</para>
/// </summary>
/// <param name="remark">The remark.</param>
/// <returns>System.String.</returns>
public static string GetUserName(string remark = "")
{
var requestUri = String.Format("/api/Check/GetUserName?token={0}&requestid={1}", GetToken(), remark);
try
{
var value = _helper.Get<string>(null, requestUri);
return value;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 登陆接口
/// </summary>
/// <param name="appKey">应用程序key.</param>
/// <param name="username">用户名</param>
/// <param name="pwd">密码</param>
/// <returns>System.String.</returns>
public static LoginResult Login(string appKey, string username, string pwd)
{
var requestUri = "/api/Check/Login";
try
{
var value = _helper.Post(new
{
AppKey = appKey,
UserName = username,
Password = pwd
}, requestUri);
var result = JsonHelper.Instance.Deserialize<LoginResult>(value);
return result;
}
catch (Exception ex)
{
return null;
}
}
/// <summary>
/// 注销
/// </summary>
public static bool Logout()
{
var token = GetToken();
if (String.IsNullOrEmpty(token)) return true;
var requestUri = String.Format("/api/Check/Logout?token={0}&requestid={1}", token, "");
try
{
var value = _helper.Post(null, requestUri);
return true;
}
catch (Exception ex)
{
return false;
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 B

Some files were not shown because too many files have changed in this diff Show More