public static DailyReportsTotal ObjectToDailyReportsTotal(dynamic newDailyReport, int assetId, short reportType) { DailyReportsTotal dailyReportTotal = new DailyReportsTotal(); dailyReportTotal.AssetId = assetId; dailyReportTotal.Date = Convert.ToDateTime(newDailyReport.date); dailyReportTotal.FacilityName = Convert.ToString(newDailyReport.facility_name); dailyReportTotal.FieldName = Convert.ToString(newDailyReport.field_name); dailyReportTotal.ReportType = reportType; dailyReportTotal.OilProdAllocated = convertToDecimal(newDailyReport.oil_prod_allocated); dailyReportTotal.OilProdTarget = convertToDecimal(newDailyReport.oil_prod_target); dailyReportTotal.OilProdMtd = convertToDecimal(newDailyReport.oil_prod_MTD); dailyReportTotal.OilProdYtd = convertToDecimal(newDailyReport.oil_prod_YTD); dailyReportTotal.CondensateProdAllocated = convertToDecimal(newDailyReport.condensate_prod_allocated); dailyReportTotal.CondensateExportAllocated = convertToDecimal(newDailyReport.condensate_export_allocated); dailyReportTotal.CondensateStockInitial = convertToDecimal(newDailyReport.condensate_stock_initial); dailyReportTotal.CondensateStockFinal = convertToDecimal(newDailyReport.condensate_stock_final); dailyReportTotal.LpgProdAllocated = convertToDecimal(newDailyReport.LPG_prod_allocated); dailyReportTotal.LpgExportAllocated = convertToDecimal(newDailyReport.LPG_export_allocated); dailyReportTotal.LpgStockInitial = convertToDecimal(newDailyReport.LPG_stock_initial); dailyReportTotal.LpgStockFinal = convertToDecimal(newDailyReport.LPG_stock_final); dailyReportTotal.LpgSpiking = convertToDecimal(newDailyReport.LPG_spiking); dailyReportTotal.GasProdAllocated = convertToDecimal(newDailyReport.gas_prod_allocated); dailyReportTotal.GasProdTarget = convertToDecimal(newDailyReport.gas_prod_target); dailyReportTotal.GasProdMtd = convertToDecimal(newDailyReport.gas_prod_MTD); dailyReportTotal.GasProdYtd = convertToDecimal(newDailyReport.gas_prod_YTD); dailyReportTotal.GasExportAllocated = convertToDecimal(newDailyReport.gas_export_allocated); dailyReportTotal.GasExportTarget = convertToDecimal(newDailyReport.gas_export_target); dailyReportTotal.GasExportMtd = convertToDecimal(newDailyReport.gas_export_MTD); dailyReportTotal.GasExportYtd = convertToDecimal(newDailyReport.gas_export_YTD); dailyReportTotal.GasImportAllocated = convertToDecimal(newDailyReport.gas_import_allocated); dailyReportTotal.GasImportMtd = convertToDecimal(newDailyReport.gas_import_MTD); dailyReportTotal.GasInjAllocated = convertToDecimal(newDailyReport.gas_inj_allocated); dailyReportTotal.GasInjTarget = convertToDecimal(newDailyReport.gas_inj_target); dailyReportTotal.GasInjMtd = convertToDecimal(newDailyReport.gas_inj_MTD); dailyReportTotal.GasInjYtd = convertToDecimal(newDailyReport.gas_inj_YTD); dailyReportTotal.WaterProdAllocated = convertToDecimal(newDailyReport.water_prod_allocated); dailyReportTotal.WaterProdTarget = convertToDecimal(newDailyReport.water_prod_target); dailyReportTotal.WaterProdMtd = convertToDecimal(newDailyReport.water_prod_MTD); dailyReportTotal.WaterProdYtd = convertToDecimal(newDailyReport.water_prod_YTD); dailyReportTotal.WaterInjAllocated = convertToDecimal(newDailyReport.water_inj_allocated); dailyReportTotal.WaterInjProduced = convertToDecimal(newDailyReport.water_inj_produced); dailyReportTotal.WaterInjTarget = convertToDecimal(newDailyReport.water_inj_target); dailyReportTotal.WaterInjMtd = convertToDecimal(newDailyReport.water_inj_MTD); dailyReportTotal.WaterInjYtd = convertToDecimal(newDailyReport.water_inj_YTD); dailyReportTotal.GasLiftAllocated = convertToDecimal(newDailyReport.gas_lift_allocated); dailyReportTotal.OilLossAllocated = convertToDecimal(newDailyReport.oil_loss_allocated); dailyReportTotal.FlareGasAllocated = convertToDecimal(newDailyReport.flare_gas_allocated); dailyReportTotal.FuelGasAllocated = convertToDecimal(newDailyReport.fuel_gas_allocated); dailyReportTotal.Co2Extracted = convertToDecimal(newDailyReport.CO2_extracted); dailyReportTotal.WaterDischarged = convertToDecimal(newDailyReport.water_discharged); dailyReportTotal.BsW = convertToDecimal(newDailyReport.BS_W); return(dailyReportTotal); }
/** * DailyProductionTotal */ public static List <DailyReportsTotal> ObjectToDailyProductionTotalList(dynamic newDailyReports, int assetId, short reportType) { List <DailyReportsTotal> dailyProdTotalList = new List <DailyReportsTotal>(); foreach (dynamic newDailyProdReport in newDailyReports) { DailyReportsTotal dailyProdReport = ObjectToDailyReportsTotal(newDailyProdReport, assetId, reportType); dailyProdTotalList.Add(dailyProdReport); } return(dailyProdTotalList); // Add field to database // Add parent_report to database and to field/facility }