예제 #1
0
 public ActionResult Save(int id)
 {
     try
     {
         ReInspection reInspection = new ReInspection();
         UpdateModel <ReInspection>(reInspection);
         Cow cow = bllCow.GetCowInfo(reInspection.EarNum);
         if (cow.FarmCode == null)
         {
             //弹框提示此牛不存在
             return(RedirectToAction("../Index/List"));
         }
         else
         {
             int inseminationID = bllInsemination.GetLatestInseminationID(reInspection.EarNum);
             reInspection.InseminationID = inseminationID;
             bool IsReInspectionExist = bllReInspection.IsReInspectionExist(reInspection.EarNum, reInspection.InseminationID);
             if (IsReInspectionExist == true)
             {
                 bllReInspection.UpdateReInspection(reInspection);
             }
             else
             {
                 bllReInspection.InsertReInspection(reInspection);
             }
             return(RedirectToAction("../Index/List"));
         }
     }
     catch (Exception e)
     {
         return(View());
     }
 }
 public ActionResult Save(string id)
 {
     try
     {
         InitialInspection initialInspection = new InitialInspection();
         UpdateModel <InitialInspection>(initialInspection);
         Cow cow = bllCow.GetCowInfo(initialInspection.EarNum);
         if (cow.FarmCode == null)
         {
             //弹框提示此牛不存在
             return(RedirectToAction("../Index/List"));
         }
         else
         {
             int inseminationID = bllInsemination.GetLatestInseminationID(initialInspection.EarNum);
             initialInspection.InseminationID = inseminationID;
             bool IsInitialInspectionExist = bllInitialInspection.IsInitialInspectionExist(initialInspection.EarNum, initialInspection.InseminationID);
             if (IsInitialInspectionExist == true)
             {
                 bllInitialInspection.UpdateInitialInspection(initialInspection);
             }
             else
             {
                 bllInitialInspection.InsertInitialInspection(initialInspection);
             }
             return(RedirectToAction("../Index/List"));
         }
     }
     catch (Exception e)
     {
         return(View());
     }
 }