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/Dispatch/Controllers/BookingController.cs

78 lines
2.9 KiB
C#

using System.Configuration;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.Dispatch.DB;
using DSWeb.Areas.Dispatch.Helper;
using DSWeb.Areas.Dispatch.Models;
using DSWeb.Dispatch.DAL;
namespace DSWeb.Areas.Dispatch.Controllers
{
public class BookingController : Controller
{
private BookingDataContext bookingDataContext = new BookingDataContext();
private CommonDataContext commonDataContext = new CommonDataContext();
[HttpGet]
public ActionResult AuditList()
{
ViewData["BookingPlatformUrl"] = commonDataContext.ParamSets.First(p => p.PARAMNAME == "BookingPlatformUrl").PARAMVALUE;
return View();
}
[HttpPost]
public ActionResult AuditList(int offset, int limit, string identSta)
{
RespBookingUser resp = new RespBookingUser();
if (!string.IsNullOrEmpty(identSta))
{
resp.Total = bookingDataContext.Users.Where(d => d.IS_ADMIN == true && d.IDENTIFICATION_STATE == identSta).Count();
resp.Data = bookingDataContext.Users.Where(d => d.IS_ADMIN == true && d.IDENTIFICATION_STATE == identSta).OrderBy(d => d.REG_TIME).Skip(offset).Take(limit).AsBookingViewModelList();
}
else
{
resp.Total = bookingDataContext.Users.Where(d => d.IS_ADMIN == true).Count();
resp.Data = bookingDataContext.Users.Where(d => d.IS_ADMIN == true).OrderBy(d => d.REG_TIME).Skip(offset).Take(limit).AsBookingViewModelList();
}
return Json(resp);
}
[HttpPost]
public ActionResult SetActive(string uid, bool active)
{
RespCommon resp = new RespCommon();
string strSta = active ? "Active" : "Disabled";
bookingDataContext.Users.First(u => u.GID == uid).STATUS = strSta;
bookingDataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
[HttpPost]
public ActionResult Audit(string uid, string infoClient)
{
RespCommon resp = new RespCommon();
var user=bookingDataContext.Users.First(u => u.GID == uid);
user.IDENTIFICATION_STATE = "Indentified";
user.INFO_CLIENT = infoClient;
bookingDataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
[HttpPost]
public ActionResult Reject(string uid)
{
RespCommon resp = new RespCommon();
var user = bookingDataContext.Users.First(u => u.GID == uid);
user.IDENTIFICATION_STATE = "Reject";
bookingDataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
}
}