using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { public class IncentiveSortCService { public static Model.SGGLDB db = Funs.DB; public static List GetIncentiveSortsByMonthReportIdAndBigType(string monthReportId, string bigType) { return (from x in Funs.DB.Manager_IncentiveSortC where x.MonthReportId == monthReportId && x.BigType == bigType orderby x.SortIndex select x).ToList(); } /// /// 根据月报告主键获取所有月报告HSE奖惩情况信息 /// /// 月报告主键 /// public static List GetIncentiveSortsByMonthReportId(string monthReportId) { return (from x in Funs.DB.Manager_IncentiveSortC where x.MonthReportId == monthReportId select x).ToList(); } /// /// 根据月报告主键获取总奖惩金额 /// /// 奖惩类型 /// 月报告主键 /// public static decimal? GetSumIncentiveMoneyByMonthReportId(string monthReportId, string incentiveType) { return (from x in Funs.DB.Manager_IncentiveSortC where x.MonthReportId == monthReportId && x.IncentiveType == incentiveType select x.IncentiveMoney).Sum(); } /// /// 增加月报告HSE奖惩情况信息 /// /// 月报告HSE奖惩情况实体 public static void AddIncentiveSort(Model.Manager_IncentiveSortC incentiveSort) { Model.SGGLDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_IncentiveSortC)); Model.Manager_IncentiveSortC newIncentiveSort = new Model.Manager_IncentiveSortC { IncentiveSortId = newKeyID, MonthReportId = incentiveSort.MonthReportId, IncentiveType = incentiveSort.IncentiveType, BigType = incentiveSort.BigType, IncentiveMoney = incentiveSort.IncentiveMoney, SortIndex = incentiveSort.SortIndex, IncentiveUnit = incentiveSort.IncentiveUnit, IncentiveDate = incentiveSort.IncentiveDate, IncentiveReason = incentiveSort.IncentiveReason, IncentiveBasis = incentiveSort.IncentiveBasis }; db.Manager_IncentiveSortC.InsertOnSubmit(newIncentiveSort); db.SubmitChanges(); } /// /// 根据月报告主键删除对应的所有月报告HSE奖惩情况信息 /// /// 月报告主键 public static void DeleteIncentiveSortsByMonthReportId(string monthReportId) { var q = (from x in db.Manager_IncentiveSortC where x.MonthReportId == monthReportId select x).ToList(); db.Manager_IncentiveSortC.DeleteAllOnSubmit(q); db.SubmitChanges(); } } }