124 lines
4.3 KiB
C#
124 lines
4.3 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 HazardousChemicalsManageRuleService
|
|||
|
{
|
|||
|
#region 获取列表
|
|||
|
/// <summary>
|
|||
|
/// 记录数
|
|||
|
/// </summary>
|
|||
|
public static int Count
|
|||
|
{
|
|||
|
get;
|
|||
|
set;
|
|||
|
}
|
|||
|
public static IQueryable<Model.HazardousChemicals_ManageRule> GetFireGasSafety_DesignReviewAndAcceptanceByModle(Model.HazardousChemicals_ManageRule table)
|
|||
|
{
|
|||
|
var q = from x in Funs.DB.HazardousChemicals_ManageRule
|
|||
|
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.HazardousChemicals_ManageRule table, Grid grid1)
|
|||
|
{
|
|||
|
var q = GetFireGasSafety_DesignReviewAndAcceptanceByModle(table);
|
|||
|
Count = q.Count();
|
|||
|
if (Count == 0)
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
|||
|
return from x in q
|
|||
|
select new
|
|||
|
{
|
|||
|
x.Id,
|
|||
|
x.ProjectId,
|
|||
|
x.Code,
|
|||
|
x.Name,
|
|||
|
x.Content,
|
|||
|
x.CompileMan,
|
|||
|
x.CompileDate,
|
|||
|
};
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public static Model.HazardousChemicals_ManageRule GetById(string Id)
|
|||
|
{
|
|||
|
return Funs.DB.HazardousChemicals_ManageRule.FirstOrDefault(x => x.Id == Id);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static void Add(Model.HazardousChemicals_ManageRule newtable)
|
|||
|
{
|
|||
|
|
|||
|
Model.HazardousChemicals_ManageRule table = new Model.HazardousChemicals_ManageRule
|
|||
|
{
|
|||
|
Id = newtable.Id,
|
|||
|
ProjectId = newtable.ProjectId,
|
|||
|
Code = newtable.Code,
|
|||
|
Name = newtable.Name,
|
|||
|
Content = newtable.Content,
|
|||
|
CompileMan = newtable.CompileMan,
|
|||
|
CompileDate = newtable.CompileDate,
|
|||
|
IsIssue = newtable.IsIssue,
|
|||
|
IssueDate = newtable.IssueDate,
|
|||
|
};
|
|||
|
Funs.DB.HazardousChemicals_ManageRule.InsertOnSubmit(table);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static void Update(Model.HazardousChemicals_ManageRule newtable)
|
|||
|
{
|
|||
|
|
|||
|
Model.HazardousChemicals_ManageRule table = Funs.DB.HazardousChemicals_ManageRule.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.Content = newtable.Content;
|
|||
|
table.CompileMan = newtable.CompileMan;
|
|||
|
table.IsIssue = newtable.IsIssue;
|
|||
|
table.IssueDate = newtable.IssueDate;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
public static void DeleteById(string Id)
|
|||
|
{
|
|||
|
Model.HazardousChemicals_ManageRule table = Funs.DB.HazardousChemicals_ManageRule.FirstOrDefault(x => x.Id == Id);
|
|||
|
if (table != null)
|
|||
|
{
|
|||
|
Funs.DB.HazardousChemicals_ManageRule.DeleteOnSubmit(table);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|