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/SysMng/Controllers/USERINFOController.cs

185 lines
5.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.SysMng.DAL.USERINFO;
using DSWeb.Areas.SysMng.Models.USERINFO;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.Areas.SysMng.Controllers
{
[JsonRequestBehavior]
public class USERINFOController : Controller
{
//
// GET: /TruckMng/Enum/
public ActionResult Index()
{
return View();
}
//
// GET: /TruckMng/Enum/Edit
public ActionResult Edit()
{
return View();
}
//
// GET/TruckMng/Enum/GetDataList
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = USERINFODAL.GetDataList(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/TruckMng/Enum/GetData/
public ContentResult GetData()
{
USERmb headData = null;
var _USERID = Session["USERID"].ToString();
var condition = " GID='" + _USERID + "'";
var list = USERINFODAL.GetDataList(condition);
if (list.Count > 0)
headData = list[0];
if (headData == null)
{
headData = new USERmb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = headData });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/Enum/Save
public ContentResult Save ( string opstatus, string data, string body, string Delbody )
{
var headData = JsonConvert.Deserialize<USERmb>(data);
var bodyList = JsonConvert.Deserialize<List<USERINFOmb>>(body);
var DelbodyList = JsonConvert.Deserialize<List<USERINFOmb>>(Delbody);
var result = new DBResult();
var _USERID = Session["USERID"].ToString();
var condition = " GID='" + _USERID + "'";
string username = headData.USERNAME;
if (!string.IsNullOrEmpty(headData.PASSWORD))
{
var _USER = USERINFODAL.GetData(condition);
if (_USER.PASSWORD != headData.OLDPASSWORD)
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "旧密码填写错误",
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
else
{
}
}
else {
headData = USERINFODAL.GetData(condition);
headData.USERNAME = username;
}
//if (opstatus == "add")
//{
// headData.DbOperationType = DbOperationType.DbotIns;
// headData.ModelUIStatus = "I";
//}
//else
//{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
//}
var modb = new ModelObjectRepository();
result = modb.Save(headData,
ModelObjectConvert<USERINFOmb>.ToModelObjectList(bodyList),
ModelObjectConvert<USERINFOmb>.ToModelObjectList(DelbodyList)
);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//
// GET/TruckMng/Enum/Delete
public ContentResult GetUSERINFOBodyList()
{
var _USERID = Session["USERID"].ToString();
var condition = " USERID='" + _USERID + "'";
List<USERINFOmb> list = USERINFODAL.GetUSERINFOList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetUSERINFOData()
{
USERINFOmb headData = null;
var _USERID = Session["USERID"].ToString();
var condition = " USERID='" + _USERID + "'";
var list = USERINFODAL.GetUSERINFOList(condition);
if (list.Count > 0)
headData = list[0];
if (headData == null)
{
headData = new USERINFOmb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = headData });
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}