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.

154 lines
5.2 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsOpSeaeEdiDAL;
using DSWeb.MvcShipping.Models.MsOpSeaeEdi;
using DSWeb.MvcShipping.Models.MsOpSeae;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using System.IO;
using System.Web;
using DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL;
using DSWeb.EntityDA;
using DSWeb.Areas.MvcShipping.DAL.Message.vgm;
using DSWeb.MvcShipping.Models.MsOpSeaeComnameInfo;
using DSWeb.MvcShipping.DAL.MsOpSeaeComnameInfo;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsOpSeaeComnameInfoController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public ActionResult Map()
{
return View();
}
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
int count = 0;
var dataList = MsOpSeaeComnameInfoDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), start, limit, out count, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string handle, string condition)
{
string userid = Convert.ToString(Session["USERID"]);
if (userid == "" || userid == null)
{
var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
string INPUTBY = Convert.ToString(Session["SHOWNAME"]);
Comname_Info head = null;
if (handle == "edit")
{
head = MsOpSeaeComnameInfoDAL.GetData(condition);
}
if (handle=="add")
{
head = new Comname_Info();
head.GID = "*";
head.COMNAME = "";
head.COMXJCODE = "";
head.ISPXCOMPANY = 0;
head.PXCOMACCOUNT = "";
head.PXCOMPASSWORD = "";
}
if (head == null)
{
head = new Comname_Info();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data)
{
var headData = JsonConvert.Deserialize<Comname_Info>(data);
string userid = Convert.ToString(Session["USERID"]);
string comid = Convert.ToString(Session["COMPANYID"]);
var isPost = true;
if (isPost)
{
var modb = new ModelObjectDB();
if (headData.GID=="*")
{
if (MsOpSeaeComnameInfoDAL.CheckAllowIns(headData.COMNAME))
{
headData.GID = Guid.NewGuid().ToString();
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:ss:mm");
headData.DbOperationType = DbOperationType.DbotIns;
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "不允许重复添加",
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
}
DBResult rst = modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = rst.Success,
Message = rst.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = "重复,不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult DeletePiLiang(string bsnos)
{
DBResult rs= MsOpSeaeComnameInfoDAL.DeletePiLiang(bsnos);
var jsonRespose = new JsonResponse { Success =rs.Success, Message =rs.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}