Beispiel #1
0
        private ActionResult Preview()
        {
            string raiserID = Request["raiserID"];
            var    db       = new FarmRepository();
            var    plan     = db.GetEntitie <VaccinePlan>(p => p.raiserID == raiserID);

            if (plan == null)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }

            var vacc = plan.GetVaccinePlan();

            var js = new
            {
                success    = true,
                areaName   = plan.areaName,
                raiserName = plan.raiserName,
                planName   = plan.planName,
                plan       = vacc.Where(p => !p.realyInjectionDate.HasValue),
                planAll    = vacc
            };

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 public ActionResult Settle(int?id, string a)
 {
     if (!id.HasValue)
     {
         if (string.IsNullOrEmpty(a))
         {
             return(PartialView("SettleSearch"));
         }
         else
         {
             return(PartialView("Settle"));
         }
     }
     else
     {
         ViewBag.userName = Farm.Authority.Users.Account.userName;
         FarmRepository rps   = new FarmRepository();
         var            model = rps.GetEntitie <SettledBatch>(p => p.ID == id);
         if (model == null)
         {
             model = new SettledBatch();
         }
         return(View("SettleDetails", model));
     }
 }
Beispiel #3
0
        private ActionResult Statistics()
        {
            FarmRepository rps   = new FarmRepository();
            var            model = base.Entities <GrantFeed, IFarmTable>(rps);

            if (model.Select(p => p.raiserID).Distinct().Count() == 1)
            {
                int pigid = model.OrderByDescending(p => p.referTime).FirstOrDefault().PigID;
                var pig   = rps.GetEntitie <LivePig>(p => p.ID == pigid);
                if (pig != null)
                {
                    ViewBag.total     = model.Where(p => p.PigID == pigid).ToList().Sum(p => p.GetFeedBagNum());
                    ViewBag.extantNum = pig.extantNum;
                    ViewBag.liveRate  = pig.liveRate;
                }
            }

            return(PartialView("Statistics", model));
        }
Beispiel #4
0
        public ActionResult FeedReport(int?id, string raiserID)
        {
            var       db    = new FarmRepository();
            GrantFeed model = null;

            if (id.HasValue)
            {
                model = db.GetEntitie <GrantFeed>(p => p.ID == id.Value);
            }
            else
            {
                model = db.GetEntities <GrantFeed>(p => p.raiserID == raiserID).OrderByDescending(p => p.referTime).FirstOrDefault();
            }

            if (model == null)
            {
                return(HttpNotFound());
            }

            return(View("GrantReport", model));
        }