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.

112 lines
3.6 KiB
C#

9 months ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsAnnounce;
using DSWeb.Areas.MvcShipping.DAL.MsOpCtnFeeModelDAL;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using System.Web.Script.Serialization;
using DSWeb.EntityDA;
using System.Data;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.MvcShipping.DAL.Message;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcShipping.DAL.MsCodeFtpSet;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.MvcShipping.Models.MsCustomReport;
namespace DSWeb.MvcShipping.Controllers
{
public class MsCustomReportController : Controller
{
//
// GET:
public ActionResult Index ( )
{
return View();
}
//
// GET: /
public ActionResult Edit ( )
{
return View();
}
public ActionResult InEdit ( )
{
return View();
}
public ContentResult GetDataList ( int start, int limit, string sort, string condition )
{
int count = 0;
var dataList = MsCustomReportDAL.GetDataList(condition, start, limit, out count, sort);
var timeStamp = DateTime.Now.ToShortDateString();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult GetData ( string handle, string condition )
{
MsCustomReportModel head = null;
var timeStamp = DateTime.Now.ToShortDateString();
if (handle == "edit")
{
int count;
var data = MsCustomReportDAL.GetDataList(condition, 1, 1, out count);
if (data.Count > 0)
{
head = data[0];
}
}
if (head == null)
{
head = new MsCustomReportModel();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head, timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult Save ( string opstatus, string data)
{
var head = JsonConvert.Deserialize<MsCustomReportModel>(data.Replace("[", "").Replace("]", ""));
var jsonRespose = new JsonResponse();
string outMsg = "";
string gid = "";
head.isCustom = "1";
jsonRespose.Success = MsCustomReportDAL.Save(head, out outMsg, out gid);
jsonRespose.Message = outMsg;
int total;
var respHead = MsCustomReportDAL.GetDataList(" GID='" + gid + "'",1,1,out total);
if (respHead!=null&&respHead.Count>0)
{
jsonRespose.Data = respHead[0];
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete ( string data )
{
var head = JsonConvert.Deserialize<MsCustomReportModel>(data);
var jsonRespose = new JsonResponse();
string outMsg = "";
string gid = "";
jsonRespose.Success = MsCustomReportDAL.Delete(head, out outMsg, out gid);
jsonRespose.Message = outMsg;
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}