init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 是否可访问的枚举(公开、好友、私人)
|
||||
/// </summary>
|
||||
public enum AccessStatus {
|
||||
Public,
|
||||
Friend,
|
||||
Private
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 关于是否可评论的枚举状态(允许、关闭、登录用户、好友)
|
||||
/// </summary>
|
||||
public class CommentCondition {
|
||||
|
||||
public static readonly int AllowAll = 0;
|
||||
public static readonly int Close = 1;
|
||||
public static readonly int LoginUser = 2;
|
||||
public static readonly int Friend = 3;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 注册用户的状态(待审核、删除、置顶、推荐、普通)
|
||||
/// </summary>
|
||||
public class MemberStatus {
|
||||
|
||||
public static readonly int Normal = 0;
|
||||
public static readonly int Pick = 1;
|
||||
public static readonly int Top = 2;
|
||||
public static readonly int Approving = -2;
|
||||
public static readonly int Deleted = -1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 存储状态(普通、草稿、删除、系统删除)
|
||||
/// </summary>
|
||||
public class SaveStatus {
|
||||
|
||||
public static readonly int Normal = 0;
|
||||
public static readonly int Draft = 1;
|
||||
public static readonly int Delete = 2;
|
||||
public static readonly int SysDelete = 3;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 系统推荐状态(当前只推荐一种状态)
|
||||
/// </summary>
|
||||
public class SystemPickStatus {
|
||||
public static readonly int Picked = 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 设置了访问控制的对象接口
|
||||
/// </summary>
|
||||
public interface IAccessStatus {
|
||||
|
||||
int AccessStatus { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 页面区块接口(用于门户中)
|
||||
/// </summary>
|
||||
public interface IPageSection {
|
||||
|
||||
|
||||
void AdminSectionShow( int sectionId );
|
||||
void SectionShow( int sectionId );
|
||||
|
||||
List<IPageSettingLink> GetSettingLink( int sectionId );
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 区块配置链接接口
|
||||
/// </summary>
|
||||
public interface IPageSettingLink {
|
||||
|
||||
String Name { get; set; }
|
||||
String Url { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Zhaizj.Framework.Common.AppBase {
|
||||
|
||||
/// <summary>
|
||||
/// 可排序对象接口
|
||||
/// </summary>
|
||||
public interface ISort {
|
||||
int Id { get; set; }
|
||||
int OrderId { get; set; }
|
||||
void updateOrderId();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序工具封装
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class SortUtil<T> where T : ISort {
|
||||
|
||||
private T data;
|
||||
private List<T> list;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data">需要移动的对象</param>
|
||||
/// <param name="list">对象列表</param>
|
||||
public SortUtil( T data, List<T> list ) {
|
||||
this.data = data;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取经过排序的列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<T> GetOrderedList() {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 先前移动
|
||||
/// </summary>
|
||||
public void MoveUp() {
|
||||
|
||||
int dataId = data.Id;
|
||||
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
|
||||
T t = list[i];
|
||||
int orderId = list.Count - i;
|
||||
|
||||
if (t.Id == dataId && i == 0) continue;
|
||||
|
||||
if (isPrevData( i, dataId )) {
|
||||
t.OrderId = orderId - 1;
|
||||
t.updateOrderId();
|
||||
}
|
||||
else if (t.Id == dataId) {
|
||||
t.OrderId = orderId + 1;
|
||||
t.updateOrderId();
|
||||
}
|
||||
else if (t.OrderId != orderId) {
|
||||
t.OrderId = orderId;
|
||||
t.updateOrderId();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 先后移动
|
||||
/// </summary>
|
||||
public void MoveDown() {
|
||||
|
||||
int dataId = data.Id;
|
||||
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
|
||||
T t = list[i];
|
||||
int orderId = list.Count - i;
|
||||
|
||||
if (t.Id == dataId && i == list.Count - 1) continue;
|
||||
|
||||
if (isNextData( i, dataId )) {
|
||||
t.OrderId = orderId + 1;
|
||||
t.updateOrderId();
|
||||
}
|
||||
else if (t.Id == dataId) {
|
||||
t.OrderId = orderId - 1;
|
||||
t.updateOrderId();
|
||||
}
|
||||
else if (t.OrderId != orderId) {
|
||||
t.OrderId = orderId;
|
||||
t.updateOrderId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Boolean isNextData( int i, int dataId ) {
|
||||
if (i == 0) return false;
|
||||
if (list[i - 1].Id == dataId) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private Boolean isPrevData( int i, int dataId ) {
|
||||
if (i > list.Count - 2) return false;
|
||||
if (list[i + 1].Id == dataId) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user