private void CreateBugItems() { try { mListBugItems.Clear(); int count = 0; for (int i = 0; i < mListBugInfos.Count; i++) { var info = mListBugInfos[i]; BugItem item = new BugItem(); item.SerialNo = info.SerialNo; item.Type = info.Type; item.StrType = info.Type == 1 ? "Increase" : info.Type == 2 ? "Improvement" : "Bug"; item.ModuleID = info.ModuleID; item.ModuleName = info.ModuleName; item.UpdateDate = GetUpdateDate(info.OptDate); item.StrUpdateDate = item.UpdateDate.ToString("yyyy-MM-dd"); item.Level = info.Level; item.Content = info.Content; item.ContentLangID = info.LangID; item.ModuleLangID = info.ModuleLangID; item.Info = info; count++; mListBugItems.Add(item); } AppendMessage(string.Format("CreateBugItems end.\t{0}", count)); } catch (Exception ex) { ShowException(ex.Message); } }
public async Task <IActionResult> UpdateAsync(int id, [FromBody] BugItemViewModel viewmodel) { if (ModelState.IsValid) { if (viewmodel == null) { return(BadRequest($"{nameof(viewmodel)} cannot be null")); } BugItem bugItem = await _bugitemService.GetById(id); if (bugItem == null) { return(NotFound(id)); } Mapper.Map(viewmodel, bugItem); AuditEntity(ref bugItem); _bugitemService.Update(bugItem); await _bugitemService.SaveChangesAsync(); return(NoContent()); } return(BadRequest(ModelState)); }
private void AuditEntity(ref BugItem item) { DateTime date = DateTime.Now; if (item.CreatedBy == null) { item.CreatedBy = _userManager.GetUserId(User); item.CreatedDate = date; } item.UpdatedBy = _userManager.GetUserId(User); item.UpdatedDate = date; }
public async Task <IActionResult> Delete(int id) { BugItem bugItem = await _bugitemService.GetById(id); if (bugItem == null) { return(NotFound(id)); } _bugitemService.Remove(bugItem); await _bugitemService.SaveChangesAsync(); return(Ok()); }
void LvBugList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { var item = LvBugList.SelectedItem as BugItem; if (item == null) { return; } mCurrentBugItem = item; ShowBugItemInfo(); } catch (Exception ex) { ShowException(ex.Message); } }
public async Task <IActionResult> CreateAsync([FromBody] BugItemViewModel bugitemVM) { if (ModelState.IsValid) { if (bugitemVM == null) { return(BadRequest($"{nameof(bugitemVM)} cannot be null")); } BugItem bugItem = Mapper.Map <BugItem>(bugitemVM); AuditEntity(ref bugItem); _bugitemService.Add(bugItem); await _bugitemService.SaveChangesAsync(); return(NoContent()); } return(BadRequest(ModelState)); }
public BugInfo(BugItem item, Item observer) : base(item, observer) { }
public BugUnitInterop(BugFaction faction, BugItem item) : base(faction, item) { }
public void Remove(BugItem bugItem) { _context.BugItems.Remove(bugItem); }
public void Update(BugItem bugItem) { _context.BugItems.Update(bugItem); }
public void Add(BugItem bugItem) { _context.BugItems.Add(bugItem); }
/// <summary> /// Default Constructor for the Type Mapper (Faction Bug). /// </summary> /// <param name="item">Related Engine Item</param> public BugState(BugItem item) : base(item) { }