using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public static class IndustryOtherReportService
{
///
/// 工业其他行业能源节约与生态环境保护汇总表
///
/// 工业其他行业能源节约与生态环境保护汇总表Id
/// 工业其他行业能源节约与生态环境保护汇总表
public static Model.Environmental_IndustryOtherReport GetIndustryOtherReportByIndustryOtherReportId(string IndustryOtherReportId)
{
return Funs.DB.Environmental_IndustryOtherReport.FirstOrDefault(e => e.IndustryOtherReportId == IndustryOtherReportId);
}
///
/// 工业其他行业能源节约与生态环境保护汇总表
///
/// 单位Id
/// 年度 param >
/// 月份
/// 工业其他行业能源节约与生态环境保护汇总表
public static Model.Environmental_IndustryOtherReport GetIndustryOtherReportByUnitIdAndYearAndQuarters(string unitId, int year, int Quarters)
{
return Funs.DB.Environmental_IndustryOtherReport.FirstOrDefault(e => e.UnitId == unitId && e.Quarters == Quarters && e.Year == year);
}
///
/// 根据单位Id获取工业其他行业能源节约与生态环境保护汇总表集合
///
/// 单位Id
/// 工业其他行业能源节约与生态环境保护汇总表集合
public static List GetIndustryOtherReportsByUnitId(string UnitId)
{
return (from x in Funs.DB.View_Environmental_IndustryOtherReport where x.UnitId == UnitId orderby x.FillingDate descending select x).ToList();
}
///
/// 增加工业其他行业能源节约与生态环境保护汇总表
///
/// 工业其他行业能源节约与生态环境保护汇总表实体
public static void AddIndustryOtherReport(Model.Environmental_IndustryOtherReport IndustryOtherReport)
{
Model.Environmental_IndustryOtherReport newIndustryOtherReport = new Model.Environmental_IndustryOtherReport
{
IndustryOtherReportId = IndustryOtherReport.IndustryOtherReportId,
Year = IndustryOtherReport.Year,
Quarters = IndustryOtherReport.Quarters,
UnitId = IndustryOtherReport.UnitId,
FillingDate = IndustryOtherReport.FillingDate,
DutyPerson = IndustryOtherReport.DutyPerson,
FillingMan = IndustryOtherReport.FillingMan,
UpState = IndustryOtherReport.UpState,
};
Funs.DB.Environmental_IndustryOtherReport.InsertOnSubmit(newIndustryOtherReport);
Funs.DB.SubmitChanges();
}
///
/// 修改工业其他行业能源节约与生态环境保护汇总表
///
/// 工业其他行业能源节约与生态环境保护汇总表实体
public static void UpdateIndustryOtherReport(Model.Environmental_IndustryOtherReport IndustryOtherReport)
{
Model.Environmental_IndustryOtherReport newIndustryOtherReport = Funs.DB.Environmental_IndustryOtherReport.FirstOrDefault(e => e.IndustryOtherReportId == IndustryOtherReport.IndustryOtherReportId);
if (newIndustryOtherReport != null)
{
newIndustryOtherReport.Year = IndustryOtherReport.Year;
newIndustryOtherReport.Quarters = IndustryOtherReport.Quarters;
newIndustryOtherReport.UnitId = IndustryOtherReport.UnitId;
newIndustryOtherReport.FillingDate = IndustryOtherReport.FillingDate;
newIndustryOtherReport.DutyPerson = IndustryOtherReport.DutyPerson;
newIndustryOtherReport.UpState = IndustryOtherReport.UpState;
Funs.DB.SubmitChanges();
}
}
///
/// 根据Id删除数据
///
///
public static void DeleteIndustryOtherReportByIndustryOtherReportId(string IndustryOtherReportId)
{
Model.Environmental_IndustryOtherReport newIndustryOtherReport = Funs.DB.Environmental_IndustryOtherReport.FirstOrDefault(e => e.IndustryOtherReportId == IndustryOtherReportId);
if (newIndustryOtherReport != null)
{
Funs.DB.Environmental_IndustryOtherReport.DeleteOnSubmit(newIndustryOtherReport);
Funs.DB.SubmitChanges();
}
}
///
/// 根据报表单位,报表时间判断是否存在
///
/// Id
///
public static Model.Environmental_IndustryOtherReport GetIndustryOtherReportByUnitIdDate(string unitId, int year, int Quarters)
{
return Funs.DB.Environmental_IndustryOtherReport.FirstOrDefault(e => e.UnitId == unitId && e.Year == year && e.Quarters == Quarters);
}
///
/// 根据报表单位,报表年份获取对应集合
///
/// Id
///
public static List GetIndustryOtherReportByUnitIdYear(string unitId, int year)
{
return (from x in Funs.DB.Environmental_IndustryOtherReport where x.UnitId == unitId && x.Year == year select x).ToList();
}
}
}