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.

92 lines
3.9 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsCwDesignDAL;
using DSWeb.MvcShipping.Models.MsCwDesign;
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 DSWeb.EntityDA;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCwDesignController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public ContentResult GetDataList(string condition)
{
var dataList = MsCwDesignDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string condition)
{
MsCwDesign head = MsCwDesignDAL.GetData(condition, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
#region 保存
public ContentResult Save(string dataHead, string dataKHLB, string dataCSSZ, string dataGZZY, string dataJSZY, string dataPZKM)
{
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
var headData = JsonConvert.Deserialize<MsCwDesign>(dataHead.Replace("}", ",") + dataKHLB.Replace("{", "").Replace("}", ",") + dataCSSZ.Replace("{", "").Replace("}", ",") + dataGZZY.Replace("{", "").Replace("}", ",") + dataJSZY.Replace("{", "").Replace("}", ",") + dataPZKM.Replace("{", ""));
var isPost = true;
var errorstr = "";
//
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);
headData.MODIFIEDTIME = DateTime.Now;
if (headData.GID.ToString().Trim() == "*" || headData.GID.ToString().Trim() == "")//add
{
headData.GID = Guid.NewGuid().ToString();//唯一编码 newid()
headData.DbOperationType = DbOperationType.DbotIns;
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
//
if (isPost)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsCwDesignDAL.GetData("GID='" + headData.GID.ToString() + "'", Convert.ToString(Session["COMPANYID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
#endregion
//
}
}