public static FileStatus FromModel(FileStatusModel model) { return(new FileStatus { Id = model.Id, Caption = model.Caption }); }
public ActionResult Edit(FileStatusModel model) { if (ModelState.IsValid) { bool has_error = false; var srv = CompositionRoot.Resolve <IFileStatusService>(); if (!has_error) { try { var type = FileStatusModelConverter.FromModel(model); srv.Update(type); } catch (DomainException e) { ModelState.AddModelError("", e); has_error = true; } } if (!has_error) { return(RedirectToAction("List")); } } return(View()); }
public StatusResponse GetRepoStatus(string workDir) { string dataOutput = this.RunUtilCommand(workDir, "repostatus"); if (null == dataOutput) { return(null); } List <string> cmdData = dataOutput.DataToList(); if (null == cmdData || 0 == cmdData.Count) { return(null); } // ## master...origin/master [ahead 1] // M README.md // R src/MrrGitAutomerge.Core/Helpers/ProcessExtensions.cs -> src/MrrGitAutomerge.Core/Helpers/HelpfulExtensions.cs // D src/MrrGitAutomerge.Core/Helpers/ProcessExtensions.cs // M src/MrrGitAutomerge.Core/MrrGitAutomerge.Core.csproj // M src/MrrGitAutomerge.Runner/Program.cs // ?? src/MrrGitAutomerge.Core/Resources/deleteme.txt var mtc = BranchRegex.Match(cmdData.FirstOrDefault()); if (!mtc.Success) { return(null); } StatusResponse response = new StatusResponse { Branch = mtc.Groups[1].Value }; foreach (string item in cmdData.Skip(1)) { if (string.IsNullOrEmpty(item) || 4 > item.Length) { continue; } string fileRelPath = item.Substring(3); int arrowPos = fileRelPath.IndexOf(" ->"); if (0 < arrowPos) { fileRelPath = fileRelPath.Substring(0, arrowPos); } FileStatusModel fileModel = new FileStatusModel { Status = item.Substring(0, 2), RepositoryRootRelativePath = fileRelPath }; response.UncommitedFiles.Add(fileModel); } return(response); }
static public FileStatusModel CreateModel(string directoryPath, ICollection <INode> files) { var model = new FileStatusModel { Directory = FileSystemPath.GetFullPath(directoryPath), Files = new List <FileStatus>() }; foreach (var file in files) { model.Files.Add(new FileStatus() { Name = file.Name, IsFile = file is IFile, FullPath = file.FullPath }); } return(model); }
public static FileStatusModel GetFileStatus(int fileStatusID) { ACTION = "GetFileStatus(fileStatusID)"; try { using (UTMMABCDBEntities context = new UTMMABCDBEntities()) { USR_TMMA_FILE_STATUS obj = context.USR_TMMA_FILE_STATUS.Where(o => o.FileStatusID == fileStatusID).FirstOrDefault(); FileStatusModel m = Mapping(obj); return(m); } } catch (Exception ex) { throw ex; } }
public IActionResult Index(FileStatusModel fileStatusModel) { // Find What values were provided from UI and map the updates to the static variable and write in Memory Mapped File as well var properties = fileStatusModel.GetType().GetProperties(); foreach (var property in properties) { if (property.GetValue(fileStatusModel) != null) { var value = int.Parse((property.GetValue(fileStatusModel).ToString())); _fileStatus.GetType().GetProperty(property.Name).SetValue(_fileStatus, value); } } _memoryMap.WriteData(_fileStatus); return(RedirectToAction("Index")); }
public static FileStatusModel GetFileStatusModel(ManagedFile file, ApplicationDbContext db) { var model = new FileStatusModel(); model.File = file; model.FileName = file.Name; var tasks = db.TaskStatuses .Where(x => x.File.Id == file.Id) .Include(x => x.CompletedBy) .OrderBy(x => x.Weight); foreach (var task in tasks) { var taskModel = new FileTaskModel() { TaskType = task.Name, CompletedDate = task.CompletedDate.HasValue ? task.CompletedDate.Value.ToShortDateString() : string.Empty, IsComplete = task.IsComplete }; var taskDefinition = MefConfig.AddinManager.AllTasks.Where(x => x.Id == task.TaskId).FirstOrDefault(); if (taskDefinition != null) { taskModel.Controller = taskDefinition.Controller; } if (task.CompletedBy != null) { taskModel.CuratorName = task.CompletedBy.UserName; taskModel.CuratorId = task.CompletedBy.Id; } model.Tasks.Add(taskModel); } return(model); }
public ActionResult Create(FileStatusModel model) { bool has_error = false; if (ModelState.IsValid) { var srv = CompositionRoot.Resolve <IFileStatusService>(); try { srv.Create(model.Caption); } catch (DomainException e) { ModelState.AddModelError("", e); has_error = true; } } if (!has_error) { return(RedirectToAction("List")); } return(View("Edit")); }