コード例 #1
0
        public ActionResult CheckPreventionDiseaseInfo(string taskNumber, string employeeName)
        {
            if (Session["CheckFeed"] == null || !(bool) Session["CheckPreventionDiseaseInfo"])
            {
                Response.Write("<script>history.go(0);</script>");
                return View("Error");
            }

            PreventionInfo checkPreventionDiseaseInfo = new PreventionInfo().CheckPreventionInfo(taskNumber,
                                                                                                 employeeName);
            if (checkPreventionDiseaseInfo == null)
            {
                ViewBag.Title = "查看失败,请重新操作";
                return View("Message");
            }
            ViewBag.Title = "查看防疫信息";
            return View(checkPreventionDiseaseInfo);
        }
コード例 #2
0
        public ActionResult EditPreventionDiseaseInfo(string taskNumber, string employeeName)
        {
            if (Session["CheckFeed"] == null || !(bool) Session["EditPreventionDiseaseInfo"] ||
                !(bool) Session["CheckPreventionDiseaseInfo"])
            {
                Response.Write("<script>history.go(0);</script>");
                return View("Error");
            }

            PreventionInfo preventionDiseaseInfo = new PreventionInfo().CheckPreventionInfo(taskNumber, employeeName);
            if (preventionDiseaseInfo == null)
            {
                ViewBag.Title = "查看失败,请重新操作";
                return View("Message");
            }
            ViewBag.Title = "修改防疫信息";
            ViewData["pigsty"] = new ListService().GetFirstPigstyList();
            ViewData["Employee"] = new ListService().GetEmployeeList();
            ViewData["pighouse"] = new ListService().GetPigHouseList();
            ViewData["Pigfodder"] = new ListService().GetFodderTypeList();
            ViewData["unit"] = new ListService().GetUnitList();
            return View("NewPreventionDiseaseInfo", preventionDiseaseInfo);
        }
コード例 #3
0
        /// <summary>
        ///     查看防疫信息
        /// </summary>
        /// <param name="taskNumber">任务编号</param>
        /// <returns></returns>
        public PreventionInfo CheckPreventionInfo(string taskNumber, string employeeName)
        {
            var preventionService = new PreventionService();
            var checkPreventionInfo = new PreventionInfo();
            checkPreventionInfo.PreventionInfoDetail = new List<Detail>();
            var taskService = new TaskService();
            task task = taskService.FindByTaskNumber(taskNumber);
            if (task == null) return null;
            task_prevention firstOrDefault = task.task_prevention.FirstOrDefault();
            if (firstOrDefault != null)
            {
                checkPreventionInfo.TaskNumber = taskNumber;
                checkPreventionInfo.EmployeeName = employeeName;
                checkPreventionInfo.DiseaseName = firstOrDefault.prevention_type.Name;
                checkPreventionInfo.Medicine = firstOrDefault.prevention_type.medicine.Name;
                checkPreventionInfo.Quality = firstOrDefault.prevention_type.Quality;
                checkPreventionInfo.Unit = firstOrDefault.prevention_type.unit1.Name;
            }

            foreach (
                prevention preventionItem in
                    preventionService.FindByTaskId(task.Id).Where(m => m.employee.Name.Equals(employeeName)))
            {
                checkPreventionInfo.PreventionInfoDetail.Add(new Detail
                                                                 {
                                                                     PigHouse =
                                                                         preventionItem.pigsty.pig_house.pig_house_type.
                                                                                        Name
                                                                         + preventionItem.pigsty.pig_house.Number,
                                                                     Pigsty = preventionItem.pigsty.Number + "",
                                                                     DetailTime = preventionItem.Time
                                                                 });
            }

            return checkPreventionInfo;
        }
コード例 #4
0
        /// <summary>
        ///     修改防疫信息
        /// </summary>
        /// <param name="updateInfo">防疫页面信息</param>
        /// <returns></returns>
        public bool UpdatePreventionInfo(PreventionInfo updateInfo)
        {
            var preventionService = new PreventionService();
            var taskService = new TaskService();
            task task = taskService.FindByTaskNumber(updateInfo.TaskNumber);
            int count = 0;
            if (task != null)
            {
                foreach (prevention prevention in preventionService.FindByTaskId(task.Id))
                {
                    if (count < updateInfo.PreventionInfoDetail.Count)
                    {
                        prevention.PigstyId = long.Parse(updateInfo.PreventionInfoDetail[count].Pigsty);
                        prevention.EmployeeId = long.Parse(updateInfo.EmployeeName);
                        prevention.Time = updateInfo.PreventionInfoDetail[count].DetailTime;
                        prevention.Memo = updateInfo.Meno;
                        preventionService.Update(prevention);
                    }
                    else
                    {
                        preventionService = new PreventionService();
                        preventionService.Delete(preventionService.Find(prevention.Id));
                    }
                    count++;
                }
                for (; count < updateInfo.PreventionInfoDetail.Count; count++)
                {
                    preventionService.Insert(new prevention
                                                 {
                                                     PigstyId =
                                                         long.Parse(updateInfo.PreventionInfoDetail[count].Pigsty),
                                                     EmployeeId = long.Parse(updateInfo.EmployeeName),
                                                     Time = updateInfo.PreventionInfoDetail[count].DetailTime,
                                                     Memo = updateInfo.Meno
                                                 });
                }
                return true;
            }

            return false;
        }
