Exemple #1
0
        public ActionResult EditSample(RollerSampleInfo rollersampleinfo)
        {
            if (ModelState.IsValid)
            {
                rollersampleinfo.State = "准备";
                TestSampleInfo.GetInstance().AddTestSample(rollersampleinfo);
                repository.SaveRollerSampleInfo(rollersampleinfo);
                //同步中间数据库
                Entities context = new Entities();
                context.PROCEDURE_ROLLERSAMPLEINFO(0);
                context.SaveChanges();

                RollerSampleInfo rsi = repository.RollerSampleInfos.Include(x => x.RollerBaseStation).Include(x => x.RollerBaseStation.TimerCfg).Include(x => x.RollerBaseStation.ForcerCfg).FirstOrDefault(x => x.RollerSampleInfoID == rollersampleinfo.RollerSampleInfoID);
                TestSampleInfo.GetInstance().EditSampleList(rsi);
                return(RedirectToAction("ViewInfo", new { RollerProjectInfoID = rollersampleinfo.RollerProjectInfoID }));
            }
            else
            {
                SettingViewModel settingviewModel = new SettingViewModel(baserepository, wtequipmentrepo, wtsampleinfo);
                int TestID = projectrepo.RollerProjectInfos.FirstOrDefault(x => x.RollerProjectInfoID == rollersampleinfo.RollerProjectInfoID).TestID;
                ViewData["Device"]       = settingviewModel.GetLISDeviceList();
                ViewData["StationList"]  = settingviewModel.GetStationList();
                ViewData["SampleIDList"] = settingviewModel.GetSampleIDList(TestID);
                ViewData["TestTypeList"] = settingviewModel.GetTestTypeList();
                return(View(rollersampleinfo));
            }
        }
 public ActionResult EditSample(RollerSampleInfo rollersampleinfo)
 {
     if (ModelState.IsValid)
     {
         repository.SaveRollerSampleInfo(rollersampleinfo);
         return(RedirectToAction("ViewInfo", new { RollerProjectInfoID = rollersampleinfo.RollerProjectInfoID }));
     }
     else
     {
         SettingViewModel settingviewModel = new SettingViewModel(baserepository);
         ViewData["StationList"] = settingviewModel.GetStationList(projectrepo.RollerProjectInfos.FirstOrDefault(a => a.RollerProjectInfoID == rollersampleinfo.RollerProjectInfoID).TestDevice);
         return(View(rollersampleinfo));
     }
 }