|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcShipping.Models.DingTalkSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeDingTalkSet;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using System.Collections.Generic;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsCodeDingTalkSetController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET:
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:
|
|
|
|
|
|
public ContentResult GetDataList(string condition,string sort)
|
|
|
{
|
|
|
var dataList = MsCodeDingTalkSetDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]),sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:/TruckMng/MsWlTyreAcc/GetData/
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
CodeDingTalkSet head = null;
|
|
|
|
|
|
if (handle == "edit")
|
|
|
{
|
|
|
var list = MsCodeDingTalkSetDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]));
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
}
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new CodeDingTalkSet();
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetBodyList(string condition)
|
|
|
{
|
|
|
var dataList = MsCodeDingTalkSetDAL.GetBodyList(condition);
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<CodeDingTalkSet>(data);
|
|
|
var bodyList = JsonConvert.Deserialize<List<CodeDingTalkSetDetail>>(body);
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
var GID = headData.GID;
|
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
|
result = MsCodeDingTalkSetDAL.SaveDetail(headData, bodyList);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsCodeDingTalkSetDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["COMPANYID"]))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<CodeDingTalkSet>(data);
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(headData);
|
|
|
if (result.Success == true) { MsCodeDingTalkSetDAL.DeleteDetail(headData); }
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteDetail(string GID)
|
|
|
{
|
|
|
|
|
|
DBResult result = MsCodeDingTalkSetDAL.DeleteDetail2(GID);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|