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.

164 lines
5.9 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.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsChDui;
using DSWeb.MvcShipping.Models.MsChDui;
using DSWeb.MvcShipping.Models.MsChDuiView;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.Areas.CommMng.DAL;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
using DSWeb.Areas.MvcShipping.DAL.Disports;
using DSWeb.MvcShipping.Models.MsCodeGoods;
using DSWeb.MvcShipping.DAL.MsCodeGoods;
using DSWeb.Areas.MvcShipping.Models.Disport;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCodeDisportSetController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
//
// GET
public ContentResult GetDataList(int start, int limit, string sort)
{
string a = string.Empty;
string b = "";
if (!string.IsNullOrEmpty(Request.QueryString["ename"]))
{
a = Request.QueryString["ename"].ToString();
}
if (!string.IsNullOrEmpty(Request.QueryString["cname"]))
{
b = Request.QueryString["cname"].ToString();
}
var dataList = DisportsDal.GetDisportList(a, b);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string handle, string condition)
{
DisportModel head = null;
if (handle == "edit")
{
var list = DisportsDal.GetDisportListByID(condition);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new DisportModel();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetBodyList(int start, int limit, string sort, string condition)//
{
var dataList = MsCodeGoodsDAL.GetBodyList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetGoodsType(int start, int limit, string sort, string condition)//jj
{
var dataList = MsCodeGoodsDAL.GetGoodsType(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#region 获取国家列表
public ContentResult GetCountryType(int start, int limit, string sort, string condition)
{
var dataList = DisportsDal.GetCountrytList();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#endregion
#region 获取航线列表
public ContentResult GetLineType(int start, int limit, string sort, string condition)
{
var dataList = DisportsDal.GetLaneList();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#endregion
public ContentResult Save(string opstatus, string data, string body)
{
var headData = JsonConvert.Deserialize<DisportModel>(data);
var bodyList = JsonConvert.Deserialize<List<DisportModel>>(body);
if (opstatus == "add")
{
DBResult re = DisportsDal.InsertDetail(headData);
if (re.Success==false)
{
var jsonRespose = new JsonResponse { Success = re.Success, Message =re.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectDB();
modb.Save(headData);
var GID = headData.PORTID;
DBResult result = DisportsDal.SDetail(headData);
var jRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data=DisportsDal.GetDisportListByID(GID)
//
};
return new ContentResult() { Content = JsonConvert.Serialize(jRespose) };
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<DisportModel>(data);
DBResult result = DisportsDal.DeleteDetail(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 参照部分
#endregion
}
}