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.

117 lines
3.8 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.Models.MsOpSeaPlugin;
using DSWeb.MvcShipping.DAL.MsOpSeaPluginDal;
using DSWeb.MvcShipping.DAL.MsAnnounce;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using System.Web.Script.Serialization;
using DSWeb.EntityDA;
using System.Data;
using DSWeb.MvcShipping.Helper.Repository;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.MvcShipping.DAL.Message;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
namespace DSWeb.MvcShipping.Controllers
{
public class MsOpSeaPluginController : Controller
{
//
// GET:
public ActionResult Index ( )
{
return View();
}
//
// GET: /
public ActionResult Edit ( )
{
return View();
}
public ActionResult InEdit ( )
{
return View();
}
public ContentResult GetCoverDataList ( int start, int limit, string sort, string condition )
{
int count = 0;
var dataList = MsOpSeaPluginDAL.GetCoverDataList(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 )
{
MsOpSeaPluginCover head = null;
var timeStamp = DateTime.Now.ToShortDateString();
if (handle == "edit")
{
head = MsOpSeaPluginDAL.GetData(condition);
}
if (head == null)
{
head = new MsOpSeaPluginCover();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head, timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult DeleteCover ( string data, string USERID )
{
var coverList = JsonConvert.Deserialize<List<MsOpSeaPluginCover>>(data);
string msg = "";
bool success = MsOpSeaPluginDAL.DeleteCover(coverList, out msg);
var jsonRespose = new JsonResponse { Success = success, Message = msg };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveCover ()
{
MsOpSeaPluginCover cover = new MsOpSeaPluginCover();
var BSNO = Request.Form["BSNO"];
var COVERTITLE = Request.Form["COVERTITLE"];
var COVERCONTEXT = Request.Form["COVERCONTEXT"];
var CID = Request.Form["CID"];
var Operatior = Session["SHOWNAME"] == null ? "" : Session["SHOWNAME"].ToString();
var OpTime = DateTime.Now.ToString("G");
cover.BSNO = BSNO;
cover.COVERTITLE = COVERTITLE;
cover.COVERCONTEXT = COVERCONTEXT;
cover.OPTIME = OpTime;
cover.OPERATOR = Operatior;
bool rst = false;
if (CID=="")
{
cover.CID = Guid.NewGuid().ToString();
rst= MsOpSeaPluginDAL.SaveCover(cover,0);
}
else
{
cover.CID = CID;
rst= MsOpSeaPluginDAL.SaveCover(cover,1);
}
var json = JsonConvert.Serialize(new { success = rst, Message =rst?"保存成功":"保存失败"});
return new ContentResult() { Content = json };
}
}
}