tijian_tieying/web/dccdc/Controllers/InformationController.cs

109 lines
3.2 KiB
C#
Raw Normal View History

2025-02-20 12:14:39 +08:00
using dccdc.Models;
using Jayrock.Json.Conversion;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace dccdc.Controllers
{
public class InformationController : Controller
{
// GET: PersonalInformation
public ActionResult Index()
{
return View();
}
#region
/// <summary>
/// 分页查询(未完成)
/// </summary>
/// <param name="page"></param>
/// <param name="pagesize"></param>
/// <param name="key"></param>
/// <returns></returns>
public JsonResult GetAllData(int page, int pagesize, string key)
{
var bll = new BLL.InfectionOpenUserInfoBll();
List<Models.InfectionOpenUserInfoModel> iouiList = bll.GetAllDataList();
return Json(new { });
}
/// <summary>
/// 根据身份证号码获取信息
/// </summary>
/// <param name="ident"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public JsonResult GetDataByIdent(string ident)
{
var bll = new BLL.InfectionOpenUserInfoBll();
List<Models.InfectionOpenUserInfoModel> iouiList = bll.GetDataListByIdent(ident);
return Json(new { Total = 1, Rows = iouiList });
}
/// <summary>
/// 查询未审核的数据
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public JsonResult GetNotTypeData()
{
var bll = new BLL.InfectionOpenUserInfoBll();
List<Models.InfectionOpenUserInfoModel> iouiList = bll.GetDataListNotType();
return Json(new { Total = 1, Rows = iouiList });
}
/// <summary>
/// 保存数据和图片
/// </summary>
/// <param name="model"></param>
/// <param name="file"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public JsonResult SaveData(InfectionOpenUserInfoModel model, HttpPostedFile file)
{
if (file.ContentLength != 0)
{
string path = string.Empty;
try
{
path = Server.MapPath("~/photo/");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var erpUser = Session["loginUser"] as Models.ERPUser;
path += erpUser.ID + "\\";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
path += DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
file.SaveAs(path);
model.license = path;
}
catch (Exception ex)
{
string e = ex.Message;
}
}
return Json(new BLL.InfectionOpenUserInfoBll().SaveData(model));
}
#endregion
#region
#endregion
}
}