using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Estsh.Web.Util; using Estsh.Web.Service; using System.Collections; namespace Estsh.Core.Web.Controllers { /*************************************************************************** *****************************************************************************/ public class CustProductDefineController : Controller { private CustProductDefineService service = new CustProductDefineService(); // // GET: /Menu/ public ActionResult Index() { return View(); } /// /// 获取客户产线列表 /// /// /// /// /// /// public ActionResult getCustProdutionListByPage(string cust_pdline_name, Pager pager, String direction, String sort) { Hashtable result = new Hashtable(); Hashtable dataHt = this.service.getCustProdutionListByPage(cust_pdline_name, pager, direction, sort); result.Add("rows", dataHt["dataList"]); result.Add("pager.totalRows", dataHt["totalCount"]); result.Add("sort", sort); result.Add("direction", direction); return Json(result); } /// /// 保存产线数据 /// /// public ActionResult saveCustProduct() { String editType = Request["editType"].ToString(); String cust_pdline_id = Request["cust_pdline_id"].ToString(); String cust_pdline_name = Request["cust_pdline_name"].ToString(); String cust_pdline_desc = Request["cust_pdline_desc"].ToString(); String enabled = Request["enabled"].ToString(); Hashtable htParams = new Hashtable(); htParams.Add("@cust_pdline_name", cust_pdline_name); htParams.Add("@cust_pdline_desc", cust_pdline_desc); htParams.Add("@enabled", enabled); String message = ""; String flag = ""; if (editType != null && editType.Trim().Equals("edit")) { try { htParams.Add("@cust_pdline_id", cust_pdline_id); this.service.updateCustProduct(htParams); message = "修改成功"; flag = "OK"; } catch (Exception e) { message = "修改失败!"; flag = "Fail"; } } else { try { this.service.saveCustProduct(htParams); message = "添加成功"; flag = "OK"; } catch (Exception e) { message = "添加失败!"; flag = "Fail"; } } Hashtable result = new Hashtable(); result.Add("message", message); result.Add("flag", flag); return Json(result) ; } /// /// 查看菜单详情 /// /// /// public ActionResult getCustProductDetail(String cust_pdline_id) { Hashtable ht = this.service.getCustProductDetail(cust_pdline_id); ViewData.Add("cust_pdline_id",ht["cust_pdline_id"]); ViewData.Add("cust_pdline_name", ht["cust_pdline_name"]); ViewData.Add("cust_pdline_desc", ht["cust_pdline_desc"]); ViewData.Add("enabled", ht["enabled"]); return View("~/Views/CustProductDefine/ViewCustProductDefine.aspx"); } /// /// 编辑菜单 /// /// /// public ActionResult editCustProduct(String cust_pdline_id) { Hashtable ht = this.service.getCustProductDetail(cust_pdline_id); ViewData.Add("editType", "edit"); ViewData.Add("cust_pdline_id", ht["cust_pdline_id"]); ViewData.Add("cust_pdline_name", ht["cust_pdline_name"]); ViewData.Add("cust_pdline_desc", ht["cust_pdline_desc"]); ViewData.Add("enabled", ht["enabled"]); return View("~/Views/CustProductDefine/EditCustProductDefine.aspx"); } /// /// 删除菜单 /// /// /// public ActionResult deletePdLine(String ids) { int delCount = 0; try { delCount = this.service.deleteMenu(ids); } catch(Exception e) { delCount = -1; } Hashtable result = new Hashtable(); result.Add("status", delCount); return Json(result); } } }