コード例 #1
0
 public ActionResult Edit(string id)
 {
     if (id == null)
     {
         //ViewBag.Insemination = Utility.JsonSerialize(insem);
         ViewBag.EarNum           = "0";
         ViewBag.ParityNum        = 0;
         ViewBag.InseminationNum  = 0;
         ViewBag.SemenNum         = "";
         ViewBag.SemenType        = 0;
         ViewBag.EstrusFindType   = 0;
         ViewBag.OperateDate      = DateTime.Today.ToShortDateString().ToString();
         ViewBag.Operator         = "";
         ViewBag.Description      = "";
         ViewBag.EstrusDate       = DateTime.Today.ToShortDateString().ToString();
         ViewBag.EstrusType       = 0;
         ViewBag.EstrusFindPerson = "";
         return(View("~/Views/Breed/Insemination/Edit.cshtml"));
     }
     else
     {
         Insemination insemination = bllInsemination.GetInseminationInfo(Convert.ToInt32(id));
         if (insemination == null)
         {
             ViewBag.EarNum           = "0";
             ViewBag.InseminationNum  = 0;
             ViewBag.SemenNum         = "";
             ViewBag.SemenType        = 0;
             ViewBag.EstrusFindType   = 0;
             ViewBag.OperateDate      = DateTime.Today.ToShortDateString().ToString();
             ViewBag.Operator         = "";
             ViewBag.Description      = "";
             ViewBag.EstrusDate       = DateTime.Today.ToShortDateString().ToString();
             ViewBag.EstrusType       = 0;
             ViewBag.EstrusFindPerson = "";
         }
         else
         {
             ViewBag.EarNum           = id;
             ViewBag.InseminationNum  = insemination.InseminationNum;
             ViewBag.SemenNum         = insemination.SemenNum;
             ViewBag.SemenType        = insemination.SemenType;
             ViewBag.EstrusFindType   = insemination.EstrusFindType;
             ViewBag.OperateDate      = insemination.OperateDate;
             ViewBag.Operator         = UserBLL.Instance.CurrentUser.Name; // insemination.OperatorID;
             ViewBag.Description      = insemination.Description;
             ViewBag.EstrusDate       = insemination.EstrusDate;
             ViewBag.EstrusType       = insemination.EstrusType;
             ViewBag.EstrusFindPerson = insemination.EstrusFindPerson;
         }
         return(View("~/Views/Breed/Insemination/Edit.cshtml"));
     }
 }