コード例 #1
0
        public ActionResult GetFieldDesignerData(int formID, string sidx, string sord, int page = 1, int rows = 10)
        {
            var jsonData = new
            {
                total = 0,
                page,
                records = 0,
                rows    = new List <PermitFormScreenDesignTemplateDetailBE>()
            };

            try
            {
                IEnumerable <PermitFormScreenDesignTemplateDetailBE> list = FormLogic.BlockFetchPermitFormScreenDesignTemplateDetail(formID, page, rows, out int totalRecords);

                if (list == null)
                {
                    return(Json(jsonData));
                }
                else
                {
                    var resultFormTemplate = (from obj in list
                                              select new PermitFormScreenDesignTemplateDetailBE
                    {
                        Field = obj.Field,
                        FieldName = obj.FieldName,
                        FieldTypeValue = obj.FieldType.ToString(),
                        Section = obj.Section,
                        Sequence = obj.Sequence
                    }).ToList();

                    var totalPages = (int)Math.Ceiling((float)totalRecords / (float)rows);

                    jsonData = new
                    {
                        total = totalPages,
                        page,
                        records = totalRecords,
                        rows    = resultFormTemplate
                    };
                }

                var jsonResult = Json(jsonData);
                return(jsonResult);
            }
            catch (Exception ex)
            {
                return(Json(jsonData));
            }
        }