public List<DeveloperModel> GetDevelopersFromExcel(IFormFile file) { ExcelUpload<DeveloperModel> excel = new ExcelUpload<DeveloperModel>(); string folderName = "Upload"; string webRootPath = environment.WebRootPath; string newPath = Path.Combine(webRootPath, folderName); string[] allowedColumns = { "name", "skills", "keywords", "previousworks", "profilelink", "previouswork", "product", "component", "hardware" }; return excel.ImportFromExcel(file, newPath, allowedColumns, (string colName, string colValue, DeveloperModel developer) => { if (colName == "name") { developer.DeveloperName = colValue; } if (colName == "product") { developer.ProductName = colValue; } if (colName == "component") { developer.ComponentName = colValue; } if (colName == "hardware") { developer.HardwareName = colValue; } if (colName == "previousworks" || colName == "previouswork" || colName == "profilelink") { developer.PreviousWorks = colValue; } if (colName == "keywords" || colName == "skills") { string[] skills = colValue.Split(','); string processedSkill = ""; foreach (var skill in skills) { var keyword = TextFormaterTool.DataPreprocess(skill); if (keyword == null || keyword == "") continue; processedSkill += keyword + ","; } developer.Skills = processedSkill.TrimEnd(','); } }); }
public IActionResult Create(DeveloperViewModel developer) { string skillset = ""; List<JsonValue> skills = JsonConvert.DeserializeObject<List<JsonValue>>(developer.Skills); foreach (JsonValue skill in skills) { string processedSkill = TextFormaterTool.DataPreprocess(skill.value); if (processedSkill == "" || processedSkill == null) continue; skillset += (processedSkill + ","); } DeveloperModel dev = new DeveloperModel { DeveloperName = developer.DeveloperName.Trim(), DeveloperTypeId = developer.DeveloperType, Skills= skillset, ProductName=developer.Products, ComponentName=developer.Components, HardwareName=developer.Platforms, PreviousWorks = developer.PreviousWorks, //current_workload=0 }; int developers = (int)developerRepository.AddDeveloper(dev); if (developer.DeveloperType==1) { return RedirectToAction("SiniorExperiencedDevelopers"); } else if (developer.DeveloperType == 2) { return RedirectToAction("NewExperiencedDevelopers"); } else { return RedirectToAction("FreshDevelopers"); } }
public IActionResult Create(BugViewModel bug) { if (ModelState.IsValid) { string summaryAndDesc = bug.Summery + " " + bug.Description; string colValue = summaryAndDesc.Replace("\'", String.Empty).Replace("{", string.Empty).Replace("}", string.Empty).Replace("\"", String.Empty); var keywords = TextFormaterTool.DataPreprocess(colValue); BugModel bugprofile = new BugModel { id = bug.Id, AssigneeName = bug.Assignee, ProductName = bug.Products, ComponentName = bug.Component, HardwareName = bug.Hardware, Severity = bug.Saverity, Priority = bug.Priority, Summary = bug.Summery, KeyWords = keywords, Status = "New", Description = bug.Description, Changed = "", Source = "Bug Triage" }; bool returnVal = (bool)bugRepository.SaveBugProfile(bugprofile); if (returnVal) { return(RedirectToAction("ResolvedBugs")); } else { ModelState.AddModelError("db", "Cannot be saved"); } } return(View(bug)); }
public List<BugModel> GetBugsFromExcel(IFormFile file) { ExcelUpload<BugModel> excel = new ExcelUpload<BugModel>(); string folderName = "Upload"; string webRootPath = environment.WebRootPath; string newPath = Path.Combine(webRootPath, folderName); string[] allowedColumns = { "product", "component", "severity", "priority", "summary", "description", "hardware", "assignee", "status", "resolution", "id", "changed" }; return excel.ImportFromExcel(file, newPath ,allowedColumns,(string coulumnName, string columnValue,BugModel bug) => { if (coulumnName == "assignee") { bug.AssigneeName = columnValue; } if ( coulumnName == "product") { bug.ProductName = columnValue; } if ( coulumnName == "component") { bug.ComponentName = columnValue; } if (coulumnName == "hardware") { bug.HardwareName = columnValue; } if (coulumnName == "severity") { string severityFromExcel = columnValue.Trim().ToLower(); bug.SeverityTitle = severityFromExcel; } if (coulumnName == "priority") { string priorityFromExcel =columnValue.Trim().ToLower(); bug.PriorityTitle = priorityFromExcel; } if (coulumnName == "summary" ||coulumnName == "description") { string colValue = columnValue.Replace("\'", String.Empty) .Replace("{", string.Empty) .Replace("}", string.Empty) .Replace("\"", String.Empty); var keyword = TextFormaterTool.DataPreprocess(colValue); bug.KeyWords = bug.KeyWords + keyword; } }); }