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.

134 lines
3.9 KiB
C#

9 months ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.Models.MsSysParamSet;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.TruckMng.Helper.Repository;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsSysParamSetController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
//
// GET
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = MsSysParamSetDAL.GetDataList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlTyreAcc/GetData/
public ContentResult GetData(string condition)
{
SysParamSet head = null;
var list = MsSysParamSetDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
if (head == null)
{
head = new SysParamSet();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetFeeParam()
{
FeeParamSet head = new FeeParamSet();
head.Feenotopen = false;
head.EXCHANGERATEISREADONLY = false;
var list = MsSysParamSetDAL.GetDataList(" PARAMNAME='Feenotopen' or PARAMNAME='EXCHANGERATEISREADONLY' ");
foreach (var feeparam in list)
{
if (feeparam.PARAMNAME == "Feenotopen" && feeparam.PARAMVALUE == "1") head.Feenotopen = true;
if (feeparam.PARAMNAME == "EXCHANGERATEISREADONLY" && feeparam.PARAMVALUE == "1") head.EXCHANGERATEISREADONLY = true;
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string body)
{
var bodyList = JsonConvert.Deserialize<List<SysParamSet>>(body);
var modb = new ModelObjectRepository();
DBResult result = MsSysParamSetDAL.SaveDetail(bodyList, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<SysParamSet>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetParamValueList(int start, int limit, string sort, string condition)
{
var dataList = MsSysParamSetDAL.GetParamValueList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}