|
|
|
|
|
using System.Collections;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Controllers;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:系统参数
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class BaseManagerController : BaseController
|
|
|
{
|
|
|
private IBaseManagerService service;
|
|
|
public BaseManagerController(IBaseManagerService _service)
|
|
|
{
|
|
|
this.service = _service;
|
|
|
}
|
|
|
//
|
|
|
// GET: /BaseManager/
|
|
|
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取系统参数列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="menuName">查询条件</param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序字段</param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getBaseListByPage(String BaseValue, String BaseName, Pager pager, String direction, String sort, String enabled = "Y")
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getListByPage(BaseValue, BaseName, enabled, 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 saveBase()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
|
|
|
string paramName = Request.Form["paramName"].ToString();
|
|
|
string paramValue = Request.Form["paramValue"].ToString();
|
|
|
string paramDesc = Request.Form["paramDesc"].ToString();
|
|
|
string enabled = Request.Form["enabled"].ToString();
|
|
|
|
|
|
SysBase sysBase = new SysBase();
|
|
|
sysBase.ParamName = paramName;
|
|
|
sysBase.ParamValue = paramValue;
|
|
|
sysBase.ParamDesc = paramDesc;
|
|
|
sysBase.Enabled = enabled;
|
|
|
String message = string.Empty;
|
|
|
if (!string.IsNullOrEmpty(editType) && editType.Equals("editType"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
String paramId = Request.Form["paramId"].ToString();
|
|
|
sysBase.ParamId =Convert.ToInt32( paramId);
|
|
|
sysBase.UpdateUserId = CurrentEmp.EmpId;
|
|
|
int num = this.service.EditBase(sysBase);
|
|
|
if (num > 0)
|
|
|
message = "修改成功";
|
|
|
else
|
|
|
message = "修改失败";
|
|
|
}
|
|
|
catch (Exception ee)
|
|
|
{
|
|
|
|
|
|
message = "修改失败," + ee.Message;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(paramName))
|
|
|
{
|
|
|
message = "参数名称不能为空";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sysBase.CreateUserId = CurrentEmp.EmpId;
|
|
|
int num = this.service.SaveBase(sysBase);
|
|
|
if (num > 0)
|
|
|
message = "添加成功";
|
|
|
else
|
|
|
message = "添加失败";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ee)
|
|
|
{
|
|
|
message = "添加失败," + ee.Message;
|
|
|
}
|
|
|
}
|
|
|
result.Add("message", message);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult EditBase(string paramId)
|
|
|
{
|
|
|
if (!String.IsNullOrEmpty(paramId))
|
|
|
{
|
|
|
List<SysBase> model = service.getList(paramId);
|
|
|
|
|
|
ViewData.Add("editType", "edit");
|
|
|
|
|
|
ViewData.Add("paramId", model[0].ParamId);
|
|
|
ViewData.Add("paramName", model[0].ParamName);
|
|
|
ViewData.Add("paramValue", model[0].ParamValue);
|
|
|
ViewData.Add("paramDesc", model[0].ParamDesc);
|
|
|
ViewData.Add("enabled", model[0].Enabled);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("editType", "new");
|
|
|
}
|
|
|
|
|
|
return View("~/SystemParameters/EditBase");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deleteBase(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deleteBase(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.EnableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onDisable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.DisableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
}
|
|
|
}
|