예제 #1
0
        public JsonResult LoadTask(string taskID)
        {
            TaskBLL   bll = new TaskBLL();
            DairyTask v;

            v = bll.GetTaskByID(Int32.Parse(taskID));
            string displayEarNum = CowBLL.ConvertEarNumToDisplayEarNum(v.EarNum);

            GroupingRecordBLL grbBLL   = new GroupingRecordBLL();
            GroupingRecord    gr       = grbBLL.GetGroupingRecordByTaskID(Int32.Parse(taskID));
            CowGroupBLL       cgBLL    = new CowGroupBLL();
            HouseBLL          hBLL     = new HouseBLL();
            CowGroup          oldgroup = cgBLL.GetCowGroupInfo(gr.OriginalGroupID);
            CowGroup          newgroup = cgBLL.GetCowGroupInfo(gr.TargetGroupID);
            House             oldhouse = hBLL.GetHouseByID(UserBLL.Instance.CurrentUser.Pasture.ID, gr.OriginalHouseID);
            House             newhouse = hBLL.GetHouseByID(UserBLL.Instance.CurrentUser.Pasture.ID, gr.TargetHouseID);

            return(Json(new
            {
                EarNum = v.EarNum,
                DisplayEarNum = displayEarNum,
                ArrivalTime = v.ArrivalTime.ToString("yyyy-MM-dd"),
                Operator = v.OperatorID,
                OldGroup = oldgroup.Name,
                OldHouse = oldhouse.Name,
                NewGroup = newgroup.Name,
                NewHouse = newhouse.Name
            }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult LoadTask(string taskID)
        {
            TaskBLL   bllTask = new TaskBLL();
            DairyTask task    = bllTask.GetTaskByID(Convert.ToInt32(taskID));

            //获得对应牛群的兽医
            Cow      cow      = bllCow.GetCowInfo(task.EarNum);
            CowGroup cowGroup = bllCowGroup.GetCowGroupInfo(cow.GroupID);
            int      doctorID = cowGroup.DoctorID;
            User     user     = bllUser.GetDefaultDoctor(doctorID);

            var taskData = new
            {
                doctor   = user.Role.Name,
                doctorID = doctorID,
                earNum   = CowBLL.ConvertEarNumToDisplayEarNum(task.EarNum)
            };

            return(Json(taskData, JsonRequestBehavior.AllowGet));
        }