Example #1
0
        public ActionResult GetWellWorkovers2(int queryId)
        {
            if (queryId < 1)
            {
                return(Json(new List <WellWorkoverReportObject>(), JsonRequestBehavior.AllowGet));
            }

            var query = new WellWorkoverQueryBuilderServices().GetWellWorkoverQuery(queryId);

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

            var wellWorkoverList = new WellWorkoverServices().GetOrderedWellWorkoverReportObjects(query) ?? new List <WellWorkoverReportObject>();

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

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

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
        public List <WellWorkover> GetWorkoversBySearchDate(int searchMonth, int searchYear)
        {
            try
            {
                var wellWorkOvers = new WellWorkoverServices().GetAllOrderedWellWorkoversByMonth(searchMonth, searchYear);

                if (!wellWorkOvers.Any())
                {
                    return(new List <WellWorkover>());
                }

                wellWorkOvers.ForEach(m =>
                {
                    m.WellName      = m.Well.Name;
                    m.EquipmentName = m.Equipment.Name;
                    m.Reason        = m.WellWorkOverReason.Title;
                    m.MonthStr      = Enum.GetName(typeof(MonthList), m.Month);
                });
                return(wellWorkOvers);
            }
            catch (Exception ex)
            {
                return(new List <WellWorkover>());
            }
        }
        private List <WellWorkoverReportObject> GetWorkoverObjects(int pageNumber, int itemsPerPage, GenericSearch search)
        {
            try
            {
                var wellWorkoverObjects = new WellWorkoverServices().GetMoreWellWorkoverReport(itemsPerPage, pageNumber, search.Month, search.Year);

                if (!wellWorkoverObjects.Any())
                {
                    return(new List <WellWorkoverReportObject>());
                }

                return(wellWorkoverObjects);
            }
            catch (Exception ex)
            {
                return(new List <WellWorkoverReportObject>());
            }
        }
        private List <WellWorkover> GetWellWorkoverReports(int itemsPerPage, int pageNumber)
        {
            try
            {
                var wellWorkOvers = new WellWorkoverServices().GetWellWorkoversForReport(itemsPerPage, pageNumber);

                if (!wellWorkOvers.Any())
                {
                    return(new List <WellWorkover>());
                }

                return(wellWorkOvers);
            }
            catch (Exception ex)
            {
                return(new List <WellWorkover>());
            }
        }
        private List <WellWorkoverReportObject> GetWellWorkOverObjects(int itemsPerPage, int pageNumber)
        {
            try
            {
                var wellCompletions = new WellWorkoverServices().GetMoreWellWorkovers(itemsPerPage, pageNumber);

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

                return(wellCompletions);
            }
            catch (Exception ex)
            {
                return(new List <WellWorkoverReportObject>());
            }
        }
        private List <WellWorkover> GetWellWorkovers(int itemsPerPage, int pageNumber, out int dataCount)
        {
            try
            {
                var wellWorkOvers = new WellWorkoverServices().GetAllOrderedWellWorkovers(itemsPerPage, pageNumber, out dataCount);

                ViewBag.PrDataCount = dataCount.ToString(CultureInfo.InvariantCulture);

                var totalPages = dataCount / itemsPerPage;

                // Counting the last page
                if (dataCount % itemsPerPage != 0)
                {
                    totalPages++;
                }

                ViewBag.PrTotalPages = totalPages;
                ViewBag.PrPage       = pageNumber;
                if (!wellWorkOvers.Any())
                {
                    return(new List <WellWorkover>());
                }

                wellWorkOvers.ForEach(m =>
                {
                    m.WellName       = m.Well.Name;
                    m.EquipmentName  = m.Equipment.Name;
                    m.Reason         = m.WellWorkOverReason.Title;
                    m.MonthStr       = Enum.GetName(typeof(MonthList), m.Month);
                    m.WorkoverPeriod = m.Month + "/" + m.Year;
                });

                return(wellWorkOvers);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message);
                dataCount = 0;
                return(new List <WellWorkover>());
            }
        }
Example #7
0
        private List <DocObject> GetYears()
        {
            var jxs = new WellWorkoverServices().GetWellWorkoverYears();

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

            jxs.ForEach(m =>
            {
                var ts = m;

                if (!tdv.Exists(t => t.DocId == ts))
                {
                    tdv.Add(new DocObject {
                        DocName = m.ToString(CultureInfo.InvariantCulture), DocId = ts
                    });
                }
            });
            return(tdv.OrderByDescending(m => m.DocName).ToList());
        }
Example #8
0
        public ActionResult GetWellWorkovers(WellWorkoverQuery queryBuilder)
        {
            if (queryBuilder == null)
            {
                return(Json(new List <WellWorkoverReportObject>(), 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.WorkoverReasonId < 1 && queryBuilder.WellClassId < 1 && queryBuilder.TerrainId < 1 && queryBuilder.ZoneId < 1)
            {
                return(Json(new List <WellWorkoverReportObject>(), JsonRequestBehavior.AllowGet));
            }

            var wellWorkoverList = new WellWorkoverServices().GetOrderedWellWorkoverReportObjects(queryBuilder) ?? new List <WellWorkoverReportObject>();

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

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