コード例 #1
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);
        }
コード例 #2
0
        private List <WellCompletionQuery> GetWellCompletionQueries()
        {
            var previousQueries = new WellCompletionQueryBuilderServices().GetAllOrderedWellCompletionQueries() ?? new List <WellCompletionQuery>();

            if (!previousQueries.Any())
            {
                return(new List <WellCompletionQuery>());
            }
            return(previousQueries);
        }
コード例 #3
0
        public ActionResult IsWellCompletionQueryExisting()
        {
            var genVal = new GenericValidator();

            try
            {
                if (Session["_successfulWellCompletionQuery"] == null)
                {
                    genVal.Code = -1;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                var queryBuilder = Session["_successfulWellCompletionQuery"] as WellCompletionQuery;

                if (queryBuilder == null)
                {
                    genVal.Code = -1;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                var k = new WellCompletionQueryBuilderServices().IsWellCompletionQueryExisting(queryBuilder);
                if (k)
                {
                    genVal.Code = 5;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                genVal.Code = -3;
                return(Json(genVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                genVal.Code = 0;
                return(Json(genVal, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
        public ActionResult SaveSuccessfulQuery(string queryName)
        {
            var genVal = new GenericValidator();

            try
            {
                if (string.IsNullOrEmpty(queryName))
                {
                    genVal.Error = "Please supply all required fields and try again";
                    genVal.Code  = -1;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                if (Session["_successfulWellCompletionQuery"] == null)
                {
                    genVal.Error = "Session has expired";
                    genVal.Code  = -1;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                var queryBuilder = Session["_successfulWellCompletionQuery"] as WellCompletionQuery;

                if (queryBuilder == null)
                {
                    genVal.Error = "Session has expired";
                    genVal.Code  = -1;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                queryBuilder.WellCompletionQueryName = queryName.Trim();

                var k = new WellCompletionQueryBuilderServices().AddWellCompletionQueryCheckDuplicate(queryBuilder);
                if (k < 1)
                {
                    if (k == -3)
                    {
                        genVal.Error = "Query already exists";
                        genVal.Code  = -3;
                        return(Json(genVal, JsonRequestBehavior.AllowGet));
                    }

                    if (k == -4)
                    {
                        genVal.Error = "Query Name already exists. Please provide a different one";
                        genVal.Code  = -3;
                        return(Json(genVal, JsonRequestBehavior.AllowGet));
                    }

                    genVal.Error = "Process Failed! Please contact the Admin or try again later";
                    genVal.Code  = 0;
                    return(Json(genVal, JsonRequestBehavior.AllowGet));
                }

                genVal.Error = "Query was successfully saved";
                genVal.Code  = (int)k;
                return(Json(genVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                //ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                genVal.Error = "An unknown error was encountered. Query could not be saved. Please try again.";
                genVal.Code  = 0;
                return(Json(genVal, JsonRequestBehavior.AllowGet));
            }
        }