コード例 #1
0
        public JsonResult GetTeamMembersByFilter(VmPaymentRule filterItem = null)
        {
            var blPaymwntRule   = new BLPaymentRule();
            var paymentRuleList = blPaymwntRule.GetPaymentRulesByFilter(filterItem);

            return(Json(paymentRuleList, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult CreatePaymentRule(VmPaymentRule model)
        {
            var result        = -1;
            var blPaymentRule = new BLPaymentRule();

            result = blPaymentRule.CreatePaymentRule(model);


            var message = "";

            if (result == -1)
            {
                message = "Operation has been failed...\n call system Admin";
            }
            else
            {
                message = "Operation has been succeeded";
            }

            var jsonData = new
            {
                paymentRuleId = model.Id,
                success       = result,
                message
            };

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult UpdatePaymentRule(VmPaymentRule model)
        {
            var message = "";

            try
            {
                if (!ModelState.IsValid)
                {
                    var jsonEx = JsonConvert.SerializeObject(ModelState, Formatting.Indented,
                                                             new JsonSerializerSettings
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Serialize
                    });

                    var jsonException = new
                    {
                        paymentRuleId = model.Id,
                        success       = false,
                        message       = message + "\n" + jsonEx
                    };

                    return(Json(jsonException, JsonRequestBehavior.AllowGet));
                }

                var result        = true;
                var blPaymentRule = new BLPaymentRule();

                result = blPaymentRule.UpdatePaymentRule(model);

                if (result == false)
                {
                    message += "Operation has been failed...\n call system Admin\n";
                }
                else
                {
                    message += "Operation has been succeeded";
                }

                var jsonData = new
                {
                    paymentRuleId = model.Id,
                    success       = result,
                    message
                };

                return(Json(jsonData, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                var jsonEx = JsonConvert.SerializeObject(ex, Formatting.Indented,
                                                         new JsonSerializerSettings
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                });

                var jsonException = new
                {
                    paymentRuleId = model.Id,
                    success       = false,
                    message       = message + "\n" + jsonEx
                };

                return(Json(jsonException, JsonRequestBehavior.AllowGet));
            }
        }