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.
220 lines
11 KiB
C#
220 lines
11 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.DAL.MsCwDesignStartusingDAL;
|
|
using DSWeb.MvcShipping.Models.MsCwDesignStartusing;
|
|
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;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class MsCwDesignStartusingController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
#region 查询
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataList(string condition)
|
|
{
|
|
var dataList = MsCwDesignStartusingDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetData(string handle, string condition)
|
|
{
|
|
MsCwDesignStartusing head = null;
|
|
if (handle == "edit")
|
|
{
|
|
head = MsCwDesignStartusingDAL.GetData(condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
head.MODIFIEDUSER = Convert.ToString(Session["USERID"]);
|
|
head.MODIFIEDTIME = DateTime.Now;
|
|
}
|
|
if (head == null)
|
|
{
|
|
head = new MsCwDesignStartusing();
|
|
head.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
head.CREATEUSER = Convert.ToString(Session["USERID"]);
|
|
head.CREATETIME = DateTime.Now;
|
|
head.MODIFIEDUSER = Convert.ToString(Session["USERID"]);
|
|
head.MODIFIEDTIME = DateTime.Now;
|
|
}
|
|
var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
public ContentResult onSave(string body)
|
|
{
|
|
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) };
|
|
}
|
|
//
|
|
string errorstr = "";
|
|
string strIS = "";
|
|
var isPost = true;
|
|
var bodyList = JsonConvert.Deserialize<List<MsCwDesignStartusing>>(body);
|
|
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = new DBResult();
|
|
if (bodyList != null)
|
|
{
|
|
foreach (var enumValue in bodyList)
|
|
{
|
|
if (enumValue.ISENABLE)// || enumValue.ISLOGIN
|
|
{
|
|
strIS = " 注意:已经启用的账套,则不予以操作!";//或登录
|
|
}
|
|
else
|
|
{
|
|
#region 默认值
|
|
MsCwDesignStartusing headRow = new MsCwDesignStartusing();
|
|
headRow.STARTNAME = enumValue.STARTNAME == null ? "" : enumValue.STARTNAME.ToString().Trim();//账套名称
|
|
headRow.STARTMONTH = enumValue.STARTMONTH == null ? "" : enumValue.STARTMONTH.ToString().Trim().Substring(0, 7);//启用年月
|
|
headRow.CORPID = Convert.ToString(Session["COMPANYID"]);//分公司代码
|
|
headRow.ISDELETE = false;//是否删除
|
|
headRow.DELETEUSER = Convert.ToString(Session["USERID"]);//删除人
|
|
headRow.DELETETIME = DateTime.Now;//删除时间
|
|
headRow.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人gid
|
|
headRow.CREATETIME = DateTime.Now;//创建时间
|
|
headRow.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//更改操作人gid
|
|
headRow.MODIFIEDTIME = DateTime.Now;//更改操作时间
|
|
headRow.ISENABLE = enumValue.ISENABLE == null ? false : enumValue.ISENABLE;//ISENABLE
|
|
//headRow.ISLOGIN = enumValue.ISLOGIN == null ? false : enumValue.ISLOGIN;//ISLOGIN
|
|
//
|
|
if (enumValue.GID.ToString().Trim() == "*")
|
|
{
|
|
headRow.GID = Guid.NewGuid().ToString();//唯一编码
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
}
|
|
else//"edit"
|
|
{
|
|
headRow.GID = enumValue.GID.ToString().Trim();//唯一编码
|
|
headRow.DbOperationType = DbOperationType.DbotUpd;
|
|
headRow.ModelUIStatus = "E";
|
|
}
|
|
#endregion
|
|
//
|
|
modb = new ModelObjectDB();
|
|
result = modb.Save(headRow);
|
|
if (result.Message.ToString().IndexOf("重复") > -1)
|
|
{
|
|
errorstr = "注意:重复数据,不予以保存!";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (errorstr.Trim() != "")
|
|
{
|
|
result.Message = errorstr;
|
|
}
|
|
//
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message + strIS,
|
|
Data = MsCwDesignStartusingDAL.GetData("", Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]))
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
public ContentResult onDelete(string data)
|
|
{
|
|
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 modb = new ModelObjectDB();
|
|
var head = JsonConvert.Deserialize<MsCwDesignStartusing>(data);
|
|
DBResult result = modb.Delete(head);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
#endregion
|
|
|
|
#region 启用
|
|
public ContentResult onISENABLE(string data, string isSTART)
|
|
{
|
|
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 modb = new ModelObjectDB();
|
|
var head = JsonConvert.Deserialize<MsCwDesignStartusing>(data);
|
|
DBResult result = MsCwDesignStartusingDAL.onISENABLE(head, isSTART, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
#endregion
|
|
|
|
#region 登录
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult onISLOGIN(string data)
|
|
{
|
|
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 modb = new ModelObjectDB();
|
|
var head = JsonConvert.Deserialize<MsCwDesignStartusing>(data);
|
|
DBResult result = MsCwDesignStartusingDAL.onISLOGIN(head, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
#endregion
|
|
|
|
#region 获取启用的账套
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetSTARTMONTH(string STARTGID)
|
|
{
|
|
var strList = MsCwDesignStartusingDAL.GetSTARTMONTH(STARTGID, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
if (strList.Trim() == "-1")
|
|
{
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = "", data = "" });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
else
|
|
{
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "操作成功!", data = strList });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|