using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.DAL.MsWlCheckAcc;
using DSWeb.Areas.TruckMng.Models.MsWlCheckAcc;
using DSWeb.TruckMng.Helper;
using HcUtility.Comm;
using HcUtility.Core;
using System;
using System.Collections.Generic;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.CommMng.Models;
using DSWeb.EntityDA;
using System.Data;
using DSWeb.DataAccess;
namespace DSWeb.Areas.TruckMng.Controllers
{
///
/// 集运对账
///
[JsonRequestBehavior]
public class MsWlCheckAccController : Controller
{
//
// GET: /TruckMng/MsWlCheckAcc
public ActionResult Index()
{
return View();
}
public ActionResult PcIndex()
{
return View();
}
//
// GET:/TruckMng/MsWlCheckAcc/GetDataList
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var USERID = CookieConfig.GetCookie_UserId(Request);
var ORGCODE = CookieConfig.GetCookie_OrgCode(Request);
var dataList = MsWlCheckAccDAL.GetDataList(condition, USERID, ORGCODE);
var list = dataList.Skip(start).Take(limit);
//decimal ysTotal = 0;
//decimal yfTotal = 0;
//foreach (var acc in list)
//{
// if (acc.FeeType == 1)
// {
// ysTotal = ysTotal + acc.Freight + acc.ExtrasFee;
// }
// else
// {
// yfTotal = yfTotal + acc.Freight + acc.ExtrasFee;
// }
//}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataPcList(int start, int limit, string sort, string condition)
{
var dataList = MsWlCheckAccDAL.GetDataPcList(condition);
var list = dataList.Skip(start).Take(limit);
//decimal ysTotal = 0;
//decimal yfTotal = 0;
//foreach (var acc in list)
//{
// if (acc.FeeType == 1)
// {
// ysTotal = ysTotal + acc.Freight + acc.ExtrasFee;
// }
// else
// {
// yfTotal = yfTotal + acc.Freight + acc.ExtrasFee;
// }
//}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
//
// GET:/TruckMng/MsWlCheckAcc/GetData/
public ContentResult GetData(string handle, string condition)
{
MsWlCheckAcc head = null;
if (handle == "edit")
{
var list = MsWlCheckAccDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new MsWlCheckAcc();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head});
return new ContentResult() { Content = json };
}
//
// GET:/TruckMng/MsWlCheckAcc/Save
//public ContentResult Save(string opstatus, string data)
//{
// MsWlCheckAcc head = JsonConvert.Deserialize(data);
// if (opstatus == "add")
// {
// head.DbOperationType = DbOperationType.DbotIns;
// }
// else if (opstatus == "edit")
// {
// head.DbOperationType = DbOperationType.DbotUpd;
// }
// else
// {
// head.DbOperationType = DbOperationType.DbotDel;
// }
// var modb = new ModelObjectDB();
// DBResult result = modb.Save(head);
// var jsonRespose = new JsonResponse
// {
// Success = result.Success,
// Message = result.Message,
// Data = MsWlCheckAccDAL.GetData("GId='" + head.GId + "'")
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
//}
public ContentResult Delete(string data)
{
var head = JsonConvert.Deserialize(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 参照部分
#endregion
}
}