using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { public static class OtherReportService { /// /// 非工业其他行业能源节约与生态环境保护汇总表 /// /// 非工业其他行业能源节约与生态环境保护汇总表Id /// 非工业其他行业能源节约与生态环境保护汇总表 public static Model.Environmental_OtherReport GetOtherReportByOtherReportId(string OtherReportId) { return Funs.DB.Environmental_OtherReport.FirstOrDefault(e => e.OtherReportId == OtherReportId); } /// /// 非工业其他行业能源节约与生态环境保护汇总表 /// /// 单位Id /// 年度 /// 月份 /// 非工业其他行业能源节约与生态环境保护汇总表 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); } /// /// 根据单位Id获取非工业其他行业能源节约与生态环境保护汇总表集合 /// /// 单位Id /// 非工业其他行业能源节约与生态环境保护汇总表集合 public static List GetOtherReportsByUnitId(string UnitId) { return (from x in Funs.DB.View_Environmental_OtherReport where x.UnitId == UnitId orderby x.FillingDate descending select x).ToList(); } /// /// 增加非工业其他行业能源节约与生态环境保护汇总表 /// /// 非工业其他行业能源节约与生态环境保护汇总表实体 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(); } /// /// 修改非工业其他行业能源节约与生态环境保护汇总表 /// /// 非工业其他行业能源节约与生态环境保护汇总表实体 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(); } } /// /// 根据Id删除数据 /// /// 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(); } } /// /// 根据报表单位,报表时间判断是否存在 /// /// Id /// 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); } /// /// 根据报表单位,报表年份获取对应集合 /// /// Id /// public static List GetOtherReportByUnitIdYear(string unitId, int year) { return (from x in Funs.DB.Environmental_OtherReport where x.UnitId == unitId && x.Year == year select x).ToList(); } } }