public ActionResult EditEliminateInfo(string taskNumber) { if (Session["CheckEliminateInfo"] == null || !(bool)Session["EditEliminateInfo"] || !(bool)Session["CheckEliminateInfo"]) { Response.Write("<script>history.go(0);</script>"); return View("Error"); } EliminateInfo newInfo = new EliminateInfo().CheckEliminateInfo(taskNumber); if (newInfo == null) { ViewBag.Title = "查看修改失败,请重新操作"; return View("Message"); } var pighouse= new ListService().GetPigHouseList(); var pigsty = new ListService().FindPigstyListByPigHouseId(pighouse.FirstOrDefault().Value); ViewData["pighouse"] = pighouse; ViewData["pigsty"] = pigsty; ViewData["Employee"] = new ListService().GetEmployeeList(); ViewData["pig"] = new ListService().FindPigListByPigstyId(pigsty.FirstOrDefault().Value); ViewBag.Title = "修改淘汰信息"; return View("NewEliminateInfo", newInfo); }
public ActionResult NewDeadInfo() { if (Session["CheckDeadInfo"] == null || !(bool)Session["AddDeadInfo"] || !(bool)Session["CheckDeadInfo"]) { Response.Write("<script>history.go(0);</script>"); return View("Error"); } var newInfo = new DeadInfo(); var taskService = new TaskService(); if (!newInfo.GetTaskNumberSelect(TaskTypeId).Any()) { const string returnstring = "淘汰任务的生产信息已全部导入"; Response.Write("<script language='JavaScript'>alert('" + returnstring + ".');history.go(-1);</script>"); return Content(""); } SelectListItem firstOrDefault = newInfo.GetTaskNumberSelect(TaskTypeId).FirstOrDefault(); var pighouse = new ListService().GetPigHouseList(); var pigsty = new ListService().FindPigstyListByPigHouseId(pighouse.FirstOrDefault().Value); ViewData["TaskNumber"] = newInfo.GetTaskNumberSelect(TaskTypeId); ViewData["Employee"] = new ListService().GetEmployeeList(); ViewData["pighouse"] = pighouse; ViewData["pigsty"] = pigsty; ViewData["pig"] = new ListService().FindPigListByPigstyId(pigsty.FirstOrDefault().Value); ViewBag.Title = "新建死亡信息"; return View(newInfo); }
public ActionResult PigData(int pageIndex = 1) { if (Session["CheckFeed"] == null || !(bool) Session["CheckPigData"]) { Response.Write("<script>history.go(0);</script>"); return View("Error"); } var pigInfo = new PigInfo(); PagedList<PigInfo> infoPagerList; if (Request.Form["CheckPig"] != null) { Session["check"] = Request.Form["CheckPig"]; Session["chooseid"] = Request.Form["SearchChose"]; infoPagerList = pigInfo.GetPigList(Request.Form["CheckPig"], Request.Form["SearchChose"], 1, PageSize); } else if (Session["check"] != null && Session["chooseid"] != null && Request.HttpMethod == "POST" && Session["chooseid"] as string != "") { infoPagerList = pigInfo.GetPigList(Session["check"] as string, Session["chooseid"] as string, pageIndex, PageSize); } else { //infoPagerList = pigInfo.GetInfoPagedList( // pigInfo.GetPigList("", ""), pageIndex, PageSize); Session["check"] = ""; Session["chooseid"] = ""; infoPagerList = pigInfo.GetPigList(pageIndex, PageSize); } ViewData["pigSum"] = infoPagerList.TotalItemCount; //ViewData["NomalpigSum"] = infoPagerList.Count(m => m.state == "正常"); //ViewData["UnNomalpigSum"] = infoPagerList.Count(m => m.state != "正常"); if (Request.IsAjaxRequest()) { return PartialView("PigDataUCJqInfoList", infoPagerList); } var pigHouseList = new ListService().GetPigHouseList(); var First = pigHouseList.FirstOrDefault(); if (First != null) ViewData["pigsty"] = new ListService().FindPigstyListByPigHouseId(First.Value); else ViewData["pigsty"] = new List<SelectListItem>(); ViewData["Search"] = new ListService().GetPigInfoSearchList(); ViewData["pighouse"] = new ListService().GetPigHouseList(); ViewData["pigtype"] = new ListService().GetPigTypeList(); //临时 var rolau = new RoleAuthorityService(); rolau.update(); // return View(infoPagerList); }
public ActionResult PigDataEdit(string pigNumber) { if (Session["CheckFeed"] == null || !(bool) Session["EditPigData"] || !(bool) Session["CheckPigData"]) { Response.Write("<script>history.go(0);</script>"); return View("Error"); } PigInfo pigInfo = new PigInfo().CheckPigInfo(pigNumber); if (pigInfo == null) { ViewBag.Title = "查看修改失败,请重新操作"; return View("Message"); } var pigHouseList = new ListService().GetPigHouseList(); var First = pigHouseList.FirstOrDefault(); if (First != null) ViewData["pigsty"] = new ListService().FindPigstyListByPigHouseId(First.Value); else ViewData["pigsty"] = new List<SelectListItem>(); ViewData["pighouse"] = pigHouseList; ViewData["malePig"] = new ListService().GetMalePigList(); ViewData["PigType"] = new ListService().GetPigTypeList(); ViewData["PigNum"] = pigNumber; ViewData["PigRFID"] = pigInfo.Rfid; ViewData["FemalePig"] = new ListService().GetFemaleList(); ViewBag.Title = "修改生猪个体信息"; return View("PigDataAdd", pigInfo); }
public ActionResult PigDataAdd() { if (Session["CheckFeed"] == null || !(bool) Session["AddPigData"] || !(bool) Session["CheckPigData"]) { Response.Write("<script>history.go(0);</script>"); return View("Error"); } var pigInfo = new PigInfo(); IEnumerable<SelectListItem> taskNumberList = new Info().GetTaskNumberSelect(TaskTypeId); if (!taskNumberList.Any()) { const string returnstring = "任务为空,请先添加任务"; Response.Write("<script language='JavaScript'>alert('" + returnstring + ".');history.go(-1);</script>"); return Content(""); } try { var pigHouseList = new ListService().GetPigHouseList(); var First = pigHouseList.FirstOrDefault(); if (First != null) ViewData["pigsty"] = new ListService().FindPigstyListByPigHouseId(First.Value); else ViewData["pigsty"] = new List<SelectListItem>(); ViewData["pighouse"] = pigHouseList; ViewData["TaskNumber"] = new Info().GetTaskNumberSelect(TaskTypeId); ViewData["FemalePig"] = new ListService().GetFemaleList(); ViewData["malePig"] = new ListService().GetMalePigList(); ViewData["PigType"] = new ListService().GetPigTypeList(); } catch (Exception) { const string returnstring = "数据缺失"; Response.Write("<script language='JavaScript'>alert('" + returnstring + ".');history.go(-1);</script>"); } ViewBag.Title = "添加生猪"; return View(pigInfo); }