public ActionResult CreateType(string testType, string jsFile, string cssFile, string dllFile, string resolveType) { var tempPath = Server.MapPath("~/Temp/"); var path = Server.MapPath("~/Scripts/TestsFolder/"); DirectoryInfo di = new DirectoryInfo(path); di = di.CreateSubdirectory(testType); FileInfo jsfi = new FileInfo(tempPath + jsFile); jsfi.CopyTo(di.FullName + "\\" + jsFile, true); FileInfo cssfi = new FileInfo(tempPath + cssFile); cssfi.CopyTo(di.FullName + "\\" + cssFile, true); FileInfo dllfi = new FileInfo(tempPath + dllFile); dllfi.CopyTo(di.FullName + "\\" + dllFile, true); di.CreateSubdirectory("Input"); TestTypeEntity test = new TestTypeEntity() { ModuleName = testType, CssFileName = cssFile, JsFileName = jsFile, DllFileName = dllFile, ResolveDllType = resolveType }; testService.CreateTestType(test); return(Json(new { message = "Тип теста добавлен" })); }
private FileInfo[] GetTestFiles(int testId) { TestEntity test = testService.GetTestById(testId); TestTypeEntity testType = testService.GetTypeById(test.TestTypeId); DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/Scripts/TestsFolder/" + testType.ModuleName + "/Input/")); return(di.GetFiles()); }
public static DalTestType ToDalTestType(this TestTypeEntity testType) { if (testType != null) { return(new DalTestType() { Id = testType.Id, ModuleName = testType.ModuleName, CssFileName = testType.CssFileName, JsFileName = testType.JsFileName, DllFileName = testType.DllFileName, ResolveDllType = testType.ResolveDllType }); } return(null); }
public ActionResult StartTest(TestModel model) { TestEntity test = testService.GetTestById(model.TestId); TestTypeEntity testType = testService.GetTypeById(test.TestTypeId); return(View(new StartTestModel() { TestId = test.Id, TypeName = testType.ModuleName, JsFileName = testType.JsFileName, CssFileName = testType.CssFileName, TestName = test.Name, DllFilePath = testType.ModuleName + '/' + testType.DllFileName, ResolveDllType = testType.ResolveDllType, TestFileNumber = this.GetRandomFileNumber(test.Id) })); }
public void CreateTestType(TestTypeEntity testType) { testTypeRepository.Create(testType.ToDalTestType()); uow.Commit(); }
public JsonResult GetType(int id) { TestTypeEntity test = testService.GetTypeById(id); return(Json(new { testType = test }, JsonRequestBehavior.AllowGet)); }