public List <WellCompletion> GetCompletionsBySearchDate(GenericSearch search)
        {
            try
            {
                var wellCompletions = new WellCompletionServices().GetAllOrderedCompletionsByMonth(search.Month, search.Year);

                if (!wellCompletions.Any())
                {
                    return(new List <WellCompletion>());
                }

                wellCompletions.ForEach(m =>
                {
                    m.EquipmentName          = m.Equipment.Name;
                    m.WellName               = m.Well.Name;
                    m.WellCompletionTypeName = m.WellCompletionType.Type;
                    m.EquipmentName          = m.Equipment.Name;
                });
                return(wellCompletions);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message);
                return(new List <WellCompletion>());
            }
        }
        public ViewResult WellCompletionIntervals()
        {
            var wellCompletionList = new WellCompletionServices().GetAllOrderedWellCompletions() ?? new List <WellCompletion>();

            if (!wellCompletionList.Any())
            {
                ViewBag.Edit  = 1;
                ViewBag.Title = "Well Completion SetUp";
                var wellCompletionTypeList = new WellCompletionTypeServices().GetAllOrderedWellCompletionTypes() ?? new List <WellCompletionType>();

                if (!wellCompletionTypeList.Any())
                {
                    ViewBag.Edit  = 0;
                    ViewBag.Title = "Well Completion Type SetUp";
                    return(View("~/Views/WellCompletionType/WellCompletionTypes.cshtml", new List <WellCompletionType>()));
                }
            }

            wellCompletionList.ForEach(m =>
            {
                m.WellName = m.Well.Name;
                m.WellCompletionTypeName = m.WellCompletionType.Type;
                m.EquipmentName          = m.Equipment.Name;
            });

            var wellCompletionIntervalList = new WellCompletionIntervalServices().GetAllOrderedWellCompletionIntervals() ?? new List <WellCompletionInterval>();

            if (!wellCompletionIntervalList.Any())
            {
                ViewBag.Edit  = 0;
                ViewBag.Title = "Well Completion Interval SetUp";
                return(View(Tuple.Create(wellCompletionList, new List <WellCompletionInterval>())));
            }

            wellCompletionIntervalList.ForEach(m =>
            {
                m.DatecomPletedString = m.DateCompleted;
                m.WellName            = wellCompletionList.Find(x => x.WellId == m.WellCompletion.WellId).Well.Name;
            });

            var txx = Tuple.Create(wellCompletionList, wellCompletionIntervalList);

            ViewBag.Title = "Manage Well Completion Intervals";
            return(View(txx));
        }
        private List <WellCompletion> GetWellComletions(int itemsPerPage, int pageNumber, out int dataCount)
        {
            try
            {
                var wellCompletions = new WellCompletionServices().GetAllOrderedWellCompletions(itemsPerPage, pageNumber, out dataCount);

                if (!wellCompletions.Any())
                {
                    dataCount          = 0;
                    ViewBag.TotalPages = 0;
                    ViewBag.Page       = 1;
                    return(new List <WellCompletion>());
                }
                ViewBag.PrDataCount = dataCount.ToString(CultureInfo.InvariantCulture);

                var totalPages = dataCount / itemsPerPage;

                if (dataCount % itemsPerPage != 0)
                {
                    totalPages++;
                }

                ViewBag.PrTotalPages = totalPages;
                ViewBag.PrPage       = pageNumber;
                wellCompletions.ForEach(m =>
                {
                    m.WellName = m.Well.Name;
                    m.WellCompletionTypeName = m.WellCompletionType.Type;
                    m.EquipmentName          = m.Equipment.Name;
                });

                return(wellCompletions);
            }
            catch (Exception ex)
            {
                dataCount          = 0;
                ViewBag.TotalPages = 0;
                ViewBag.Page       = 1;
                return(new List <WellCompletion>());
            }
        }
Пример #4
0
        private List <DocObject> GetYears()
        {
            var jxs = new WellCompletionServices().GetWellCompletionYears();

            if (!jxs.Any())
            {
                return(new List <DocObject>());
            }
            var tdv = new List <DocObject>();

            jxs.ForEach(m =>
            {
                var ts = int.Parse(m);

                if (!tdv.Exists(t => t.DocId == ts))
                {
                    tdv.Add(new DocObject {
                        DocName = m, DocId = ts
                    });
                }
            });
            return(tdv.OrderByDescending(m => m.DocName).ToList());
        }