public List <IntermediateDetails> GetAllIntermediateDetails(string componentType = null, string intermediateType = null) { List <IntermediateDetails> detailsLst = new List <IntermediateDetails>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllIntermediateDetails; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.componentType}", componentType == null ? DBNull.Value : componentType), new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.intermediateType}", intermediateType == null ? DBNull.Value : intermediateType) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsLst = result.Tables[0].AsEnumerable().Select(dataRow => new IntermediateDetails { id = dataRow.Field <long>("id"), componentType = dataRow.Field <string>("componentType"), intermediateType = dataRow.Field <string>("intermediateType"), locations = dataRow.Field <int?>("locations"), drivenBy = dataRow.Field <string>("drivenBy"), speedChangesMax = dataRow.Field <int?>("speedChangesMax"), componentCode = dataRow.Field <decimal?>("componentCode") }).ToList(); } return(detailsLst); }
public List <CSDMdefsDetails> GetAllCSDMdefsDetails(string csdmFile = null) { List <CSDMdefsDetails> detailsLst = new List <CSDMdefsDetails>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllCSDMdefsDetails; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.csdmfile}", csdmFile == null ? DBNull.Value : csdmFile) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsLst = result.Tables[0].AsEnumerable().Select(dataRow => new CSDMdefsDetails { id = dataRow.Field <long>("id"), csdmfile = dataRow.Field <string>("CSDMfile"), componentCodeRangeStart = dataRow.Field <decimal?>("componentcoderangestart"), componentCodeRangeEnd = dataRow.Field <decimal?>("componentcoderangeend"), csdmSize = dataRow.Field <int?>("CSDMsize"), csdmRelative = dataRow.Field <bool?>("CSDMrelative"), defaultShaftLabel = dataRow.Field <string>("defaultshaftlabel") }).ToList(); } return(detailsLst); }
public List <Coupling2Details> GetAllCoupling2Details(string componentType = null, string couplingType = null) { List <Coupling2Details> detailsLst = new List <Coupling2Details>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllCoupling2Details; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.componentType}", componentType == null ? DBNull.Value : componentType), new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.couplingType}", couplingType == null ? DBNull.Value : couplingType) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsLst = result.Tables[0].AsEnumerable().Select(dataRow => new Coupling2Details { id = dataRow.Field <long>("id"), componentType = dataRow.Field <string>("componentType"), couplingPosition = dataRow.Field <int?>("couplingPosition"), couplingType = dataRow.Field <string>("couplingType"), locations = dataRow.Field <int?>("locations"), coupledComponentType1 = dataRow.Field <string>("coupledComponentType1"), coupledComponentType2 = dataRow.Field <string>("coupledComponentType2"), componentCode = dataRow.Field <decimal?>("componentCode") }).ToList(); } return(detailsLst); }
public List <SpecialFaultCodesDetails> GetAllSpecialFaultCodesDetails(string specialCode = null, string specialFaultCodesType = null) { List <SpecialFaultCodesDetails> detailsLst = new List <SpecialFaultCodesDetails>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllSpecialFaultCodesDetails; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.specialFaultCodesType}", specialFaultCodesType == null ? DBNull.Value : specialFaultCodesType), new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.specialCode}", specialCode == null ? DBNull.Value : specialCode) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsLst = result.Tables[0].AsEnumerable().Select(dataRow => new SpecialFaultCodesDetails { id = dataRow.Field <long>("id"), specialfaultcodetype = dataRow.Field <string>("specialfaultcodetype"), specialcode = dataRow.Field <string>("specialcode"), specialmultiple = dataRow.Field <int?>("specialmultiple"), componentType = dataRow.Field <string>("componentType"), componentTypeSub1 = dataRow.Field <string>("componentTypeSub1"), componentTypeSub2 = dataRow.Field <string>("componentTypeSub2") }).ToList(); } return(detailsLst); }
public List <PickupCodeDetails> GetAllPickupCodeDetails() { List <PickupCodeDetails> detailsLst = new List <PickupCodeDetails>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllPickupCodeDetails; List <SqlParameter> allParams = new List <SqlParameter>(); DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsLst = result.Tables[0].AsEnumerable().Select(dataRow => new PickupCodeDetails { id = dataRow.Field <int>("id"), driverLocations = dataRow.Field <int>("driverLocations"), driverLocationNDE = dataRow.Field <bool>("driverLocationNDE"), driverLocationDE = dataRow.Field <bool>("driverLocationDE"), intermediateLocations = dataRow.Field <int>("intermediateLocations"), intermediatepresent = dataRow.Field <bool>("intermediatepresent"), drivenLocations = dataRow.Field <int>("drivenLocations"), drivenLocationDE = dataRow.Field <bool>("drivenLocationDE"), drivenLocationNDE = dataRow.Field <bool>("drivenLocationNDE"), driverPickupCode = dataRow.Field <string>("driverPickupCode"), coupling1PickupCode = dataRow.Field <string>("coupling1PickupCode"), intermediatePickupCode = dataRow.Field <string>("intermediatePickupCode"), coupling2PickupCode = dataRow.Field <string>("coupling2PickupCode"), drivenPickupCode = dataRow.Field <string>("drivenPickupCode"), spindle_shaft_with_2locations = dataRow.Field <bool>("spindle_shaft_with_2locations") }).ToList(); } return(detailsLst); }
public List <DrivenDetails> GetAllDrivenDetails(string componentType = null, string drivenType = null) { List <DrivenDetails> detailsList = new List <DrivenDetails>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllDrivenDetails; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.componentType}", componentType == null ? DBNull.Value : componentType), new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.drivenType}", drivenType == null ? DBNull.Value : drivenType) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsList = result.Tables[0].AsEnumerable().Select(dataRow => new DrivenDetails { id = dataRow.Field <long>("id"), componentType = dataRow.Field <string>("componentType"), locations = dataRow.Field <int?>("locations"), drivenType = dataRow.Field <string>("drivenType"), pumpType = dataRow.Field <string>("pumpType"), compressorType = dataRow.Field <string>("compressorType"), fan_or_blowerType = dataRow.Field <string>("fan_or_blowerType"), purifierDrivenBy = dataRow.Field <string>("purifierDrivenBy"), bearingType = dataRow.Field <string>("bearingType"), vacuumPumpType = dataRow.Field <string>("vacuumPumpType"), spindleShaftBearing = dataRow.Field <string>("spindleShaftBearing"), rotorOverhung = dataRow.Field <bool?>("rotorOverhung"), attachedOilPump = dataRow.Field <bool?>("attachedOilPump"), impellerOnMainShaft = dataRow.Field <bool?>("impellerOnMainShaft"), crankHasIntermediateBearing = dataRow.Field <bool?>("crankHasIntermediateBearing"), fanStages = dataRow.Field <bool?>("fanStages"), exciter = dataRow.Field <bool?>("exciter"), centrifugalPumpHasBallBearings = dataRow.Field <bool?>("centrifugalPumpHasBallBearings"), propellerpumpHasBallBearings = dataRow.Field <bool?>("propellerpumpHasBallBearings"), rotaryThreadPumpHasBallBearings = dataRow.Field <bool?>("rotaryThreadPumpHasBallBearings"), gearPumpHasBallBearings = dataRow.Field <bool?>("gearPumpHasBallBearings"), screwPumpHasBallBearings = dataRow.Field <bool?>("screwPumpHasBallBearings"), slidingVanePumpHasBallBearings = dataRow.Field <bool?>("slidingVanePumpHasBallBearings"), axialRecipPumpHasBallBearings = dataRow.Field <bool?>("axialRecipPumpHasBallBearings"), centrifugalCompressorHasBallBearings = dataRow.Field <bool?>("centrifugalCompressorHasBallBearings"), reciprocatingCompressorHasBallBearings = dataRow.Field <bool?>("reciprocatingCompressorHasBallBearings"), screwCompressorHasBallBearings = dataRow.Field <bool?>("screwCompressorHasBallBearings"), screwTwinCompressorHasBallBearingsOnHPSide = dataRow.Field <bool?>("screwTwinCompressorHasBallBearingsOnHPSide"), lobedFanOrBlowerHasBallBearings = dataRow.Field <bool?>("lobedFanOrBlowerHasBallBearings"), overhungRotorFanOrBlowerHasBearings = dataRow.Field <bool?>("overhungRotorFanOrBlowerHasBearings"), supportedRotorFanOrBlowerHasBearings = dataRow.Field <bool?>("supportedRotorFanOrBlowerHasBearings"), exciterOverhungOrSupported = dataRow.Field <string>("exciterOverhungOrSupported"), bearingsType = dataRow.Field <string>("bearingsType"), thrustBearing = dataRow.Field <string>("thrustBearing"), drivenBy = dataRow.Field <string>("drivenBy"), componentCode = dataRow.Field <decimal?>("componentCode") }).ToList(); } return(detailsList); }
public List <DriverDetails> GetAllDriverDetails(string componentType = null, string driverType = null) { List <DriverDetails> detailsLst = new List <DriverDetails>(); string spName = MIDDerivationLibrary.Models.Constants.spGetAllDriverDetails; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.componentType}", componentType == null ? DBNull.Value : componentType), new SqlParameter($"@{MIDDerivationLibrary.Models.Constants.driverType}", driverType == null ? DBNull.Value : driverType) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { detailsLst = result.Tables[0].AsEnumerable().Select(dataRow => new DriverDetails { id = dataRow.Field <long>("id"), componentType = dataRow.Field <string>("componentType"), locations = dataRow.Field <int?>("locations"), driverType = dataRow.Field <string>("driverType"), cylinders = dataRow.Field <int?>("cylinders"), motorDrive = dataRow.Field <string>("motorDrive"), motorFan = dataRow.Field <bool?>("motorFan"), motorBallBearings = dataRow.Field <bool?>("motorBallBearings"), drivenBallBearings = dataRow.Field <bool?>("drivenBallBearings"), drivenBalanceable = dataRow.Field <bool?>("drivenBalanceable"), motorPoles = dataRow.Field <int?>("motorPoles"), turbineReductionGear = dataRow.Field <bool?>("turbineReductionGear"), turbineRotorSupported = dataRow.Field <bool?>("turbineRotorSupported"), turbineBallBearing = dataRow.Field <bool?>("turbineBallBearing"), turbineThrustBearing = dataRow.Field <bool?>("turbineThrustBearing"), turbineThrustBearingIsBall = dataRow.Field <bool?>("turbineThrustBearingIsBall"), componentCode = dataRow.Field <decimal?>("componentCode") }).ToList(); } return(detailsLst); }
public MIDCodeDetails GenerareMIDCodes(string xml) { MIDCodeDetails details = new MIDCodeDetails(); string spName = Constants.spGenerareMIDCodesSPName; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{Constants.xmlInput}", xml) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { var driverData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Driver").FirstOrDefault(); var coupling1Data = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Coupling1").FirstOrDefault(); var coupling2Data = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Coupling2").FirstOrDefault(); var intermediateData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Intermediate").FirstOrDefault(); var drivenData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Driven").FirstOrDefault(); var faultCodeData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "FaultCodeMatrix").FirstOrDefault(); if (driverData != null) { details.driver = new DriverCodes() { ComponentCode = driverData[1].ToString(), PickupCode = driverData[2].ToString() } } ; if (coupling1Data != null) { details.coupling1 = new Codes() { ComponentCode = coupling1Data[1].ToString(), PickupCode = coupling1Data[2].ToString(), SpeedRatio = Convert.ToDecimal(coupling1Data[4]) } } ; if (coupling2Data != null) { details.coupling2 = new Codes() { ComponentCode = coupling2Data[1].ToString(), PickupCode = coupling2Data[2].ToString(), SpeedRatio = Convert.ToDecimal(coupling2Data[4]) } } ; if (intermediateData != null) { details.intermediate = new Codes() { ComponentCode = intermediateData[1].ToString(), PickupCode = intermediateData[2].ToString(), SpeedRatio = Convert.ToDecimal(intermediateData[4]) } } ; if (drivenData != null) { details.driven = new DrivenCodes() { ComponentCode = drivenData[1].ToString(), PickupCode = drivenData[2].ToString() } } ; if (faultCodeData != null) { var faultCodeMatrixJsonString = faultCodeData[3].ToString(); if (!string.IsNullOrEmpty(faultCodeMatrixJsonString)) { details.faultCodeMatrix = JsonConvert.DeserializeObject <FaultCodeMatrix>(faultCodeMatrixJsonString); } } } return(details); } } }
public MIDdeconstrutionResponse MIDCodeDeconstruction(string xml) { MIDdeconstrutionResponse details = new MIDdeconstrutionResponse(); string spName = Constants.spMIDCodeDeconstruction; List <SqlParameter> allParams = new List <SqlParameter>() { new SqlParameter($"@{Constants.xmlInput}", xml) }; DataSet result = sqlRepository.ExecuteQuery(spName, allParams); if (result != null && result.Tables[0].Rows.Count > 0) { var driverData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Driver").FirstOrDefault(); var coupling1Data = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Coupling1").FirstOrDefault(); var coupling2Data = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Coupling2").FirstOrDefault(); var intermediateData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Intermediate").FirstOrDefault(); var drivenData = result.Tables[0].AsEnumerable().ToList().Where(x => x.Field <string>("Component") == "Driven").FirstOrDefault(); if (driverData != null) { details.driver = new DriverForDeconstruction() { componentType = driverData[0].ToString(), locations = driverData[2] is DBNull ? null : Convert.ToInt32(driverData[2]), rpm = driverData[3] is DBNull ? null : Convert.ToInt32(driverData[3]), driverLocationDE = driverData[4] is DBNull ? null : Convert.ToBoolean(driverData[4]), driverLocationNDE = driverData[5] is DBNull ? null : Convert.ToBoolean(driverData[5]), driverType = driverData[6].ToString() }; if (!string.IsNullOrEmpty(driverData[12].ToString())) { details.driver.drivers = JsonConvert.DeserializeObject <DriversForDeconstruction>(driverData[12].ToString()); } } if (coupling1Data != null) { details.coupling1 = new Coupling1ForDeconstruction() { componentType = coupling1Data[0].ToString(), couplingPosition = coupling1Data[8] is DBNull ? null : Convert.ToInt32(coupling1Data[8]), couplingType = coupling1Data[9].ToString(), locations = coupling1Data[2] is DBNull ? null : Convert.ToInt32(coupling1Data[2]), speedratio = coupling1Data[7] is DBNull ? null : Convert.ToDecimal(coupling1Data[7]) }; } if (coupling2Data != null) { details.coupling2 = new Coupling2ForDeconstruction() { componentType = coupling2Data[0].ToString(), couplingPosition = coupling2Data[8] is DBNull ? null : Convert.ToInt32(coupling2Data[8]), couplingType = coupling2Data[9].ToString(), locations = coupling2Data[2] is DBNull ? null : Convert.ToInt32(coupling2Data[2]), speedratio = coupling2Data[7] is DBNull ? null : Convert.ToDecimal(coupling2Data[7]) }; } if (intermediateData != null) { details.intermediate = new IntermediateForDeconstruction() { componentType = intermediateData[0].ToString(), intermediateType = intermediateData[10].ToString(), locations = intermediateData[2] is DBNull ? null : Convert.ToInt32(intermediateData[2]), speedratio = intermediateData[7] is DBNull ? null : Convert.ToDecimal(intermediateData[7]) }; if (!string.IsNullOrEmpty(intermediateData[12].ToString())) { details.intermediate.intermediates = JsonConvert.DeserializeObject <IntermediatesForDeconstruction>(intermediateData[12].ToString()); } } if (drivenData != null) { details.driven = new DrivenForDeConstruction() { componentType = drivenData[0].ToString(), drivenLocationDE = drivenData[4] is DBNull ? null : Convert.ToBoolean(drivenData[4]), drivenLocationNDE = drivenData[5] is DBNull ? null : Convert.ToBoolean(drivenData[5]), locations = drivenData[2] is DBNull ? null : Convert.ToInt32(drivenData[2]), drivenType = drivenData[11].ToString() }; if (!string.IsNullOrEmpty(drivenData[12].ToString())) { details.driven.drivens = JsonConvert.DeserializeObject <DrivensForDeconstruction>(drivenData[12].ToString()); } } } return(details); }