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.
DS7/DSWeb/Areas/OA/Controllers/JiekuanController.cs

185 lines
5.9 KiB
C#

3 years ago
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.OA.DAL.Jiekuan;
using DSWeb.Areas.OA.Models.Jiekuan;
using DSWeb.Areas.OA.Models.Comm;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.CommMng.DAL;
using HcUtility.Comm;
using HcUtility.Core;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Text;
using System.Data;
namespace DSWeb.Areas.OA.Controllers
{
[JsonRequestBehavior]
public class JiekuanController : Controller
{
//
// GET: /Import/XXH
public ActionResult Index()
{
return View();
}
//
// GET: /Import/XXH/Edit
public ActionResult Edit()
{
return View();
}
//
// GET/Import/XXH/GetDataList
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = JiekuanDAL.GetDataList(condition);
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)
{
Jiekuanmb head = null;
if (handle == "edit")
{
var list = JiekuanDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new Jiekuanmb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetCHEQUE(string condition)
{
var dataList = JiekuanDAL.GetCHEQUE(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 CHEQUEBody, string CHEQUEDelBody)
{
var head = JsonConvert.Deserialize<Jiekuanmb>(data);
var FeebodyList = JsonConvert.Deserialize<List<CHEQUEmb>>(CHEQUEBody);
var FeeDelbodyList = JsonConvert.Deserialize<List<CHEQUEmb>>(CHEQUEDelBody);
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
head.GID = PubSysDAL.GetBillNo("0402"); //获取管理费单号
head.BILLNO = head.GID;
//20131011 应客户要求,将合同号改为接单人手动填写的必填项目。不再自动生成合同号
//自动填写接单审单人id
//改为由前台自动生成
//head.CREATEUSER = CookieConfig.GetCookie_UserName(Request);
//head.COMPANY = CookieConfig.GetCookie_OrgName(Request);
}
else if (opstatus == "edit")
{
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
head.BILLNO = head.GID;
}
else
{
head.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(head,
ModelObjectConvert<CHEQUEmb>.ToModelObjectList(FeebodyList),
ModelObjectConvert<CHEQUEmb>.ToModelObjectList(FeeDelbodyList)
);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = JiekuanDAL.GetData("jk.GID='" + head.GID + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data,string USERID)
{
var head = JsonConvert.Deserialize<Jiekuanmb>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head,USERID,true);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete2 ( string data, string USERID )
{
var head = JsonConvert.Deserialize<Jiekuanmb>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head,
" delete from ch_Fee where JKGID='"+head.GID+"'"
);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/*
public ContentResult Audit(int newStatus, string chfeelist)
{
var chfeeList = JsonConvert.Deserialize<List<Jiekuanmb>>(chfeelist);
DBResult result = JiekuanDAL.Audit(newStatus, chfeeList);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}*/
public ContentResult Audit(int newStatus, string chfeelist)
{
var chfeeList = JsonConvert.Deserialize<List<Jiekuanmb>>(chfeelist);
DBResult result = JiekuanDAL.Audit(newStatus, chfeeList);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}