184 lines
7.4 KiB
C#
184 lines
7.4 KiB
C#
using FineUIPro;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
|
|
namespace BLL
|
|
{
|
|
|
|
public static class InterFaceSetService
|
|
{
|
|
|
|
|
|
#region 获取列表
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
public static int count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
public static List<Model.InterFaceSet> GetInterFaceSetByModle(Model.InterFaceSet table)
|
|
{
|
|
var q= from x in Funs.DB.InterFaceSet
|
|
where
|
|
( string.IsNullOrEmpty(table.InterFaceSetId)||x.InterFaceSetId.Contains(table.InterFaceSetId)) &&
|
|
( string.IsNullOrEmpty(table.InterFaceName)||x.InterFaceName.Contains(table.InterFaceName)) &&
|
|
( string.IsNullOrEmpty(table.InterFaceUrl)||x.InterFaceUrl.Contains(table.InterFaceUrl)) &&
|
|
( string.IsNullOrEmpty(table.UnitId)||x.UnitId.Contains(table.UnitId)) &&
|
|
( string.IsNullOrEmpty(table.AuthUnitIds)||x.AuthUnitIds.Contains(table.AuthUnitIds)) &&
|
|
( string.IsNullOrEmpty(table.AuthUnitName)||x.AuthUnitName.Contains(table.AuthUnitName)) &&
|
|
( string.IsNullOrEmpty(table.ValidPeriod)||x.ValidPeriod.Contains(table.ValidPeriod)) &&
|
|
( string.IsNullOrEmpty(table.TxtRemarks)||x.TxtRemarks.Contains(table.TxtRemarks)) &&
|
|
( string.IsNullOrEmpty(table.InterFaceForUrl)||x.InterFaceForUrl.Contains(table.InterFaceForUrl)) &&
|
|
( string.IsNullOrEmpty(table.InterFaceCallBackUrl)||x.InterFaceCallBackUrl.Contains(table.InterFaceCallBackUrl))
|
|
select x
|
|
;
|
|
|
|
return q.ToList();
|
|
}
|
|
|
|
/// 获取分页列表
|
|
/// </summary>
|
|
/// <param name="PageIndex">页码</param>
|
|
/// <param name="PageSize">每页数量</param>
|
|
/// <returns></returns>
|
|
public static IEnumerable getListData(Model.InterFaceSet table, Grid Grid1)
|
|
{
|
|
var q= GetInterFaceSetByModle(table);
|
|
count = q.Count();
|
|
if (count == 0)
|
|
{
|
|
return null;
|
|
}
|
|
// q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
|
|
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|
return from x in q
|
|
select new
|
|
{
|
|
x.InterFaceSetId,
|
|
x.InterFaceName,
|
|
x.InterFaceUrl,
|
|
x.UnitId,
|
|
x.AuthUnitIds,
|
|
x.AuthUnitName,
|
|
x.IsOpen,
|
|
x.ValidPeriod,
|
|
x.TxtRemarks,
|
|
x.InterFaceForUrl,
|
|
x.IsCallBack,
|
|
x.InterFaceCallBackUrl,
|
|
x.UrlReqMethod,
|
|
x.CallBackUrlReqMethod,
|
|
x.ForUrlReqMethod
|
|
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
public static Model.InterFaceSet GetInterFaceSetById(string InterFaceSetId)
|
|
{
|
|
return Funs.DB.InterFaceSet.FirstOrDefault(x=>x.InterFaceSetId==InterFaceSetId);
|
|
}
|
|
public static List<Model.InterFaceSet> GetInterFaceSets()
|
|
{
|
|
var q = (from x in Funs.DB.InterFaceSet select x).ToList();
|
|
return q;
|
|
}
|
|
|
|
public static void AddInterFaceSet(Model.InterFaceSet newtable)
|
|
{
|
|
|
|
Model.InterFaceSet table = new Model.InterFaceSet{
|
|
InterFaceSetId=newtable.InterFaceSetId,
|
|
InterFaceName=newtable.InterFaceName,
|
|
InterFaceUrl=newtable.InterFaceUrl,
|
|
UnitId=newtable.UnitId,
|
|
AuthUnitIds=newtable.AuthUnitIds,
|
|
AuthUnitName=newtable.AuthUnitName,
|
|
IsOpen=newtable.IsOpen,
|
|
ValidPeriod=newtable.ValidPeriod,
|
|
TxtRemarks=newtable.TxtRemarks,
|
|
InterFaceForUrl=newtable.InterFaceForUrl,
|
|
IsCallBack=newtable.IsCallBack,
|
|
InterFaceCallBackUrl=newtable.InterFaceCallBackUrl,
|
|
UrlReqMethod=newtable.UrlReqMethod,
|
|
ForUrlReqMethod=newtable.ForUrlReqMethod,
|
|
CallBackUrlReqMethod= newtable.CallBackUrlReqMethod,
|
|
};
|
|
Funs.DB.InterFaceSet.InsertOnSubmit(table);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
|
|
public static void UpdateInterFaceSet(Model.InterFaceSet newtable)
|
|
{
|
|
|
|
Model.InterFaceSet table = Funs.DB.InterFaceSet.FirstOrDefault(x=>x.InterFaceSetId==newtable.InterFaceSetId);
|
|
if (table != null)
|
|
{
|
|
table.InterFaceSetId=newtable.InterFaceSetId;
|
|
table.InterFaceName=newtable.InterFaceName;
|
|
table.InterFaceUrl=newtable.InterFaceUrl;
|
|
table.UnitId=newtable.UnitId;
|
|
table.AuthUnitIds=newtable.AuthUnitIds;
|
|
table.AuthUnitName=newtable.AuthUnitName;
|
|
table.IsOpen=newtable.IsOpen;
|
|
table.ValidPeriod=newtable.ValidPeriod;
|
|
table.TxtRemarks=newtable.TxtRemarks;
|
|
table.InterFaceForUrl=newtable.InterFaceForUrl;
|
|
table.IsCallBack=newtable.IsCallBack;
|
|
table.InterFaceCallBackUrl=newtable.InterFaceCallBackUrl;
|
|
table.UrlReqMethod=newtable.UrlReqMethod;
|
|
table.ForUrlReqMethod=newtable.ForUrlReqMethod;
|
|
table.CallBackUrlReqMethod=newtable.CallBackUrlReqMethod;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
public static void DeleteInterFaceSetById (string InterFaceSetId)
|
|
{
|
|
|
|
Model.InterFaceSet table =Funs.DB.InterFaceSet.FirstOrDefault(x=>x.InterFaceSetId==InterFaceSetId);
|
|
if (table != null)
|
|
{
|
|
Funs.DB.InterFaceSet.DeleteOnSubmit(table);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
public static void InitInterFaceDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "InterFaceSetId";
|
|
dropName.DataTextField = "InterFaceName";
|
|
dropName.DataSource = GetInterFaceSets();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
public static ListItem[] GetReqMethod()
|
|
{
|
|
ListItem[] listItem = new ListItem[2];
|
|
listItem[0] = new ListItem("Get", "Get");
|
|
listItem[1] = new ListItem("Post", "Post");
|
|
return listItem;
|
|
}
|
|
public static void InitReqMethodDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Value";
|
|
dropName.DataTextField = "Text";
|
|
dropName.DataSource = GetReqMethod();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
}
|
|
} |