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.
229 lines
10 KiB
C#
229 lines
10 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.Models.CodeCtnEdi;
|
|
using DSWeb.MvcShipping.DAL.MsCodeCtnEdi;
|
|
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 MsCodeCtnEdiController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
#region 查询
|
|
public ContentResult GetDataList(string condition,string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetDataList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetData(string handle, string condition)
|
|
{
|
|
CodeCtnEdi head = null;
|
|
|
|
if (handle == "edit")
|
|
{
|
|
var list = MsCodeCtnEdiDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]));
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
}
|
|
|
|
if (head == null)
|
|
{
|
|
head = new CodeCtnEdi();
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetCustList(string condition, string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetCustList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetPkgsList(string condition, string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetPkgsList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetVesselList(string condition, string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetVesselList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetSERVICEList(string condition, string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetSERVICEList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetPORTDISCHARGEList(string condition, string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetPORTDISCHARGEList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetAFRList(string condition, string sort)
|
|
{
|
|
var dataList = MsCodeCtnEdiDAL.GetAFRList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
public ContentResult Save(string opstatus, string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(data);
|
|
if (opstatus == "add")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
}
|
|
else
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
var modb = new ModelObjectDB();
|
|
var GID = headData.GID;
|
|
DBResult result = modb.Save(headData);
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsCodeCtnEdiDAL.GetData("GID='" + GID + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult SaveDetail(string body)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
|
|
DBResult result = MsCodeCtnEdiDAL.SaveDetail(bodyList, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult SaveCustDetail(string body)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
|
|
DBResult result = MsCodeCtnEdiDAL.SaveCustDetail(bodyList, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult SavePkgsDetail(string body)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
DBResult result = MsCodeCtnEdiDAL.SavePkgsDetail(bodyList, Convert.ToString(Session["COMPANYID"]));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult SaveSERVICEDetail(string body)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
DBResult result = MsCodeCtnEdiDAL.SaveSERVICEDetail(bodyList, Convert.ToString(Session["COMPANYID"]));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult SavePORTDISCHARGEDetail(string body)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
DBResult result = MsCodeCtnEdiDAL.SavePORTDISCHARGEDetail(bodyList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult SaveVesselDetail(string body)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
DBResult result = MsCodeCtnEdiDAL.SaveVesselDetail(bodyList, Convert.ToString(Session["COMPANYID"]));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 删除
|
|
public ContentResult Delete(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(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 DeleteCust(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(data);
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsCodeCtnEdiDAL.DeleteCust(headData);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult DeletePkgs(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(data);
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsCodeCtnEdiDAL.DeletePkgs(headData);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult DeleteSERVICE(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(data);
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsCodeCtnEdiDAL.DeleteSERVICE(headData);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult DeletePORTDISCHARGE(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(data);
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsCodeCtnEdiDAL.DeletePORTDISCHARGE(headData);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult DeleteVessel(string data)
|
|
{
|
|
var headData = JsonConvert.Deserialize<CodeCtnEdi>(data);
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsCodeCtnEdiDAL.DeleteVessel(headData);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|