using FineUIPro; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { /// /// 用电用气安全检查管理 /// public static class ElectricityandgassafetyinspectionService { #region 获取列表 /// /// 记录数 /// public static int Count { get; set; } public static IQueryable GetFireGasSafety_ElectricityAndGasSafetyInspectionByModle(Model.FireGasSafety_ElectricityAndGasSafetyInspection table) { var q = from x in Funs.DB.FireGasSafety_ElectricityAndGasSafetyInspection where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.Code) || x.Code.Contains(table.Code)) && (string.IsNullOrEmpty(table.Name) || x.Name.Contains(table.Name)) && (string.IsNullOrEmpty(table.CompileMan) || x.CompileMan.Contains(table.CompileMan)) select x ; return q; } /// /// 获取分页列表 /// /// /// /// public static IEnumerable GetListData(Model.FireGasSafety_ElectricityAndGasSafetyInspection table, Grid grid1) { var q = GetFireGasSafety_ElectricityAndGasSafetyInspectionByModle(table); Count = q.Count(); if (Count == 0) { return null; } q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize); return from x in q select new { x.Id, x.ProjectId, x.Code, x.Name, x.Content, x.CompileMan, x.CompileDate, }; } #endregion public static Model.FireGasSafety_ElectricityAndGasSafetyInspection GetById(string Id) { return Funs.DB.FireGasSafety_ElectricityAndGasSafetyInspection.FirstOrDefault(x => x.Id == Id); } public static void Add(Model.FireGasSafety_ElectricityAndGasSafetyInspection newtable) { Model.FireGasSafety_ElectricityAndGasSafetyInspection table = new Model.FireGasSafety_ElectricityAndGasSafetyInspection { Id = newtable.Id, ProjectId = newtable.ProjectId, Code = newtable.Code, Name = newtable.Name, Content = newtable.Content, IsRandomlyPullingWires = newtable.IsRandomlyPullingWires, IsGasAppliancesPipingNormal = newtable.IsGasAppliancesPipingNormal, IsPowerRoomStackingDebris = newtable.IsPowerRoomStackingDebris, IsHoursPowerDump = newtable.IsHoursPowerDump, IsSmoking = newtable.IsSmoking, IsOpenFlameConstruction = newtable.IsOpenFlameConstruction, IsViolationOfElectricityGas = newtable.IsViolationOfElectricityGas, IsEXITStackingDebris = newtable.IsEXITStackingDebris, IsFireProofDoorClosed = newtable.IsFireProofDoorClosed, IsEmergencyLampNormal = newtable.IsEmergencyLampNormal, IsEvacuationSignsNormal = newtable.IsEvacuationSignsNormal, IsFireExtinguisherNormal = newtable.IsFireExtinguisherNormal, IsFireExtinguisherMisapply = newtable.IsFireExtinguisherMisapply, IsMonitorNormal = newtable.IsMonitorNormal, IsFireproofCurtainStackingDebris = newtable.IsFireproofCurtainStackingDebris, IsPersonnelOnDuty = newtable.IsPersonnelOnDuty, IsFireProtectionSignsNormal = newtable.IsFireProtectionSignsNormal, FindFireHazards = newtable.FindFireHazards, HandlingSituation = newtable.HandlingSituation, Administrator = newtable.Administrator, AdministratorOpinion = newtable.AdministratorOpinion, CompileMan = newtable.CompileMan, CompileDate = newtable.CompileDate, }; Funs.DB.FireGasSafety_ElectricityAndGasSafetyInspection.InsertOnSubmit(table); Funs.DB.SubmitChanges(); } public static void Update(Model.FireGasSafety_ElectricityAndGasSafetyInspection newtable) { Model.FireGasSafety_ElectricityAndGasSafetyInspection table = Funs.DB.FireGasSafety_ElectricityAndGasSafetyInspection.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { table.Id = newtable.Id; table.ProjectId = newtable.ProjectId; table.Code = newtable.Code; table.Name = newtable.Name; table.Content = newtable.Content; table.IsRandomlyPullingWires = newtable.IsRandomlyPullingWires; table.IsGasAppliancesPipingNormal = newtable.IsGasAppliancesPipingNormal; table.IsPowerRoomStackingDebris = newtable.IsPowerRoomStackingDebris; table.IsHoursPowerDump = newtable.IsHoursPowerDump; table.IsSmoking = newtable.IsSmoking; table.IsOpenFlameConstruction = newtable.IsOpenFlameConstruction; table.IsViolationOfElectricityGas = newtable.IsViolationOfElectricityGas; table.IsEXITStackingDebris = newtable.IsEXITStackingDebris; table.IsFireProofDoorClosed = newtable.IsFireProofDoorClosed; table.IsEmergencyLampNormal = newtable.IsEmergencyLampNormal; table.IsEvacuationSignsNormal = newtable.IsEvacuationSignsNormal; table.IsFireExtinguisherNormal = newtable.IsFireExtinguisherNormal; table.IsFireExtinguisherMisapply = newtable.IsFireExtinguisherMisapply; table.IsMonitorNormal = newtable.IsMonitorNormal; table.IsFireproofCurtainStackingDebris = newtable.IsFireproofCurtainStackingDebris; table.IsPersonnelOnDuty = newtable.IsPersonnelOnDuty; table.IsFireProtectionSignsNormal = newtable.IsFireProtectionSignsNormal; table.FindFireHazards = newtable.FindFireHazards; table.HandlingSituation = newtable.HandlingSituation; table.Administrator = newtable.Administrator; table.AdministratorOpinion = newtable.AdministratorOpinion; table.CompileMan = newtable.CompileMan; table.CompileDate = newtable.CompileDate; Funs.DB.SubmitChanges(); } } public static void DeleteById(string Id) { Model.FireGasSafety_ElectricityAndGasSafetyInspection table = Funs.DB.FireGasSafety_ElectricityAndGasSafetyInspection.FirstOrDefault(x => x.Id == Id); if (table != null) { Funs.DB.FireGasSafety_ElectricityAndGasSafetyInspection.DeleteOnSubmit(table); Funs.DB.SubmitChanges(); } } } }