public ActionResult MedicineTake(MedicineTakeModel model)
 {
     var listService = new ListService();
     ViewData["CureTaskEmployee"] = listService.GetCureTaskEmployee();
     ViewData["CureType"] = listService.GetCureTypeList();
     ViewData["Medicine"] = listService.GetMedicineList();
     ViewData["Unit"] = listService.GetUnitList();
     var medicineTakeModel = new MedicineTakeModel();
     medicineTakeModel = medicineTakeModel.GetCureTaskByEmployeeId(model.EmployeeId);
     model.TaskNumber = medicineTakeModel.TaskNumber;
     model.EmloyeeName = medicineTakeModel.EmloyeeName;
     model.TaskCourseId = medicineTakeModel.TaskCourseId;
     model.CureTaskType = medicineTakeModel.CureTaskType;
     return View(model);
 }
        public ActionResult Submit(MedicineTakeModel model)
        {
            if (Session["CheckFeed"] == null || !(bool) Session["AddMedicineTake"] ||
                !(bool) Session["CheckMedicineTake"])
            {
                Response.Write("<script>history.go(0);</script>");
                return View("Error");
            }

            var medicineTakeModel = new MedicineTakeModel();
            var cureMethodService = new CureMethodService();
            var cureMedicineService = new CureMedicineService();
            medicineTakeModel = medicineTakeModel.GetCureTaskByEmployeeId(model.EmployeeId);
            foreach (CureTypeModel curetype in model.CureType)
            {
                var cureMethod = new cure_method
                                     {
                                         CureTaskCourseId = medicineTakeModel.TaskCourseId,
                                         CureTypeId = Convert.ToInt64(curetype.CureType)
                                     };
                cureMethodService.Insert(cureMethod);
                foreach (MedicineTakeDetail medicineTakeDetail in curetype.MedicineTakeDetails)
                {
                    long cureMethodId = cureMethodService.FindByCureTypeId(cureMethod.CureTypeId)[0].Id;
                    var cureMedicine = new cure_medicine
                                           {
                                               CureMethodId = cureMethodId,
                                               MedicineId = medicineTakeDetail.MedicineId,
                                               Quality = medicineTakeDetail.Quality,
                                               UnitId = medicineTakeDetail.UnitId
                                           };
                    cureMedicineService.Insert(cureMedicine);
                }
            }
            ViewBag.Title = "添加成功";
            return View("Message");
        }