Skip to content

Commit

Permalink
update MethodResult
Browse files Browse the repository at this point in the history
  • Loading branch information
xucl authored and xucl committed Apr 26, 2016
1 parent 4a70a2a commit 1b7050f
Show file tree
Hide file tree
Showing 18 changed files with 5,217 additions and 5,115 deletions.
Binary file modified TestWeb/bin/TestWeb.dll
Binary file not shown.
Binary file modified TestWeb/bin/TestWeb.pdb
Binary file not shown.
Binary file modified TestWeb/bin/XCLNetTools.dll
Binary file not shown.
Binary file modified TestWeb/bin/XCLNetTools.pdb
Binary file not shown.
5,118 changes: 2,571 additions & 2,547 deletions TestWeb/bin/XCLNetTools.xml

Large diffs are not rendered by default.

Binary file modified TestWeb/obj/Debug/TestWeb.csprojResolveAssemblyReference.cache
Binary file not shown.
Binary file modified TestWeb/obj/Debug/TestWeb.dll
Binary file not shown.
Binary file modified TestWeb/obj/Debug/TestWeb.pdb
Binary file not shown.
Binary file modified XCLNetTools.v12.suo
Binary file not shown.
62 changes: 58 additions & 4 deletions XCLNetTools/Entity/MethodResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace XCLNetTools.Entity
{
/// <summary>
/// 方法返回值实体,主要是方便一个方法输出多个信息时使用,同时也减少使用out返回结果信息
/// <typeparam name="T">方法返回的结果类型</typeparam>
/// </summary>
/// <typeparam name="TResult">方法返回的结果类型</typeparam>
[Serializable]
public class MethodResult<T>
public class MethodResult<TResult>
{
private bool _isSuccess = true;
private T _result = default(T);
private TResult _result = default(TResult);

/// <summary>
/// 该方法执行的逻辑是否成功(默认为true)
Expand All @@ -37,7 +37,7 @@ public bool IsSuccess
/// <summary>
/// 该方法返回的结果
/// </summary>
public T Result
public TResult Result
{
get
{
Expand All @@ -62,4 +62,58 @@ public T Result
/// </summary>
public object Data { get; set; }
}

/// <summary>
/// 方法返回值实体,主要是方便一个方法输出多个信息时使用,同时也减少使用out返回结果信息
/// </summary>
/// <typeparam name="TResult">方法返回的结果类型</typeparam>
/// <typeparam name="TData">Data属性的类型</typeparam>
[Serializable]
public class MethodResult<TResult, TData>
{
private bool _isSuccess = true;
private TResult _result = default(TResult);

/// <summary>
/// 该方法执行的逻辑是否成功(默认为true)
/// </summary>
public bool IsSuccess
{
get { return this._isSuccess; }
set { this._isSuccess = value; }
}

/// <summary>
/// 该方法返回的消息提示
/// </summary>
public string Message { get; set; }

/// <summary>
/// 该方法返回的结果
/// </summary>
public TResult Result
{
get
{
if (this._result is bool)
{
throw new Exception("当Result为bool类型时,请读取IsSuccess属性即可!");
}
return this._result;
}
set
{
if (this._result is bool)
{
throw new Exception("当Result为bool类型时,请设置IsSuccess属性即可!");
}
this._result = value;
}
}

/// <summary>
/// 其它数据(比如用dictionary存放不同的数据结果)
/// </summary>
public TData Data { get; set; }
}
}
16 changes: 16 additions & 0 deletions XCLNetTools/Enum/CommonEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ public enum StaticResourceTypeEnum
ICON
}

/// <summary>
/// XCLNetTools.Message.MessageModel 跳转方式
/// </summary>
public enum RedirectTargetEnum
{
/// <summary>
/// 在当前页打开
/// </summary>
None = 0,

/// <summary>
/// 新窗口打开
/// </summary>
NewBlank = 1
}

#endregion 其它
}
}
18 changes: 1 addition & 17 deletions XCLNetTools/Message/MessageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class MessageModel
/// <summary>
/// 跳转方式
/// </summary>
public RedirectTargetEnum RedirectTarget { get; set; }
public XCLNetTools.Enum.CommonEnum.RedirectTargetEnum RedirectTarget { get; set; }

/// <summary>
/// 当前请求是否为ajax请求
Expand All @@ -97,20 +97,4 @@ public bool IsAjax
/// </summary>
public object CustomObject { get; set; }
}

/// <summary>
/// 跳转方式
/// </summary>
public enum RedirectTargetEnum
{
/// <summary>
/// 在当前页打开
/// </summary>
None = 0,

/// <summary>
/// 新窗口打开
/// </summary>
NewBlank = 1
}
}
Binary file modified XCLNetTools/bin/Debug/XCLNetTools.dll
Binary file not shown.
Binary file modified XCLNetTools/bin/Debug/XCLNetTools.pdb
Binary file not shown.
Loading

0 comments on commit 1b7050f

Please sign in to comment.