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.
166 lines
6.3 KiB
C#
166 lines
6.3 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.MvcShipping.Models.MsOpSeaeModule;
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeModuleDAL;
|
|
using System.IO;
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
public class MsOpSeaeModuleController : Controller
|
|
{
|
|
//
|
|
// GET:
|
|
public ActionResult Index ( )
|
|
{
|
|
return View();
|
|
}
|
|
//
|
|
// GET: /
|
|
public ActionResult Edit ( )
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsOpSeaeModuleDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
var list = dataList.Skip(start).Take(limit);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetDataListStr(string sort, string condition)
|
|
{
|
|
var dataListStr = MsOpSeaeModuleDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
//public ContentResult GetDataListSum(int start, int limit, string sort, string condition)
|
|
//{
|
|
// var dataList = MsOpSeaePreDAL.GetDataListSum(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
// var list = dataList.Skip(start).Take(limit);
|
|
// var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
// return new ContentResult() { Content = json };
|
|
//}
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
{
|
|
MsOpSeaeModule head = null;
|
|
if (handle == "edit")
|
|
{
|
|
head = MsOpSeaeModuleDAL.GetData(condition);
|
|
}
|
|
if (head == null)
|
|
{
|
|
head = new MsOpSeaeModule();
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
var headData = JsonConvert.Deserialize<MsOpSeaeModule>(data);
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
|
|
|
|
////分公司代码
|
|
//if (headData.CORPID == "" || headData.CORPID == null)
|
|
//{
|
|
// headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
//}
|
|
|
|
//分公司代码
|
|
if (headData.GID == "" || headData.GID == null)
|
|
{
|
|
headData.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
}
|
|
|
|
//
|
|
if (opstatus == "add")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
//
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
//
|
|
|
|
}
|
|
else
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
|
|
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpSeaeModuleDAL.GetData("GID='" + headData.GID + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var head = JsonConvert.Deserialize<MsOpSeaeModule>(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) };
|
|
}
|
|
//
|
|
|
|
}
|
|
} |