コード例 #5
0
 /// <summary>
 ///     新建防疫信息
 /// </summary>
 /// <param name="newInfo"></param>
 /// <returns></returns>
 public bool CreateTransferPigstyInfo(PreventionInfo newInfo)
 {
     if (newInfo == null) return false;
     var preventionService = new PreventionService();
     var taskStatusTypeService = new TaskStatusTypeService();
     var taskService = new TaskService();
     foreach (Detail newInfoItem in newInfo.PreventionInfoDetail)
     {
         preventionService.Insert(new prevention
                                      {
                                          TaskId = long.Parse(newInfo.TaskNumber),
                                          EmployeeId = long.Parse(newInfo.EmployeeName),
                                          PigstyId = long.Parse(newInfoItem.Pigsty),
                                          Time = newInfoItem.DetailTime,
                                          Memo = newInfo.Meno
                                      });
     }
     task_status_type taskStatusType = taskStatusTypeService.FindByName("已完成");
     task task = taskService.Find(long.Parse(newInfo.TaskNumber));
     if (taskStatusType != null && task != null)
     {
         task.TaskStatusId = taskStatusType.Id;
         taskService.Update(task);
     }
     return true;
 }
コード例 #6
0
        public ActionResult NewPreventionDiseaseInfo()
        {
            if (Session["CheckFeed"] == null || !(bool) Session["AddPreventionDiseaseInfo"] ||
                !(bool) Session["CheckPreventionDiseaseInfo"])
            {
                Response.Write("<script>history.go(0);</script>");
                return View("Error");
            }

            var newInfo = new PreventionInfo();
            var taskPreventionService = new TaskPreventionService();
            IEnumerable<SelectListItem> taskNumberList = newInfo.GetTaskNumberSelect(TaskTypeId);
            if (!taskNumberList.Any())
            {
                const string returnstring = "任务为空,请先添加任务";
                Response.Write("<script language='JavaScript'>alert('" + returnstring + ".');history.go(-1);</script>");
                return Content("");
            }
            SelectListItem firstOrDefault = newInfo.GetTaskNumberSelect(TaskTypeId).FirstOrDefault();
            if (firstOrDefault != null)
            {
                string firstTask = firstOrDefault.Value;
                task_prevention orDefault = taskPreventionService.FindByTaskId(long.Parse(firstTask)).FirstOrDefault();
                if (orDefault != null)
                {
                    newInfo.DiseaseName = orDefault.prevention_type.Name;
                    newInfo.Medicine = orDefault.prevention_type.medicine.Name;
                    newInfo.Quality = orDefault.prevention_type.Quality;
                    newInfo.Unit = orDefault.prevention_type.unit1.Name;
                }
            }

            ViewData["TaskNumber"] = newInfo.GetTaskNumberSelect(TaskTypeId);
            ViewData["pigsty"] = new ListService().GetFirstPigstyList();
            ViewData["Employee"] = new ListService().GetEmployeeList();
            ViewData["pighouse"] = new ListService().GetPigHouseList();
            ViewData["Pigfodder"] = new ListService().GetFodderTypeList();
            ViewData["unit"] = new ListService().GetUnitList();
            ViewBag.Title = "新建防疫信息";
            return View(newInfo);
        }
コード例 #7
0
 public ActionResult EditPreventionDiseaseInfo(PreventionInfo newInfo)
 {
     var preventionDiseaseInfo = new PreventionInfo();
     ViewBag.Title = preventionDiseaseInfo.UpdatePreventionInfo(newInfo) ? "修改成功" : "修改失败,请重新操作";
     return View("Message");
 }
コード例 #8
0
        public ActionResult PreventionDiseaseInfo(int pageIndex = 1)
        {
            if (Session["CheckFeed"] == null || !(bool) Session["CheckPreventionDiseaseInfo"])
            {
                Response.Write("<script>history.go(0);</script>");
                return View("Error");
            }

            var preventionInfo = new PreventionInfo();

            const int pageSize = 25;

            PagedList<Info> infoPagerList;
            if (Request.Form["CheckEmployee"] != null)
            {
                //  Session["PreventionDiseaseChoose"] = Request.Form["SearchChose"];
                Session["check"] = Request.Form["CheckEmployee"];
                Session["chooseid"] = Request.Form["SearchChose"];
                infoPagerList =
                    preventionInfo.GetInfoPagedList(
                        preventionInfo.GetInfoList(preventionInfo.GetPreventionInfoList(), Request.Form["CheckEmployee"],
                                                   Request.Form["SearchChose"]),
                        pageIndex, pageSize);
                //  Session["SearchPreventionDisease"] = Request.Form["CheckEmployee"];
            }
            else if (Session["check"] != null && Session["chooseid"] != null && Request.HttpMethod == "POST")
            {
                infoPagerList =
                    preventionInfo.GetInfoPagedList(
                        preventionInfo.GetInfoList(preventionInfo.GetPreventionInfoList(),
                                                   Session["check"] as string, Session["chooseid"] as string),
                        pageIndex, pageSize);
            }
            else
            {
                // Session["PreventionDiseaseChoose"] = new ListService().GetInfoSearchList().FirstOrDefault().Value;
                Session["check"] = "";
                Session["chooseid"] = "";
                infoPagerList = preventionInfo.GetInfoPagedList(preventionInfo.GetPreventionInfoList(), pageIndex,
                                                                pageSize);
            }

            if (Request.IsAjaxRequest())
            {
                return PartialView("UCJqInfoList", infoPagerList);
            }
            ViewData["Search"] = new ListService().GetInfoSearchList();
            return View(infoPagerList);
        }
コード例 #9
0
 public ActionResult NewPreventionDiseaseInfo(PreventionInfo newInfo)
 {
     if (newInfo != null)
     {
         if (newInfo.CreateTransferPigstyInfo(newInfo))
         {
             ViewBag.Title = "新建成功";
             return View("Message");
         }
     }
     ViewBag.Title = "新建失败,请重新操作";
     return View("Message");
 }