Exemple #1
0
        public BsJsonResult(object obj = null, BsResponseStatus statusInfo = BsResponseStatus.Success, string errorMessage = null, string json = null, int? jsonMaxLength = null)
        {
            if (json == null)
            {
                var serializer = new JavaScriptSerializer();
                if (jsonMaxLength.HasValue)
                {
                    serializer.MaxJsonLength = jsonMaxLength.Value;
                }

                object result = new
                    {
                        Data = obj,
                        Status = statusInfo,
                        Message = errorMessage,
                        Release = BForms.Utilities.BsConfigurationManager.GetRelease()
                    };

                Json = serializer.Serialize(result);
            }
            else
            {
                Json = json;
            }
        }
Exemple #2
0
        public BsJsonResult(object obj = null, BsResponseStatus statusInfo = BsResponseStatus.Success, string errorMessage = null, string json = null, int?jsonMaxLength = null)
        {
            if (json == null)
            {
                object result = new
                {
                    Data    = obj,
                    Status  = statusInfo,
                    Message = errorMessage,
                    Release = BForms.Utilities.BsConfigurationManager.GetRelease()
                };

                Json = JsonConvert.SerializeObject(result);
            }
            else
            {
                Json = json;
            }
        }
Exemple #3
0
        public BsJsonResult(object obj = null, BsResponseStatus statusInfo = BsResponseStatus.Success, string errorMessage = null, string json = null, int? jsonMaxLength = null)
        {
            if (json == null)
            {
                object result = new
                    {
                        Data = obj,
                        Status = statusInfo,
                        Message = errorMessage,
                        Release = BForms.Utilities.BsConfigurationManager.GetRelease()
                    };

                Json = JsonConvert.SerializeObject(result);
            }
            else
            {
                Json = json;
            }
        }