Exemplo n.º 1
0
        public async Task <CostVsDepthChart> GetCostVsDepth(string wellName)
        {
            // Preparing chart object
            var costvsDepthChart = new CostVsDepthChart();

            try
            {
                var well = await _drillingRepository.GetWellByName(wellName);

                // Getting data for AFE drill data
                costvsDepthChart.AFEs = _mapper.Map <List <DrillAFEDTO>, List <DrillAFE> >(await _drillingRepository.GetDrillAFEs(well.API10));

                costvsDepthChart.DailyCosts = _mapper.Map <List <DrillDailyCostDTO>, List <DrillDailyCost> >(await _drillingRepository.GetDrillDailyCosts(well.API10));

                costvsDepthChart.DrillVarianceCosts = _mapper.Map <List <DrillVarianceCostDTO>, List <DrillVarianceCost> >(await _drillingRepository.GetDrillVarianceCost(well.API10));

                // Getting data for AFE drill data for offset wells
                costvsDepthChart.DailyCostsForOffsetWells = _mapper.Map <List <DrillDailyCostDTO>, List <DrillDailyCost> >(await _drillingRepository.GetDrillDailyCostsForOffsetWells(well.API10));

                // Getting data for AFE drill mean data  cost offset wells
                costvsDepthChart.DailyMeanCosts = _mapper.Map <List <DrillMeanDailyCostDTO>, List <DrillMeanDailyCost> >(await _drillingRepository.GetDrillMeanDailyCosts(well.API10));
            }
            catch (Exception ex)
            {
                using (_logger.BeginScope(new Dictionary <string, object> {
                    { "Drilling", "GetCostVsDepth" }
                }))
                {
                    _logger.LogError(ex.StackTrace);
                }
            }
            return(costvsDepthChart);
        }
        public async Task <string> GetUserPermissions(string wellName, List <string> value)
        {
            try
            {
                // converting list to comma seprated to perform in operation
                var groupsString = string.Join(",", value);

                // Get Well Details
                var well = await _drillingRepository.GetWellByName(wellName);

                // get user permissions
                var permission = await _userRepository.GetUserPermission(well.API10, groupsString);


                var response = new { Permission = permission };
                return(JsonConvert.SerializeObject(response));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }