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/Import/Controllers/approvalController.cs

137 lines
4.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
using DSWeb.SoftMng.Filter;
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
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
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/
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
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 };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
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
}
}