tijian_tieying/web/dccdc/Controllers/WeiHuController.cs
2025-02-20 12:14:39 +08:00

131 lines
4.1 KiB
C#

using dccdc.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace dccdc.Controllers
{
public class WeiHuController : Controller
{
// GET: WeiHu
public ActionResult Index()
{
return View();
}
public ActionResult SzInfectiousDiseaseCategory()
{
return View();
}
public string GetInfectiousDiseaseCategory(int page, int pagesize)
{
dccdc.BLL.WeiHuBll c = new dccdc.BLL.WeiHuBll();
int count = c.getCount();
var list = c.getListPage(page, pagesize);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = list });
}
[HttpGet]
public ActionResult EditInfectiousDiseaseCategory(string id)
{
var bll = new dccdc.BLL.WeiHuBll();
if (!string.IsNullOrEmpty(id))
{
var model = bll.GetAllList(id).First();
var viewModel = new Sz_infectiousDisease_category
{
infectiousDiseaseName = model.infectiousDiseaseName,
infectiousDiseaseCate = model.infectiousDiseaseCate,
icd = model.icd,
state = model.state,
px = model.px,
DiseaseCode = model.DiseaseCode,
DiseaseName = model.DiseaseName,
id = model.id
};
return View(viewModel);
}
else
{
return View(new Sz_infectiousDisease_category());
}
}
[HttpPost]
public ActionResult EditInfectiousDiseaseCategory(Sz_infectiousDisease_category model)
{
ModelState.Remove("Id");
if (!ModelState.IsValid)
{
var errors = ModelState.Values.SelectMany(v => v.Errors);
return View(model);
}
dccdc.BLL.WeiHuBll c = new dccdc.BLL.WeiHuBll();
Sz_infectiousDisease_category dtomodel = new Sz_infectiousDisease_category
{
infectiousDiseaseName = model.infectiousDiseaseName,
infectiousDiseaseCate = model.infectiousDiseaseCate,
icd = model.icd,
state = model.state,
px = model.px,
DiseaseCode = model.DiseaseCode,
DiseaseName = model.DiseaseName,
id = model.id
};
//修改
var f = false;
f = model.id != 0 ? c.Update(dtomodel) : c.Add(dtomodel);
return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" });
}
public ActionResult WeiXinNR(string id)
{
//ViewBag.bt = id;
Models.SystemParmsModel parm = new BLL.Common().GetModelBy(id);
return View(parm);
}
[HttpPost]
[ValidateInput(false)]
public JsonResult SaveWeiXinNR(SystemParmsModel sp)
{
//sp.id = int.Parse(Request.Form["id"]);
var b = new BLL.Common().Update(sp);
if (b)
{
return Json(new { State = 1, Message = "保存成功!" });
}
else
{
return Json(new { State = 0, Message = "保存失败!"});
}
}
public ActionResult jkzdqtxsz()
{
return View();
}
[HttpPost]
public string gettxszlist(FormCollection fc)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Rows = new BLL.jkzdqtxBll().gettxszlist() });
}
[HttpPost]
public string savetxsz(Models.jkztxsz txsz)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.jkzdqtxBll().savetxsz(txsz));
}
public string deltxsz(string id)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.jkzdqtxBll().deltxsz(id));
}
}
}