using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
    /// 
    /// 应急演练开展情况季报明细表
    /// 
    public static class DrillConductedQuarterlyReportItemService
    {
        /// 
        /// 根据主键获取应急演练开展情况季报表明细信息
        /// 
        /// 
        /// 
        public static Model.Information_DrillConductedQuarterlyReportItem GetDrillConductedQuarterlyReportItemById(string drillConductedQuarterlyReportItemId)
        {
            return Funs.DB.Information_DrillConductedQuarterlyReportItem.FirstOrDefault(e => e.DrillConductedQuarterlyReportItemId == drillConductedQuarterlyReportItemId);
        }
        /// 
        /// 根据应急演练开展情况季报Id获取所有相关明细信息
        /// 
        /// 
        /// 
        public static List GetDrillConductedQuarterlyReportItemList(string drillConductedQuarterlyReportId)
        {
            return (from x in Funs.DB.Information_DrillConductedQuarterlyReportItem where x.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId orderby x.SortIndex select x).ToList();
        }
        /// 
        /// 添加应急演练开展情况季报明细信息
        /// 
        /// 
        public static void AddDrillConductedQuarterlyReportItem(Model.Information_DrillConductedQuarterlyReportItem drillConductedQuarterlyReportItem)
        {
            Model.Information_DrillConductedQuarterlyReportItem newDrillConductedQuarterlyReportItem = new Model.Information_DrillConductedQuarterlyReportItem
            {
                DrillConductedQuarterlyReportItemId = drillConductedQuarterlyReportItem.DrillConductedQuarterlyReportItemId,
                DrillConductedQuarterlyReportId = drillConductedQuarterlyReportItem.DrillConductedQuarterlyReportId,
                IndustryType = drillConductedQuarterlyReportItem.IndustryType,
                TotalConductCount = drillConductedQuarterlyReportItem.TotalConductCount,
                TotalPeopleCount = drillConductedQuarterlyReportItem.TotalPeopleCount,
                TotalInvestment = drillConductedQuarterlyReportItem.TotalInvestment,
                HQConductCount = drillConductedQuarterlyReportItem.HQConductCount,
                HQPeopleCount = drillConductedQuarterlyReportItem.HQPeopleCount,
                HQInvestment = drillConductedQuarterlyReportItem.HQInvestment,
                BasicConductCount = drillConductedQuarterlyReportItem.BasicConductCount,
                BasicPeopleCount = drillConductedQuarterlyReportItem.BasicPeopleCount,
                BasicInvestment = drillConductedQuarterlyReportItem.BasicInvestment,
                ComprehensivePractice = drillConductedQuarterlyReportItem.ComprehensivePractice,
                CPScene = drillConductedQuarterlyReportItem.CPScene,
                CPDesktop = drillConductedQuarterlyReportItem.CPDesktop,
                SpecialDrill = drillConductedQuarterlyReportItem.SpecialDrill,
                SDScene = drillConductedQuarterlyReportItem.SDScene,
                SDDesktop = drillConductedQuarterlyReportItem.SDDesktop,
                SortIndex = drillConductedQuarterlyReportItem.SortIndex
            };
            Funs.DB.Information_DrillConductedQuarterlyReportItem.InsertOnSubmit(newDrillConductedQuarterlyReportItem);
            Funs.DB.SubmitChanges();
        }
        /// 
        /// 修改应急演练开展情况季报明细信息
        /// 
        /// 
        public static void UpdateDrillConductedQuarterlyReportItem(Model.Information_DrillConductedQuarterlyReportItem drillConductedQuarterlyReportItem)
        {
            Model.Information_DrillConductedQuarterlyReportItem newDrillConductedQuarterlyReportItem = Funs.DB.Information_DrillConductedQuarterlyReportItem.FirstOrDefault(e => e.DrillConductedQuarterlyReportItemId == drillConductedQuarterlyReportItem.DrillConductedQuarterlyReportItemId);
            if (newDrillConductedQuarterlyReportItem != null)
            {
                newDrillConductedQuarterlyReportItem.IndustryType = drillConductedQuarterlyReportItem.IndustryType;
                newDrillConductedQuarterlyReportItem.TotalConductCount = drillConductedQuarterlyReportItem.TotalConductCount;
                newDrillConductedQuarterlyReportItem.TotalPeopleCount = drillConductedQuarterlyReportItem.TotalPeopleCount;
                newDrillConductedQuarterlyReportItem.TotalInvestment = drillConductedQuarterlyReportItem.TotalInvestment;
                newDrillConductedQuarterlyReportItem.HQConductCount = drillConductedQuarterlyReportItem.HQConductCount;
                newDrillConductedQuarterlyReportItem.HQPeopleCount = drillConductedQuarterlyReportItem.HQPeopleCount;
                newDrillConductedQuarterlyReportItem.HQInvestment = drillConductedQuarterlyReportItem.HQInvestment;
                newDrillConductedQuarterlyReportItem.BasicConductCount = drillConductedQuarterlyReportItem.BasicConductCount;
                newDrillConductedQuarterlyReportItem.BasicPeopleCount = drillConductedQuarterlyReportItem.BasicPeopleCount;
                newDrillConductedQuarterlyReportItem.BasicInvestment = drillConductedQuarterlyReportItem.BasicInvestment;
                newDrillConductedQuarterlyReportItem.ComprehensivePractice = drillConductedQuarterlyReportItem.ComprehensivePractice;
                newDrillConductedQuarterlyReportItem.CPScene = drillConductedQuarterlyReportItem.CPScene;
                newDrillConductedQuarterlyReportItem.CPDesktop = drillConductedQuarterlyReportItem.CPDesktop;
                newDrillConductedQuarterlyReportItem.SpecialDrill = drillConductedQuarterlyReportItem.SpecialDrill;
                newDrillConductedQuarterlyReportItem.SDScene = drillConductedQuarterlyReportItem.SDScene;
                newDrillConductedQuarterlyReportItem.SDDesktop = drillConductedQuarterlyReportItem.SDDesktop;
                newDrillConductedQuarterlyReportItem.SortIndex = drillConductedQuarterlyReportItem.SortIndex;
                Funs.DB.SubmitChanges();
            }
        }
        /// 
        /// 根据主键删除应急演练开展情况季报明细信息
        /// 
        /// 
        public static void DeleteDrillConductedQuarterlyReportItemById(string drillConductedQuarterlyReportItemId)
        {
            Model.Information_DrillConductedQuarterlyReportItem drillConductedQuarterlyReportItem = Funs.DB.Information_DrillConductedQuarterlyReportItem.FirstOrDefault(e => e.DrillConductedQuarterlyReportItemId == drillConductedQuarterlyReportItemId);
            if (drillConductedQuarterlyReportItem != null)
            {
                Funs.DB.Information_DrillConductedQuarterlyReportItem.DeleteOnSubmit(drillConductedQuarterlyReportItem);
                Funs.DB.SubmitChanges();
            }
        }
        /// 
        /// 根据应急演练开展情况季报主表id删除所有相关明细信息
        /// 
        /// 
        public static void DeleteDrillConductedQuarterlyReportItemList(string drillConductedQuarterlyReportId)
        {
            var q = (from x in Funs.DB.Information_DrillConductedQuarterlyReportItem where x.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId select x).ToList();
            if (q != null)
            {
                Funs.DB.Information_DrillConductedQuarterlyReportItem.DeleteAllOnSubmit(q);
                Funs.DB.SubmitChanges();
            }
        }
    }
}