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.
122 lines
4.8 KiB
C#
122 lines
4.8 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
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.TruckMng.Comm.Cookie;
|
|
using DSWeb.Areas.MvcShipping.Models.MsOpSeaeEdiTemplate;
|
|
using DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate;
|
|
using System.IO;
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
public class MsOpSeaeEdiTemplateController : 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;
|
|
string showname = Convert.ToString(Session["SHOWNAME"]);
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
string comid = Convert.ToString(Session["COMPANYID"]);
|
|
var dataList = MsOpSeaeEdiTemplateDAL.GetDataList(condition,userid,comid,showname, start, 9999, 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 OpStatus, string condition)
|
|
{
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
string showname = Convert.ToString(Session["SHOWNAME"]);
|
|
string comid = Convert.ToString(Session["COMPANYID"]);
|
|
int count = 0;
|
|
if (OpStatus=="add")
|
|
{
|
|
MsOpSeaeEdiTemplateModel et = new MsOpSeaeEdiTemplateModel();
|
|
et.gid = Guid.NewGuid().ToString();
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = et });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
else
|
|
{
|
|
var dataList = MsOpSeaeEdiTemplateDAL.GetDataList(condition,userid,comid,showname, 0, 1, out count);
|
|
if (dataList.Count > 0)
|
|
{
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList()[0] });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
else
|
|
{
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "无此数据", data = "" });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
{
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
string comid = Convert.ToString(Session["COMPANYID"]);
|
|
var head = JsonConvert.Deserialize<MsOpSeaeEdiTemplateModel>(data);
|
|
head.USERID = userid;
|
|
head.COMPANYID = comid;
|
|
string msg = "";
|
|
int saveType = opstatus == "add" ? 0 : 1;
|
|
bool result = MsOpSeaeEdiTemplateDAL.Save(head, saveType, out msg);
|
|
var json = JsonConvert.Serialize(new { Success = result, Message = msg, Data = head.gid });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult Submit()
|
|
{
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
string comid = Convert.ToString(Session["COMPANYID"]);
|
|
string opstatus = Request["OpStatus"];
|
|
string data = Request["data"];
|
|
var head = JsonConvert.Deserialize<MsOpSeaeEdiTemplateModel>(data);
|
|
head.USERID = userid;
|
|
head.COMPANYID = comid;
|
|
string msg = "";
|
|
int saveType = opstatus == "add" ? 0 : 1;
|
|
bool result = MsOpSeaeEdiTemplateDAL.Save(head, saveType, out msg);
|
|
var json = JsonConvert.Serialize(new { success = result, Message = msg, Data = head.gid });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult Delete(string opstatus, string data)
|
|
{
|
|
|
|
var head = JsonConvert.Deserialize<List<MsOpSeaeEdiTemplateModel>>(data);
|
|
string msg = "";
|
|
bool result = MsOpSeaeEdiTemplateDAL.Delete(head, out msg);
|
|
var json = JsonConvert.Serialize(new { Success = result, Message = msg });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
}
|
|
} |