using System; using System.Collections.Generic; using System.Text; using System.Data; using WeiSha.Common; using Song.Entities; using WeiSha.Data; using Song.ServiceInterfaces; namespace Song.ServiceImpls { public class InternalLinkCom : IInternalLink { /// /// 添加内部链接 /// /// 业务实体 public void LinkAdd(InternalLink entity) { entity.IL_CrtTime = DateTime.Now; Song.Entities.Organization org = Business.Do().OrganCurrent(); if (org != null) { entity.Org_ID = org.Org_ID; entity.Org_Name = org.Org_Name; } Gateway.Default.Save(entity); } /// /// 修改 /// /// 业务实体 public void LinkSave(InternalLink entity) { Gateway.Default.Save(entity); } /// 删除,按主键ID; /// /// 实体的主键 public void LinkDelete(int identify) { Gateway.Default.Delete(InternalLink._.IL_ID == identify); } /// /// 获取单一实体对象,按主键ID; /// /// 实体的主键 /// public InternalLink LinkSingle(int identify) { return Gateway.Default.From().Where(InternalLink._.IL_ID == identify).ToFirst(); } /// /// 获取某个院系的所有链接项; /// /// 是否使用 /// public InternalLink[] LinkAll(bool? isUse) { WhereClip wc = InternalLink._.IL_ID > -1; if (isUse != null) wc.And(InternalLink._.IL_IsUse == (bool)isUse); return Gateway.Default.From().Where(wc).ToArray(); } /// 分页获取所有的链接项; /// /// 每页显示几条记录 /// 当前第几页 /// 记录总数 /// public InternalLink[] LinkPager(string searTxt, bool? isUse, int size, int index, out int countSum) { WhereClip wc = InternalLink._.IL_ID > -1; if (isUse != null) wc.And(InternalLink._.IL_IsUse == (bool)isUse); if (searTxt != null && searTxt.Length > 0) wc.And(InternalLink._.IL_Name.Like("%"+searTxt+"%")); countSum = Gateway.Default.Count(wc); return Gateway.Default.From().Where(wc).OrderBy(InternalLink._.IL_CrtTime.Desc).ToArray(size, (index - 1) * size); } } }