|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.Import.DAL.approval;
|
|
|
|
|
using DSWeb.Areas.Import.Models.approval;
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.Import.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class approvalController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /Import/approval
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /Import/approval/Edit
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/Import/approval/GetDataList
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = approvalDAL.GetDataList(condition,sort);
|
|
|
|
|
|
|
|
|
|
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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/Import/approval/GetData/
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
approvalmb head = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = approvalDAL.GetDataList(condition,"");
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
head = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new approvalmb();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetUsing(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = approvalDAL.GetUsing(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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/Import/approval/Save
|
|
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
|
|
|
{
|
|
|
|
|
approvalmb head = JsonConvert.Deserialize<approvalmb>(data);
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
|
|
|
|
head.gid = PubSysDAL.GetBillNo("0203"); //获取许可证序列号
|
|
|
|
|
// head.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Save(head);
|
|
|
|
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = approvalDAL.GetData("a.gid='" + head.gid +"'")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//20130128 如果成功的话 将所有相关业务的用证公司改成这个
|
|
|
|
|
approvalDAL.SetCompany(head.gid, head.company);
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
|
|
{
|
|
|
|
|
var head = JsonConvert.Deserialize<approvalmb>(data);
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Delete(head);
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|