128 lines
4.3 KiB
C#
128 lines
4.3 KiB
C#
|
using FineUIPro;
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
|
|||
|
public static class SitepersonPersonleaveService
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 获取列表
|
|||
|
/// <summary>
|
|||
|
/// 记录数
|
|||
|
/// </summary>
|
|||
|
public static int Count
|
|||
|
{
|
|||
|
get;
|
|||
|
set;
|
|||
|
}
|
|||
|
public static IQueryable<Model.SitePerson_PersonLeave> GetSitePerson_PersonLeaveByModle(Model.SitePerson_PersonLeave table)
|
|||
|
{
|
|||
|
var q = from x in Funs.DB.SitePerson_PersonLeave
|
|||
|
where
|
|||
|
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
|||
|
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
|||
|
(string.IsNullOrEmpty(table.PersonId) || x.PersonId.Contains(table.PersonId)) &&
|
|||
|
(string.IsNullOrEmpty(table.StartTime) || x.StartTime.Contains(table.StartTime)) &&
|
|||
|
(string.IsNullOrEmpty(table.EndTime) || x.EndTime.Contains(table.EndTime)) &&
|
|||
|
(string.IsNullOrEmpty(table.Title) || x.Title.Contains(table.Title)) &&
|
|||
|
(string.IsNullOrEmpty(table.IdCrads) || x.IdCrads.Contains(table.IdCrads))
|
|||
|
select x
|
|||
|
;
|
|||
|
|
|||
|
return q;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取分页列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="table"></param>
|
|||
|
/// <param name="grid1"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static IEnumerable GetListData(Model.SitePerson_PersonLeave table, Grid grid1)
|
|||
|
{
|
|||
|
var q = GetSitePerson_PersonLeaveByModle(table);
|
|||
|
Count = q.Count();
|
|||
|
if (Count == 0)
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
|||
|
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|||
|
return from x in q
|
|||
|
select new
|
|||
|
{
|
|||
|
x.Id,
|
|||
|
x.ProjectId,
|
|||
|
x.PersonId,
|
|||
|
x.StartTime,
|
|||
|
x.EndTime,
|
|||
|
x.Title,
|
|||
|
x.IdCrads,
|
|||
|
|
|||
|
};
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public static Model.SitePerson_PersonLeave GetSitePerson_PersonLeaveById(string Id)
|
|||
|
{
|
|||
|
return Funs.DB.SitePerson_PersonLeave.FirstOrDefault(x => x.Id == Id);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static void AddSitePerson_PersonLeave(Model.SitePerson_PersonLeave newtable)
|
|||
|
{
|
|||
|
|
|||
|
Model.SitePerson_PersonLeave table = new Model.SitePerson_PersonLeave
|
|||
|
{
|
|||
|
Id = newtable.Id,
|
|||
|
ProjectId = newtable.ProjectId,
|
|||
|
PersonId = newtable.PersonId,
|
|||
|
StartTime = newtable.StartTime,
|
|||
|
EndTime = newtable.EndTime,
|
|||
|
Title = newtable.Title,
|
|||
|
IdCrads = newtable.IdCrads,
|
|||
|
};
|
|||
|
Funs.DB.SitePerson_PersonLeave.InsertOnSubmit(table);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static void UpdateSitePerson_PersonLeave(Model.SitePerson_PersonLeave newtable)
|
|||
|
{
|
|||
|
|
|||
|
Model.SitePerson_PersonLeave table = Funs.DB.SitePerson_PersonLeave.FirstOrDefault(x => x.Id == newtable.Id);
|
|||
|
if (table != null)
|
|||
|
{
|
|||
|
table.Id = newtable.Id;
|
|||
|
table.ProjectId = newtable.ProjectId;
|
|||
|
table.PersonId = newtable.PersonId;
|
|||
|
table.StartTime = newtable.StartTime;
|
|||
|
table.EndTime = newtable.EndTime;
|
|||
|
table.Title = newtable.Title;
|
|||
|
table.IdCrads = newtable.IdCrads;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
public static void DeleteSitePerson_PersonLeaveById(string Id)
|
|||
|
{
|
|||
|
|
|||
|
Model.SitePerson_PersonLeave table = Funs.DB.SitePerson_PersonLeave.FirstOrDefault(x => x.Id == Id);
|
|||
|
if (table != null)
|
|||
|
{
|
|||
|
Funs.DB.SitePerson_PersonLeave.DeleteOnSubmit(table);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|