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 ViewResult CreateSample(int RollerProjectInfoID) { int TestID = projectrepo.RollerProjectInfos.FirstOrDefault(x => x.RollerProjectInfoID == RollerProjectInfoID).TestID; SettingViewModel settingviewModel = new SettingViewModel(baserepository, wtequipmentrepo, wtsampleinfo); ViewData["Device"] = settingviewModel.GetLISDeviceList(); ViewData["TestTypeList"] = settingviewModel.GetTestTypeList(); ViewData["StationList"] = settingviewModel.GetStationList(); ViewData["SampleIDList"] = settingviewModel.GetSampleIDList(TestID); return(View("EditSample", new RollerSampleInfo() { RollerProjectInfoID = RollerProjectInfoID, State = "准备", TestID = TestID })); }
public ViewResult EditSample(int RollerSampleInfoID, int RollerProjectInfoID) { SettingViewModel settingviewModel = new SettingViewModel(baserepository, wtequipmentrepo, wtsampleinfo); RollerSampleInfo rollersampleinfo = repository.RollerSampleInfos.FirstOrDefault(p => p.RollerSampleInfoID == RollerSampleInfoID); rollersampleinfo.State = "结束"; repository.SaveRollerSampleInfo(rollersampleinfo); int TestID = projectrepo.RollerProjectInfos.FirstOrDefault(x => x.RollerProjectInfoID == RollerProjectInfoID).TestID; ViewData["Device"] = settingviewModel.GetLISDeviceList(); ViewData["StationList"] = settingviewModel.GetStationList(); ViewData["SampleIDList"] = settingviewModel.GetSampleIDList(TestID); ViewData["TestTypeList"] = settingviewModel.GetTestTypeList(); rollertimer.CloseRollerTimeSwitch(rollersampleinfo.RollerBaseStation.TimerCfg.TimerName); rollerforcer.CloseRollerForcerSwitch(rollersampleinfo.RollerBaseStation.ForcerCfg.ForcerName); return(View(rollersampleinfo)); }