public FileResult Download() { var timeSheet = GetTimeSheetOrThrowException(576); var timeSheetModel = ModelConstructor.TimeSheetForDepartment(timeSheet, int.MaxValue, 0, 0, int.MaxValue, 0, 0, false); //var r = new TimeSheetToDbf(timeSheetModel); var r = new TimeSheetToDbf(); //var fileBytes = r.GenerateDbf(timeSheetModel); var fileBytes = r.GenerateDbf(timeSheet); const string fileName = "myfile.dbf"; return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); }
public IActionResult OnPost() { var obj = new ModelConstructor(Quiz.Selector); // Insert into UserProgress _unitOfWork.UserProgress.Add(obj.Progress()); // Insert or update activities var PreviousActivity = _unitOfWork.UserActivities.GetAll() .Where(x => x.UserId == Quiz.Selector.userId && x.QuizId == Quiz.Selector.quizId) .FirstOrDefault(); if (PreviousActivity != null) { PreviousActivity.Count = Quiz.Selector.count; _unitOfWork.UserActivities.Update(PreviousActivity); } else { _unitOfWork.UserActivities.Add(obj.Activity()); } _unitOfWork.Save(); if (Quiz.Selector.count.Equals(_max.Value.MaximumNumber)) { // Display Result return(RedirectToPage("Result", new { userId = Quiz.Selector.userId, quizId = Quiz.Selector.quizId })); } Quiz.Selector.count = Quiz.Selector.count + 1; return(RedirectToPage(new { Quiz.Selector.userId, Quiz.Selector.quizId, Quiz.Selector.count })); }
//===================================================================================================== private TimeSheetModel[] TimeSheetModelConstructor(int id, bool isForPrint) { const int firstPaperEmployeeCount = 7; const int lastPaperEmployeeCount = 6; const int paperEmployeeCount = 9; const int firstNightPaperEmployeeCount = 4; const int lastNightPaperEmployeeCount = 3; const int NightpaperEmployeeCount = 7; var timeSheet = GetTimeSheetOrThrowException(id); var timeSheetModel = ModelConstructor.TimeSheetForDepartment( timeSheet , firstPaperEmployeeCount , lastPaperEmployeeCount , paperEmployeeCount , firstNightPaperEmployeeCount , lastNightPaperEmployeeCount , NightpaperEmployeeCount , isForPrint); return(timeSheetModel); }
/// <summary> /// Initializes a new instance of the <see cref="AdaBoost<TModel>"/> class. /// </summary> /// /// <param name="model">The model to be learned.</param> /// <param name="creationFunction">The model fitting function.</param> /// public AdaBoost(Boost <TModel> model, ModelConstructor <TModel> creationFunction) { this.classifier = model; this.Creation = creationFunction; this.convergence = new RelativeConvergence(); }
public override void OnLoad() { if (_renderGameObject != null) { DestroyImmediate(_renderGameObject); } if (_renderAsset != null) { _renderAsset = _renderAsset.Replace("\\\\", "\\").Replace('\\', '/'); var renderAsset = _renderAsset; FileStream stream = null; string directory = null; if (Path.GetExtension(renderAsset) == ".kfm") { foreach (var file in Directory.GetFiles( WorkspaceControl.CurrentWorkspace.WorkingRoot, Path.GetFileNameWithoutExtension(renderAsset) + ".nif*", SearchOption.AllDirectories) ) { renderAsset = file; directory = Path.GetDirectoryName(file); Debug.Log($"Found NIF from KFM: {file}"); stream = File.OpenRead(renderAsset); break; } } else if (Path.GetExtension(renderAsset) == ".nif") { directory = Path.GetDirectoryName(renderAsset.ToLower()); stream = Utilities.OpenAssetStreamRead(renderAsset.ToLower()); } else { Debug.Log($"Unknown render file {renderAsset} format"); return; } if (stream == null) { throw new FileNotFoundException($"{renderAsset}"); } using var reader = new BitReader(stream); var nif = new NiFile(); nif.Deserialize(reader); nif.ReadBlocks(reader); var constructor = new ModelConstructor(); constructor.NifPath = directory; constructor.File = nif; constructor.Name = Path.GetFileNameWithoutExtension(renderAsset); constructor.CreatePrefab = true; constructor.PrefabPath = Path.Combine( WorkspaceControl.CurrentWorkspace.AssetModelsPath, constructor.Name ); var root = constructor.Construct(); root.transform.parent = transform; root.transform.localPosition = Vector3.zero; _renderGameObject = root; stream.Dispose(); } }
public AdaBoost(Boost <TModel> model, ModelConstructor <TModel> creationFunction) { this.Model = model; this.Creation = creationFunction; }