/// <summary> /// Populates a LogDetailViewModel by mapping the related objects to it. /// </summary> /// <param name="vm">View model to be mapped.</param> /// <param name="fileContentByLine">Array of file contents (line by line) that will be mapped.</param> public static void MapToViewModel(this LogDetailViewModel vm, string[] fileContentByLine) { foreach (string line in fileContentByLine) { string localLine = line; // Handle escaped pipe characters if (localLine.IndexOf(@"\|") > 0) { localLine = localLine.Replace(@"\|", "##PIPE##"); } string[] data = localLine.Split('|'); vm.Rows.Add(new LogRowViewModel() { ItemID = SanitizeForModel(data[0]), Mode = SanitizeForModel(data[1]), Result = SanitizeForModel(data[2]), UserName = SanitizeForModel(data[3]), SourceDB = SanitizeForModel(data[4]), TargetDB = SanitizeForModel(data[5]), DateTime = SanitizeForModel(data[6]) }); } }
public LogDetailPage() { InitializeComponent(); var item = new FoodPerDay { MealType = (int)MealType.BreakFast }; viewModel = new LogDetailViewModel(item); BindingContext = viewModel; }
public ActionResult ViewLog(string log, bool modified = false) { LogDetailViewModel viewModel = new LogDetailViewModel(); string[] contents = _logManager.GetLogContents(log, modified); viewModel.Title = log; viewModel.FileName = log; viewModel.ModifiedOnly = modified; viewModel.MapToViewModel(contents); return(View("~/Views/SPRK/Report/ViewLog.cshtml", viewModel)); }
public void ConstructorMustConstruct() { var f = new FoodPerDay(); f.Food = new Food(); f.Food.Name = "Name"; var r = new LogDetailViewModel(f); Assert.IsNotNull(r); Assert.AreEqual("Name", r.Title); Assert.IsNull(r.FoodRepository); Assert.IsNull(r.RecipeRepository); }
public ActionResult LogDetail(int RollCallID, DateTime Date) { AttendanceBusiness AttenBO = new AttendanceBusiness(); //1 ngay, 1 roll call co the co 2 loai log, log manual va auto, do do phai lay ca 2 AttendanceLog AutoLog = AttenBO.GetAttendanceLogAtDate(RollCallID, Date, 1); AttendanceLog ManualLog = AttenBO.GetAttendanceLogAtDate(RollCallID, Date, 2); RollCall RollCall = RollBO.GetRollCallByID(RollCallID); LogDetailViewModel Model = new LogDetailViewModel(); Model.RollCall = RollCall; Model.AutoLog = AutoLog; Model.ManualLog = ManualLog; return(PartialView("_LogDetail", Model)); }
public LogDetailView(string logPath) { InitializeComponent(); ViewModel = new LogDetailViewModel(logPath); ViewModel.OnRequestClose += (s, e) => Close(); DataContext = ViewModel; ScoreItems.Columns[1].Visibility = System.Windows.Visibility.Collapsed; if (ViewModel.MemberModuleActive && ViewModel.ScoreItems != null && ViewModel.ScoreItems.FindAll(w => !string.IsNullOrEmpty(w.Lid)).Count > 0) { ScoreItems.Columns[1].Visibility = System.Windows.Visibility.Visible; } ScoreItems.Columns[8].Visibility = System.Windows.Visibility.Collapsed; if (ViewModel.ScoreItems != null && ViewModel.ScoreItems.FindAll(w => !string.IsNullOrEmpty(w.Afwijking)).Count > 0) { ScoreItems.Columns[8].Visibility = System.Windows.Visibility.Visible; } ScoreItems.Columns[10].Visibility = System.Windows.Visibility.Collapsed; if (ViewModel.ScoreItems != null && ViewModel.ScoreItems.FindAll(w => !string.IsNullOrEmpty(w.GelijkeScores)).Count > 0) { ScoreItems.Columns[10].Visibility = System.Windows.Visibility.Visible; } }
public IViewComponentResult Invoke(LogDetailViewModel tracker) { return(View(tracker ?? new LogDetailViewModel())); }
public LogDetailPage(LogDetailViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; }
public async Task InsertDetail(LogDetailViewModel logDetailViewModel) { var logDetail = new LogDetail(logDetailViewModel.LogId, logDetailViewModel.RepositoryName, logDetailViewModel.Commits); await _logRepository.InsertDetail(logDetail); }