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.
235 lines
7.5 KiB
C#
235 lines
7.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Models;
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
using DSWeb.TruckMng.Helper;
|
|
using WebSqlHelper;
|
|
using System.Web.Configuration;
|
|
using System.IO;
|
|
using DSWeb.SysMng.DAL.SysRoleTaskQuery;
|
|
using DSWeb.Areas.MvcShipping.Helper;
|
|
using DSWeb.Common.DB;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using DSWeb.SoftMng.DAL.SoftSysTable;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
namespace DSWeb.Areas.SysMng.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 首页工作台 后台
|
|
/// </summary>
|
|
[JsonRequestBehavior]
|
|
public class SysRoleTaskQueryController : Controller
|
|
{
|
|
//
|
|
// GET: /CommMng/Print/
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition, string CODENAME = "")
|
|
{
|
|
|
|
var count = 0;
|
|
|
|
//var userid = Convert.ToString(Session["USERID"]);
|
|
//var uid = Session["USERID"].ToString();
|
|
//var corpid = Session["COMPANYID"].ToString();
|
|
|
|
|
|
var dataList = SysRoleTaskQueryDAL.GetDataList(start, limit, sort, condition, ref count);
|
|
|
|
|
|
|
|
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
|
|
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetData( string GID)
|
|
{
|
|
if ( GID == "*" || string.IsNullOrWhiteSpace( GID))
|
|
{
|
|
var nulllist = new List<Sys_Role_Task_Query_md>();
|
|
var newrec = new Sys_Role_Task_Query_md();
|
|
//nulllist.Add(newrec);
|
|
var jsonnull = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = 1, data = newrec });
|
|
return new ContentResult() { Content = jsonnull };
|
|
}
|
|
|
|
|
|
|
|
|
|
var count = 0;
|
|
|
|
//var userid = Convert.ToString(Session["USERID"]);
|
|
//var uid = Session["USERID"].ToString();
|
|
//var corpid = Session["COMPANYID"].ToString();
|
|
|
|
|
|
var dataList = SysRoleTaskQueryDAL.GetDataList(0, 1, "", "{GID:\""+ GID + "\"}", ref count);
|
|
|
|
|
|
|
|
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
|
|
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
if (dataList.Count == 0 || GID=="*") {
|
|
var newrec = new Sys_Role_Task_Query_md();
|
|
dataList.Add(newrec);
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList[0] });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetRoleTaskQuery(string GID) {
|
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
if (!canlogin.Success)
|
|
{
|
|
return (ContentResult)canlogin.Data;
|
|
}
|
|
|
|
var count = 0;
|
|
|
|
var dataList = SysRoleTaskQueryDAL.GetDataList(0, 1, "", "{GID:\"" + GID + "\"}", ref count);
|
|
|
|
if (dataList.Count == 0)
|
|
{
|
|
var newrec = new Sys_Role_Task_Query_md();
|
|
dataList.Add(newrec);
|
|
}
|
|
|
|
var USERID = Session["USERID"].ToString();
|
|
|
|
foreach (var item in dataList) {
|
|
item.SQLCONTEXT = item.GetCondition(USERID);
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList[0] });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult Save(string opstatus, string data, string data2, string body)
|
|
{
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
if (!canlogin.Success)
|
|
{
|
|
return (ContentResult)canlogin.Data;
|
|
}
|
|
|
|
data = data.Replace("❥", "<");
|
|
var headData = JsonConvert.Deserialize<Sys_Role_Task_Query_md>(data);//(data.Replace("}", ",") + data2.Replace("{", "")
|
|
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
if (isPost)
|
|
{
|
|
if (opstatus == "add")
|
|
{
|
|
var uid = Session["USERID"].ToString();
|
|
|
|
//var compid = cdc.VW_user_all.AsNoTracking().FirstOrDefault(u => u.USERID == uid).COMPANYID;
|
|
|
|
headData.GID = Guid.NewGuid();
|
|
//headData.COMPANYID = compid;
|
|
cdc.Sys_Role_Task_Query.Add(headData);
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
var oldheaddata = cdc.Sys_Role_Task_Query.First(x => x.GID == headData.GID);
|
|
oldheaddata.SaveCopy(headData);
|
|
}
|
|
|
|
cdc.SaveChanges();
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "",
|
|
Data = headData
|
|
};
|
|
|
|
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 DelDetail(string GID)
|
|
//{
|
|
|
|
// var bd = new BookingDB();
|
|
|
|
// var GIDList = GID.Split(',').ToList();
|
|
|
|
// var olddetail = bd.Contacts.Where(x => GIDList.Contains(x.GID)).ToList();
|
|
|
|
// var jsonRespose = new JsonResponse
|
|
// {
|
|
// Success = true,
|
|
// Message = "",
|
|
// Data = ""
|
|
// };
|
|
|
|
// if (olddetail != null)
|
|
// {
|
|
// bd.Contacts.RemoveRange(olddetail);
|
|
// bd.SaveChanges();
|
|
// }
|
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
//}
|
|
|
|
public ContentResult DelHead(string GID)
|
|
{
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
var oldhead = cdc.Sys_Role_Task_Query.Where(x => x.GID == new Guid( GID)).ToList();
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "删除成功!",
|
|
Data = ""
|
|
};
|
|
|
|
if (oldhead != null)
|
|
{
|
|
cdc.Sys_Role_Task_Query.RemoveRange(oldhead);
|
|
cdc.SaveChanges();
|
|
}
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|