using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
    /// 
    /// 伤害事故统计
    /// 
    public class InjuryAccidentCService
    {
        /// 
        /// 根据月报ID获取伤害事故统计
        /// 
        /// 
        /// 
        public static List GetInjuryAccidentCByMonthReportId(string monthReportId)
        {
            return (from x in Funs.DB.Manager_Month_InjuryAccidentC where x.MonthReportId == monthReportId select x).ToList();
        }
        /// 
        /// 添加伤害事故统计
        /// 
        /// 
        public static void AddInjuryAccidentC(Model.Manager_Month_InjuryAccidentC injuryAccident)
        {
            Model.Manager_Month_InjuryAccidentC newInjuryAccident = new Model.Manager_Month_InjuryAccidentC
            {
                InjuryAccidentId = injuryAccident.InjuryAccidentId,
                MonthReportId = injuryAccident.MonthReportId,
                UnitName = injuryAccident.UnitName,
                AttemptedIncidents = injuryAccident.AttemptedIncidents,
                FirstAidDressing = injuryAccident.FirstAidDressing,
                MedicalTreatment = injuryAccident.MedicalTreatment,
                WorkLimitation = injuryAccident.WorkLimitation,
                LossPerson = injuryAccident.LossPerson,
                LossWorkTime = injuryAccident.LossWorkTime,
                LossEconomy = injuryAccident.LossEconomy,
                DeathPerson = injuryAccident.DeathPerson,
                DeathWorkTime = injuryAccident.DeathWorkTime,
                DeathEconomy = injuryAccident.DeathEconomy
            };
            Funs.DB.Manager_Month_InjuryAccidentC.InsertOnSubmit(newInjuryAccident);
            Funs.DB.SubmitChanges();
        }
        /// 
        /// 根据月报ID删除伤害事故
        /// 
        /// 
        public static void DeleteInjuryAccidengtByMonthReportId(string montReportId)
        {
            var q = (from x in Funs.DB.Manager_Month_InjuryAccidentC where x.MonthReportId == montReportId select x).ToList();
            if (q != null)
            {
                Funs.DB.Manager_Month_InjuryAccidentC.DeleteAllOnSubmit(q);
                Funs.DB.SubmitChanges();
            }
        }
    }
}