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.

138 lines
4.2 KiB
C#

9 months ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsCodeFeeGroupTemplate;
using DSWeb.MvcShipping.Models.MsCodeDuiTemplate;
using DSWeb.MvcShipping.Models.CodeFeeGroupTemplate;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCodeFeeGroupTemplateController : 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 = MsCodeFeeGroupTempldateDAL.GetDataList(condition,sort);
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 handle, string condition)
{
CodeFeeGroup head = null;
if (handle == "edit")
{
var list = MsCodeFeeGroupTempldateDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new CodeFeeGroup();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetTotalCurrList(string condition)
{
var dataList = MsCodeFeeGroupTempldateDAL.GetTotalCurrList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data, string drbody, string crbody, string bodytotal)
{
var headData = JsonConvert.Deserialize<CodeFeeGroup>(data);
var drbodyList = JsonConvert.Deserialize<List<CodeDuiTemplateFee>>(drbody);
var crbodyList = JsonConvert.Deserialize<List<CodeDuiTemplateFee>>(crbody);
var worklist = JsonConvert.Deserialize<List<CodeFeeGroupTotal>>(bodytotal);
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectDB();
modb.Save(headData);
var DM_ID = headData.DM_ID;
DBResult result = MsCodeFeeGroupTempldateDAL.SaveDetail(headData, drbodyList, crbodyList, worklist);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsCodeFeeGroupTempldateDAL.GetData("DM_ID='" + DM_ID + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<CodeDuiTemplate>(data);
DBResult result = MsCodeFeeGroupTempldateDAL.DeleteDetail(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 参照部分
#endregion
}
}