public GeneralEquipmentRelatedItemsCount GetPipeRelatedItemsCount(int pipeId) { using (CmsEntities cee = new CmsEntities()) { GeneralEquipmentRelatedItemsCount itemsCount = new GeneralEquipmentRelatedItemsCount(); itemsCount.Attachments = (from x in cee.PipeAttachments where x.PipeId == pipeId select x).Count(); itemsCount.PropertyOrComponents = (from x in cee.PipeComponents where x.PipeId == pipeId select x).Count(); itemsCount.Documents = (from x in cee.DocumentEquipments where x.EquipmentId == pipeId && x.EquipmentTypeId == (int)CommonUtils.EquipmentTypeCode.PIPE select x).Count(); itemsCount.Issues = (from x in cee.IssueRelatedPipes where x.PipeId == pipeId select x).Count(); return itemsCount; } }
public GeneralEquipmentRelatedItemsCount GetElectricalRelatedItemsCount(int electricalId) { using (CmsEntities cee = new CmsEntities()) { GeneralEquipmentRelatedItemsCount itemsCount = new GeneralEquipmentRelatedItemsCount(); itemsCount.Attachments = (from x in cee.ElectricalEquipmentAttachments where x.ElectricalEquipmentId == electricalId select x).Count(); itemsCount.PropertyOrComponents = (from x in cee.ElectricalEquipmentComponents where x.ElectricalEquipmentId == electricalId select x).Count(); itemsCount.Documents = (from x in cee.DocumentEquipments where x.EquipmentId == electricalId && x.EquipmentTypeId == (int)CommonUtils.EquipmentTypeCode.ELECT select x).Count(); itemsCount.Issues = (from x in cee.IssueRelatedElectricalEquipments where x.ElectricalEquipmentId == electricalId select x).Count(); return itemsCount; } }
public GeneralEquipmentRelatedItemsCount GetInstrumentRelatedItemsCount(int instrumentId) { using (CmsEntities cee = new CmsEntities()) { GeneralEquipmentRelatedItemsCount itemsCount = new GeneralEquipmentRelatedItemsCount(); itemsCount.Attachments = (from x in cee.InstrumentAttachments where x.InstrumentId == instrumentId select x).Count(); itemsCount.Calibrations = (from x in cee.CalibrationComponents where x.InstrumentId == instrumentId select x).Count(); itemsCount.PropertyOrComponents = (from x in cee.InstrumentComponents where x.InstrumentId == instrumentId select x).Count(); itemsCount.Documents = (from x in cee.DocumentEquipments where x.EquipmentId == instrumentId && x.EquipmentTypeId == (int)CommonUtils.EquipmentTypeCode.INSTR select x).Count(); itemsCount.Issues = (from x in cee.IssueRelatedInstruments where x.InstrumentId == instrumentId select x).Count(); return itemsCount; } }
public GeneralEquipmentRelatedItemsCount GetControlSystemRelatedItemsCount(int controlSystemId) { using (var cee = new CmsEntities()) { var itemsCount = new GeneralEquipmentRelatedItemsCount(); itemsCount.PropertyOrComponents = (from x in cee.ControlSystemComponents where x.ControlSystemId == controlSystemId select x).Count(); itemsCount.Interlocks = (from x in cee.Interlocks where x.ControlSystemId == controlSystemId select x).Count(); itemsCount.Attachments = (from x in cee.ControlSystemAttachments where x.ControlSystemId == controlSystemId select x).Count(); itemsCount.Documents = (from x in cee.DocumentEquipments where x.EquipmentId == controlSystemId && x.EquipmentTypeId == (int)CommonUtils.EquipmentTypeCode.CONTR select x).Count(); itemsCount.Issues = (from x in cee.IssueRelatedControlSystems where x.ControlSystemId == controlSystemId select x).Count(); return itemsCount; } }