135 lines
4.7 KiB
C#
135 lines
4.7 KiB
C#
using FineUIPro;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 消防安全演练
|
|
/// </summary>
|
|
public static class FiresafetydrillService
|
|
{
|
|
#region 获取列表
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
public static int Count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
public static IQueryable<Model.FireGasSafety_FireSafetyDrill> GetFireGasSafety_FireSafetyDrillByModle(Model.FireGasSafety_FireSafetyDrill table)
|
|
{
|
|
var q = from x in Funs.DB.FireGasSafety_FireSafetyDrill
|
|
where
|
|
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
|
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
|
(string.IsNullOrEmpty(table.Code) || x.Code.Contains(table.Code)) &&
|
|
(string.IsNullOrEmpty(table.Name) || x.Name.Contains(table.Name)) &&
|
|
(string.IsNullOrEmpty(table.Content) || x.Content.Contains(table.Content)) &&
|
|
(string.IsNullOrEmpty(table.CompileMan) || x.CompileMan.Contains(table.CompileMan))
|
|
select x
|
|
;
|
|
|
|
return q;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取分页列表
|
|
/// </summary>
|
|
/// <param name="table"></param>
|
|
/// <param name="grid1"></param>
|
|
/// <returns></returns>
|
|
public static IEnumerable GetListData(Model.FireGasSafety_FireSafetyDrill table, Grid grid1)
|
|
{
|
|
var q = GetFireGasSafety_FireSafetyDrillByModle(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.Code,
|
|
x.Name,
|
|
x.DrillPersonNum,
|
|
x.Content,
|
|
x.DrillStartDate,
|
|
x.DrillEndDate,
|
|
x.CompileMan,
|
|
x.CompileDate,
|
|
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
public static Model.FireGasSafety_FireSafetyDrill GetById(string Id)
|
|
{
|
|
return Funs.DB.FireGasSafety_FireSafetyDrill.FirstOrDefault(x => x.Id == Id);
|
|
}
|
|
|
|
|
|
public static void Add(Model.FireGasSafety_FireSafetyDrill newtable)
|
|
{
|
|
|
|
Model.FireGasSafety_FireSafetyDrill table = new Model.FireGasSafety_FireSafetyDrill
|
|
{
|
|
Id = newtable.Id,
|
|
ProjectId = newtable.ProjectId,
|
|
Code = newtable.Code,
|
|
Name = newtable.Name,
|
|
DrillPersonNum = newtable.DrillPersonNum,
|
|
Content = newtable.Content,
|
|
DrillStartDate = newtable.DrillStartDate,
|
|
DrillEndDate = newtable.DrillEndDate,
|
|
CompileMan = newtable.CompileMan,
|
|
CompileDate = newtable.CompileDate,
|
|
};
|
|
Funs.DB.FireGasSafety_FireSafetyDrill.InsertOnSubmit(table);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
|
|
public static void Update(Model.FireGasSafety_FireSafetyDrill newtable)
|
|
{
|
|
|
|
Model.FireGasSafety_FireSafetyDrill table = Funs.DB.FireGasSafety_FireSafetyDrill.FirstOrDefault(x => x.Id == newtable.Id);
|
|
if (table != null)
|
|
{
|
|
table.Id = newtable.Id;
|
|
table.ProjectId = newtable.ProjectId;
|
|
table.Code = newtable.Code;
|
|
table.Name = newtable.Name;
|
|
table.DrillPersonNum = newtable.DrillPersonNum;
|
|
table.Content = newtable.Content;
|
|
table.DrillStartDate = newtable.DrillStartDate;
|
|
table.DrillEndDate = newtable.DrillEndDate;
|
|
table.CompileMan = newtable.CompileMan;
|
|
table.CompileDate = newtable.CompileDate;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
public static void DeleteById(string Id)
|
|
{
|
|
|
|
Model.FireGasSafety_FireSafetyDrill table = Funs.DB.FireGasSafety_FireSafetyDrill.FirstOrDefault(x => x.Id == Id);
|
|
if (table != null)
|
|
{
|
|
Funs.DB.FireGasSafety_FireSafetyDrill.DeleteOnSubmit(table);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
} |