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>());
            }
        }
Beispiel #2
0
        public ActionResult GetWellCompletions2(int queryId)
        {
            if (queryId < 1)
            {
                return(Json(new List <WellCompletionReportObject>(), JsonRequestBehavior.AllowGet));
            }

            var query = new WellCompletionQueryBuilderServices().GetWellCompletionQuery(queryId);

            if (query == null || query.WellCompletionQueryId < 1)
            {
                return(Json(new List <WellCompletionReportObject>(), JsonRequestBehavior.AllowGet));
            }

            var wellCompletionList = new WellCompletionServices().GetWellCompletionReports(query) ?? new List <WellCompletionReportObject>();

            if (!wellCompletionList.Any())
            {
                return(Json(new List <WellCompletionReportObject>(), JsonRequestBehavior.AllowGet));
            }

            var jsonResult = Json(wellCompletionList, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
        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 <WellCompletionObject> GetWellComletionObjects(int itemsPerPage, int pageNumber)
        {
            try
            {
                var wellCompletions = new WellCompletionServices().GetWellObjects(itemsPerPage, pageNumber);

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

                return(wellCompletions);
            }
            catch (Exception ex)
            {
                return(new List <WellCompletionObject>());
            }
        }
        private List <WellCompletionReportObject> GetWellCompletionStaticReports(int itemsPerPage, int pageNumber, GenericSearch search)
        {
            try
            {
                var wellCompletions = new WellCompletionServices().GetWellStaticCompletionReport(itemsPerPage, pageNumber, search.Month, search.Year);

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


                return(wellCompletions);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message);
                return(new List <WellCompletionReportObject>());
            }
        }
        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>());
            }
        }
        private List <WellCompletion> GetWellComletionReportByQueryPeriods(GenericSearch search)
        {
            try
            {
                var wellCompletions = new WellCompletionServices().GetAllOrderedWellCompletionReportByPeriod(search.Month, search.Year);

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

                return(wellCompletions);
            }
            catch (Exception ex)
            {
                //dataCount = 0;
                //ViewBag.TotalPages = 0;
                //ViewBag.Page = 1;
                return(new List <WellCompletion>());
            }
        }
Beispiel #8
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());
        }
Beispiel #9
0
        public ActionResult GetWellCompletions(WellCompletionQuery queryBuilder)
        {
            if (queryBuilder == null)
            {
                return(Json(new List <WellCompletionReportObject>(), JsonRequestBehavior.AllowGet));
            }

            if (queryBuilder.EquipmentId < 1 && queryBuilder.WellTypeId < 1 && queryBuilder.CompanyId < 1 && ((queryBuilder.StartDate != null && queryBuilder.StartDate.Value.Year == 0001) || (queryBuilder.StartDate == null)) && ((queryBuilder.EndDate != null && queryBuilder.EndDate.Value.Year == 0001) || (queryBuilder.EndDate == null)) && queryBuilder.CompletionTypeId < 1 && queryBuilder.WellClassId < 1 && queryBuilder.TerrainId < 1 && queryBuilder.ZoneId < 1 && queryBuilder.WellId < 1)
            {
                return(Json(new List <WellCompletionReportObject>(), JsonRequestBehavior.AllowGet));
            }

            var wellCompletionList = new WellCompletionServices().GetWellCompletionReports(queryBuilder) ?? new List <WellCompletionReportObject>();

            if (!wellCompletionList.Any())
            {
                return(Json(new List <WellCompletionReportObject>(), JsonRequestBehavior.AllowGet));
            }
            Session["_successfulWellCompletionQuery"] = queryBuilder;
            var jsonResult = Json(wellCompletionList, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }