111 lines
3.7 KiB
C#
111 lines
3.7 KiB
C#
using FineUIPro;
|
|
using Model;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 项目信息
|
|
/// </summary>
|
|
public static class SYHSEData_EnvironmentProtectionService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
#region 获取列表信息
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
public static int count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义变量
|
|
/// </summary>
|
|
private static IQueryable<Model.SYHSEData_EnvironmentProtection> getDataLists = from x in db.SYHSEData_EnvironmentProtection select x;
|
|
|
|
/// <summary>
|
|
/// 数据列表
|
|
/// </summary>
|
|
/// <param name="unitId">单位ID</param>
|
|
/// <param name="startTime">开始日期</param>
|
|
/// <param name="endTime">结束日期</param>
|
|
/// <param name="Grid1"></param>
|
|
/// <returns></returns>
|
|
public static IEnumerable getListData(string projectId, string startTime, string endTime, Grid Grid1)
|
|
{
|
|
IQueryable<Model.SYHSEData_EnvironmentProtection> getDataList = getDataLists.OrderByDescending(x => x.DetectionTimeA) ;
|
|
if (!string.IsNullOrEmpty(projectId) && projectId != Const._Null)
|
|
{
|
|
getDataList = getDataList.Where(e => e.ProjectId == projectId);
|
|
}
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
getDataList = getDataList.Where(e => e.DetectionTimeA >= Funs.GetNewDateTime(startTime));
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
getDataList = getDataList.Where(e => e.DetectionTimeZ <= Funs.GetNewDateTime(endTime));
|
|
}
|
|
|
|
count = getDataList.Count();
|
|
if (count == 0)
|
|
{
|
|
return null;
|
|
}
|
|
//getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|
getDataList= getDataList.OrderByDescending(x => x.DetectionTimeA).OrderBy(x=> x.ShowIndex).Skip(Grid1.PageIndex* Grid1.PageSize).Take(Grid1.PageSize);
|
|
return from x in getDataList orderby x.DetectionTimeA descending orderby x.ShowIndex
|
|
select new
|
|
{
|
|
x.Id,
|
|
x.UnitId,
|
|
x.ProjectId,
|
|
x.DetectionTimeA,
|
|
x.DetectionTimeZ,
|
|
x.DetectionAddress,
|
|
x.DetectionProject,
|
|
x.DetectionValue,
|
|
x.StandValue,
|
|
x.AvgFlow,
|
|
x.SumFlow,
|
|
x.IsOk,
|
|
x.IsStop,
|
|
x.ReMark,
|
|
x.Type,
|
|
x.CreateMan,
|
|
x.CreateDate,
|
|
ShowIndex=x.DetectionTimeA.Value.AddMinutes(0-x.ShowIndex.Value)
|
|
};
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 根据Id删除一个信息
|
|
/// <summary>
|
|
/// 根据Id删除一个信息
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
public static void DeleteProjectById(string id)
|
|
{
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
{
|
|
var getData = db.SYHSEData_EnvironmentProtection.FirstOrDefault(e => e.Id == id);
|
|
if (getData != null)
|
|
{
|
|
db.SYHSEData_EnvironmentProtection.DeleteOnSubmit(getData);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|