using NFine.Application.SystemManage; using NFine.Code; using NFine.Domain.Entity.SystemManage; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace NFine.Web.Areas.SystemManage.Controllers { public class ItemsDataController : ControllerBase { private ItemsDetailApp itemsDetailApp = new ItemsDetailApp(); private ItemsApp itemsApp = new ItemsApp(); [HttpGet] [HandlerAjaxOnly] public ActionResult GetGridJson(string itemId, string keyword) { var data = itemsDetailApp.GetList(itemId, keyword); return Content(data.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetSelectJson(string enCode) { var data = itemsDetailApp.GetItemList(enCode); List list = new List(); foreach (ItemsDetailEntity item in data) { list.Add(new { id = item.F_ItemCode, text = item.F_ItemName }); } return Content(list.ToJson()); } //[HttpGet] //[HandlerAjaxOnly] //public ActionResult GetSelectJsonWH(string keyValue) //{ // string keyValueCH = string.Empty; // switch (keyValue) // { // case "1": keyValueCH = "仓库类型"; break; // case "2": keyValueCH = "形状"; break; // case "3": keyValueCH = "色度"; break; // case "4": keyValueCH = "净度"; break; // case "5": keyValueCH = "抛光"; break; // case "6": keyValueCH = "对称性"; break; // case "7": keyValueCH = "切工"; break; // case "8": keyValueCH = "分类"; break; // } // //string itemsId = itemsApp.GetForm2(keyValue).F_Id; // string itemsId = itemsApp.GetForm2(keyValueCH).F_Id; // var data = itemsDetailApp.GetItemListWH(itemsId); // List list = new List(); // foreach (ItemsDetailEntity item in data) // { // list.Add(new { id = item.F_ItemCode, text = item.F_ItemName }); // } // return Content(list.ToJson()); //} [HttpGet] [HandlerAjaxOnly] public ActionResult GetFormJson(string keyValue) { var data = itemsDetailApp.GetForm(keyValue); return Content(data.ToJson()); } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); return Success("操作成功。"); } [HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] [ValidateAntiForgeryToken] public ActionResult DeleteForm(string keyValue) { itemsDetailApp.DeleteForm(keyValue); return Success("删除成功。"); } } }