Ejemplo n.º 1
0
        public ActionResult AddPaymentType([DataSourceRequest] DataSourceRequest request, ConfigPaymentTypeModel model)
        {
            try
            {
                if (model != null)
                {
                    var service = new ConfigPaymentTypeService();

                    var product = DataTransfer.Transfer<Config_Payment_Type>(
                        model,
                        typeof(ConfigPaymentTypeModel));

                    model.ID = service.Add(product);
                }

                SetPaymentMethod(model);

                return Json(new[] { model }.ToDataSourceResult(request, ModelState));
            }
            catch
            {
                return View();
            }
        }
Ejemplo n.º 2
0
        public ActionResult ModifyPaymentType([DataSourceRequest] DataSourceRequest request, ConfigPaymentTypeModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                var service = new ConfigPaymentTypeService();

                var paymentMethod = DataTransfer.Transfer<Config_Payment_Type>(
                    model,
                    typeof(ConfigPaymentTypeModel));

                SetPaymentMethod(model);

                service.Modify(paymentMethod);
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询所有支付类别
        /// </summary>
        /// <returns></returns>
        public JsonResult QueryTypeSelectItems()
        {
            List<ConfigPaymentTypeModel> modelList = new List<ConfigPaymentTypeModel>();

            var paymentTypeService = new ConfigPaymentTypeService();

            var list = paymentTypeService.QueryAll();
            foreach (var config in list)
            {
                modelList.Add(DataTransfer.Transfer<ConfigPaymentTypeModel>(
                                config,
                                typeof(Config_Payment_Type)));
            }
            return Json(modelList, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 4
0
        public void RemovePaymentType(int id)
        {
            try
            {
                var service = new ConfigPaymentTypeService();

                service.Remove(id);

                Response.Write("恭喜,删除成功");
            }
            catch
            {
                Response.Write("删除失败");
            }
        }
Ejemplo n.º 5
0
        public ActionResult QueryPaymentType([DataSourceRequest] DataSourceRequest request)
        {
            var service = new ConfigPaymentTypeService();

            var list = service.QueryAll();
            if (list != null)
            {
                var modelList = new List<ConfigPaymentTypeModel>();

                foreach (var config in list)
                {
                    modelList.Add(
                        DataTransfer.Transfer<ConfigPaymentTypeModel>(
                            config,
                            typeof(Config_Payment_Type)));
                }

                for (var i = 0; i < modelList.Count; i++)
                {
                    SetPaymentMethod(modelList[i]);
                }

                return Json(modelList.ToDataSourceResult(request));
            }

            return this.View();
        }