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 信息录入处理
///
/// 分页查询(未完成)
///
///
///
///
///
public JsonResult GetAllData(int page, int pagesize, string key)
{
var bll = new BLL.InfectionOpenUserInfoBll();
List iouiList = bll.GetAllDataList();
return Json(new { });
}
///
/// 根据身份证号码获取信息
///
///
///
[AllowAnonymous]
[HttpPost]
public JsonResult GetDataByIdent(string ident)
{
var bll = new BLL.InfectionOpenUserInfoBll();
List iouiList = bll.GetDataListByIdent(ident);
return Json(new { Total = 1, Rows = iouiList });
}
///
/// 查询未审核的数据
///
///
[AllowAnonymous]
[HttpPost]
public JsonResult GetNotTypeData()
{
var bll = new BLL.InfectionOpenUserInfoBll();
List iouiList = bll.GetDataListNotType();
return Json(new { Total = 1, Rows = iouiList });
}
///
/// 保存数据和图片
///
///
///
///
[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
}
}