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/MvcShipping/Controllers/MsOpStatusController.cs

162 lines
6.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Helper.Repository;
using DSWeb.MvcShipping.Models.MsOpStatus;
using DSWeb.Areas.Account.Models.MsOpBill;
using DSWeb.Areas.MvcShipping.DAL;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.SoftMng.Filter;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsOpStatusController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult PiLiang()
{
return View();
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetListData(int start, int limit, string sort, string condition)
{
var dataList = MsOpStatusDAL.GetDataList(condition);
var list = dataList.Skip(start).Take(limit).ToList();
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list });//list.ToList()
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetData(string condition)
{
MsOpStatus head = null;
var list = MsOpStatusDAL.GetDataList(condition);
if (list.Count > 0)
head = list[0];
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string bsno, string body)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
var bodyList = JsonConvert.Deserialize<List<MsOpStatus>>(body);
var result = new DBResult();
if (bodyList != null)
{
result = MsOpStatusDAL.SaveUpdate(bodyList, bsno, Convert.ToString(Session["SHOWNAME"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult PiliangSave(string bill, string body)
{
var billList = JsonConvert.Deserialize<List<MsOpBill>>(bill);
var bodyList = JsonConvert.Deserialize<List<MsOpStatus>>(body);
var result = new DBResult();
if (bodyList != null)
{
result = MsOpStatusDAL.SavePiliangUpdate(billList,bodyList, Convert.ToString(Session["SHOWNAME"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string bsno, string data)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
var bodyList = JsonConvert.Deserialize<List<MsOpStatus>>(data);
var result = new DBResult();
if (bodyList != null)
{
result = MsOpStatusDAL.DeleteStatus(bodyList);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult WxMsgSend(string bsno, string data)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
var bodyList = JsonConvert.Deserialize<List<MsOpStatus>>(data);
var result = new DBResult();
if (bodyList != null)
{
result = MsOpStatusDAL.WxMsgStatus(bsno,bodyList, Convert.ToString(Session["USERID"]).ToString());
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}