120 lines
5.3 KiB
C#
120 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
public static class OtherReportService
|
|
{
|
|
/// <summary>
|
|
/// 非工业其他行业能源节约与生态环境保护汇总表
|
|
/// </summary>
|
|
/// <param name="OtherReportId">非工业其他行业能源节约与生态环境保护汇总表Id</param>
|
|
/// <returns>非工业其他行业能源节约与生态环境保护汇总表</returns>
|
|
public static Model.Environmental_OtherReport GetOtherReportByOtherReportId(string OtherReportId)
|
|
{
|
|
return Funs.DB.Environmental_OtherReport.FirstOrDefault(e => e.OtherReportId == OtherReportId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 非工业其他行业能源节约与生态环境保护汇总表
|
|
/// </summary>
|
|
/// <param name="unitId">单位Id</param>
|
|
/// <param name = "year" > 年度 </ param >
|
|
/// <param name="month">月份</param>
|
|
/// <returns>非工业其他行业能源节约与生态环境保护汇总表</returns>
|
|
public static Model.Environmental_OtherReport GetOtherReportByUnitIdAndYearAndQuarters(string unitId, int year, int Quarters)
|
|
{
|
|
return Funs.DB.Environmental_OtherReport.FirstOrDefault(e => e.UnitId == unitId && e.Quarters == Quarters && e.Year == year);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据单位Id获取非工业其他行业能源节约与生态环境保护汇总表集合
|
|
/// </summary>
|
|
/// <param name="UnitId">单位Id</param>
|
|
/// <returns>非工业其他行业能源节约与生态环境保护汇总表集合</returns>
|
|
public static List<Model.View_Environmental_OtherReport> GetOtherReportsByUnitId(string UnitId)
|
|
{
|
|
return (from x in Funs.DB.View_Environmental_OtherReport where x.UnitId == UnitId orderby x.FillingDate descending select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加非工业其他行业能源节约与生态环境保护汇总表
|
|
/// </summary>
|
|
/// <param name="OtherReport">非工业其他行业能源节约与生态环境保护汇总表实体</param>
|
|
public static void AddOtherReport(Model.Environmental_OtherReport OtherReport)
|
|
{
|
|
Model.Environmental_OtherReport newOtherReport = new Model.Environmental_OtherReport
|
|
{
|
|
OtherReportId = OtherReport.OtherReportId,
|
|
Year = OtherReport.Year,
|
|
Quarters = OtherReport.Quarters,
|
|
UnitId = OtherReport.UnitId,
|
|
FillingDate = OtherReport.FillingDate,
|
|
DutyPerson = OtherReport.DutyPerson,
|
|
FillingMan = OtherReport.FillingMan,
|
|
UpState = OtherReport.UpState,
|
|
};
|
|
|
|
Funs.DB.Environmental_OtherReport.InsertOnSubmit(newOtherReport);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改非工业其他行业能源节约与生态环境保护汇总表
|
|
/// </summary>
|
|
/// <param name="OtherReport">非工业其他行业能源节约与生态环境保护汇总表实体</param>
|
|
public static void UpdateOtherReport(Model.Environmental_OtherReport OtherReport)
|
|
{
|
|
Model.Environmental_OtherReport newOtherReport = Funs.DB.Environmental_OtherReport.FirstOrDefault(e => e.OtherReportId == OtherReport.OtherReportId);
|
|
if (newOtherReport != null)
|
|
{
|
|
newOtherReport.Year = OtherReport.Year;
|
|
newOtherReport.Quarters = OtherReport.Quarters;
|
|
newOtherReport.UnitId = OtherReport.UnitId;
|
|
newOtherReport.FillingDate = OtherReport.FillingDate;
|
|
newOtherReport.DutyPerson = OtherReport.DutyPerson;
|
|
newOtherReport.UpState = OtherReport.UpState;
|
|
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据Id删除数据
|
|
/// </summary>
|
|
/// <param name="OtherReportId"></param>
|
|
public static void DeleteOtherReportByOtherReportId(string OtherReportId)
|
|
{
|
|
Model.Environmental_OtherReport newOtherReport = Funs.DB.Environmental_OtherReport.FirstOrDefault(e => e.OtherReportId == OtherReportId);
|
|
if (newOtherReport != null)
|
|
{
|
|
Funs.DB.Environmental_OtherReport.DeleteOnSubmit(newOtherReport);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据报表单位,报表时间判断是否存在
|
|
/// </summary>
|
|
/// <param name="Id">Id</param>
|
|
/// <returns></returns>
|
|
public static Model.Environmental_OtherReport GetOtherReportByUnitIdDate(string unitId, int year, int Quarters)
|
|
{
|
|
return Funs.DB.Environmental_OtherReport.FirstOrDefault(e => e.UnitId == unitId && e.Year == year && e.Quarters == Quarters);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据报表单位,报表年份获取对应集合
|
|
/// </summary>
|
|
/// <param name="Id">Id</param>
|
|
/// <returns></returns>
|
|
public static List<Model.Environmental_OtherReport> GetOtherReportByUnitIdYear(string unitId, int year)
|
|
{
|
|
return (from x in Funs.DB.Environmental_OtherReport where x.UnitId == unitId && x.Year == year select x).ToList();
|
|
}
|
|
}
|
|
}
|