You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
5.2 KiB
C#
154 lines
5.2 KiB
C#
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();
|
|
}
|
|
/// <summary>
|
|
/// 获取客户产线列表
|
|
/// </summary>
|
|
/// <param name="device_name"></param>
|
|
/// <param name="pager"></param>
|
|
/// <param name="direction"></param>
|
|
/// <param name="sort"></param>
|
|
/// <returns></returns>
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存产线数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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) ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查看菜单详情
|
|
/// </summary>
|
|
/// <param name="ruid"></param>
|
|
/// <returns></returns>
|
|
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");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑菜单
|
|
/// </summary>
|
|
/// <param name="ruid"></param>
|
|
/// <returns></returns>
|
|
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");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除菜单
|
|
/// </summary>
|
|
/// <param name="ids"></param>
|
|
/// <returns></returns>
|
|
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);
|
|
}
|
|
}
|
|
}
|