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.

179 lines
6.1 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
using Estsh.Web.Models;
/*****************************************************************************************************************************************
*
* 创建人:唐慰
* 创建时间2013.03.23
* 描述:看板模块控制类
* 变更记录:
* 130401 唐慰 + 所有方法改为首字母大写
* 130407 唐慰 + GetDetail和Save方法添加enabled字段
*
*****************************************************************************************************************************************/
namespace Estsh.Core.Web.Controllers
{
/// <summary>
/// 看板模块控制类
/// </summary>
public class ViewBoardDefineController : Controller
{
private ViewBoardDefineService service = new ViewBoardDefineService();
//
// GET: /Menu/
public ActionResult Index()
{
return View();
}
/// <summary>
/// 获取看板管理列表数据
/// </summary>
/// <param name="view_board_name"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public ActionResult GetListByPage(String view_board_name, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
result.Add("pager.pageNo",pager.pageNo);
Hashtable dataHt = this.service.GetListByPage(view_board_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>
/// <rehuoturns></returns>
public ActionResult GetSelect()
{
Hashtable result = new Hashtable();
ArrayList list = this.service.GetSelect();
result.Add("list", list);
return Json(result, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 保存看板数据
/// </summary>
/// <returns></returns>
public ActionResult Save()
{
String editType = Request["editType"].ToString();
String view_board_id = Request["view_board_id"].ToString();
String view_board_name = Request["view_board_name"].ToString();
String view_type = Request["view_type"].ToString();
String view_part_type = Request["view_part_type"].ToString();
String enabled = Request["enabled"].ToString();
Hashtable htParams = new Hashtable();
htParams.Add("@view_board_name", view_board_name);
htParams.Add("@view_type", view_type);
htParams.Add("@view_part_type", view_part_type);
htParams.Add("@enabled", enabled);
String message = "";
if (editType != null && editType.Trim().Equals("edit"))
{
try
{
htParams.Add("@update_userid", ((UserInfo)Session["loginedUser"]).empId);
htParams.Add("@view_board_id", view_board_id);
this.service.Update(htParams);
message = "修改成功";
}
catch (Exception e)
{
message = "修改失败!";
}
}
else
{
try
{
htParams.Add("@create_userid", ((UserInfo)Session["loginedUser"]).empId);
this.service.Insert(htParams);
message = "添加成功";
}
catch (Exception e)
{
message = "添加失败!";
}
}
Hashtable result = new Hashtable();
result.Add("message", message);
return Json(result) ;
}
/// <summary>
/// 查看看板详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public ActionResult GetDetail(String view_board_id)
{
ArrayList Info = this.service.GetDetail(view_board_id);
Hashtable ht = (Hashtable)Info[0];
ViewData.Add("view_board_name", ht["view_board_name"]);
ViewData.Add("view_type", ht["view_type"]);
ViewData.Add("view_part_type", ht["view_part_type"]);
ViewData.Add("enabled", ht["enabled"]);
return View("~/Views/ViewBoardDefine/viewViewBoardDefine.aspx");
}
/// <summary>
/// 编辑看板
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public ActionResult Edit(String view_board_id)
{
ArrayList Info = this.service.GetDetail(view_board_id);
Hashtable ht = (Hashtable)Info[0];
ViewData.Add("editType", "edit");
ViewData.Add("view_board_id", view_board_id);
ViewData.Add("view_board_name", ht["view_board_name"]);
ViewData.Add("view_type", ht["view_type"]);
ViewData.Add("view_part_type", ht["view_part_type"]);
return View("~/Views/ViewBoardDefine/editViewBoardDefine.aspx");
}
/// <summary>
/// 删除看板
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public ActionResult Delete(String ids)
{
int delCount = 0;
try
{
delCount = this.service.Delete(ids);
}
catch(Exception e)
{
delCount = -1;
}
Hashtable result = new Hashtable();
result.Add("status", delCount);
return Json(result);
}
}
}