|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsCtBankDeployDAL;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsCtBankDeploy;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsCtBankDeployController : Controller
|
|
|
|
|
{
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDataList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = MsCtBankDeployDAL.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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
MsCtBankDeploy head = null;
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
head = MsCtBankDeployDAL.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 MsCtBankDeploy();
|
|
|
|
|
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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult Save(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 = "";
|
|
|
|
|
var isPost = true;
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsCtBankDeploy>>(body);
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
string strACCDATE = BasicDataRefDAL.GetCtACCDATE(Convert.ToString(Session["USERID"]));
|
|
|
|
|
string sYEAR = DateTime.Parse(strACCDATE + "-01").Year.ToString();
|
|
|
|
|
string sMONTH = DateTime.Parse(strACCDATE + "-01").Month.ToString();
|
|
|
|
|
if (sMONTH.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
sMONTH = "0" + sMONTH;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (isPost)
|
|
|
|
|
{
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = null;
|
|
|
|
|
if (bodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
#region 默认值
|
|
|
|
|
MsCtBankDeploy headRow = new MsCtBankDeploy();
|
|
|
|
|
//headRow.BANKGID = sBANKGID;//银行GID
|
|
|
|
|
headRow.ACCGID = enumValue.ACCGID == null ? "" : enumValue.ACCGID.ToString().Trim();//银行GID
|
|
|
|
|
headRow.FCYNO = enumValue.FCYNO == null ? "" : enumValue.FCYNO.ToString().Trim();//外币编号RMB
|
|
|
|
|
headRow.STARTROW = enumValue.STARTROW == null ? "" : enumValue.STARTROW.ToString().Trim();//读取开始行
|
|
|
|
|
headRow.VOUDATE = enumValue.VOUDATE == null ? "" : enumValue.VOUDATE.ToString().Trim();//结算日期
|
|
|
|
|
headRow.VOUTIME = enumValue.VOUTIME == null ? "" : enumValue.VOUTIME.ToString().Trim();//结算时间
|
|
|
|
|
headRow.EXPLAN = enumValue.EXPLAN == null ? "" : enumValue.EXPLAN.ToString().Trim();//摘要
|
|
|
|
|
headRow.DR = enumValue.DR == null ? "" : enumValue.DR.ToString().Trim();//借方
|
|
|
|
|
headRow.CR = enumValue.CR == null ? "" : enumValue.CR.ToString().Trim();//贷方
|
|
|
|
|
headRow.BLC = enumValue.BLC == null ? "" : enumValue.BLC.ToString().Trim();//余额
|
|
|
|
|
headRow.DC = enumValue.DC == null ? "" : enumValue.DC.ToString().Trim();//借贷方向
|
|
|
|
|
headRow.DRGJZ = enumValue.DRGJZ == null ? "" : enumValue.DRGJZ.ToString().Trim();//借方关键字
|
|
|
|
|
headRow.CRGJZ = enumValue.CRGJZ == null ? "" : enumValue.CRGJZ.ToString().Trim();//贷方关键字
|
|
|
|
|
headRow.STARTGID = BasicDataRefDAL.GetCtSTARTGID(Convert.ToString(Session["USERID"]));
|
|
|
|
|
headRow.CORPID = Convert.ToString(Session["COMPANYID"]);//分公司代码
|
|
|
|
|
headRow.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人gid
|
|
|
|
|
headRow.CREATETIME = DateTime.Now;//创建时间
|
|
|
|
|
headRow.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//更改操作人gid
|
|
|
|
|
headRow.MODIFIEDTIME = DateTime.Now;//更改操作时间
|
|
|
|
|
//
|
|
|
|
|
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 += "重复数据不再重复插入!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = MsCtBankDeployDAL.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) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(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<MsCtBankDeploy>(data);
|
|
|
|
|
DBResult result = modb.Delete(head);
|
|
|
|
|
//DBResult result = MsCtBankDeployDAL.Delete(head, Convert.ToString(Session["USERID"]));
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|