public void AddReturnedGoodItem(long historyId, ReturnedItem item) { ReturnedHistory parentHistory = _context.ReturnedHistories.FirstOrDefault(h => h.Id == historyId); parentHistory.GoodItems.Add(item); SaveChanges("AddReturnedItem"); }
public ReturnHistoryReporter(ReturnedHistory history, List <ReturnedItem> goodItems, List <ScrapItem> scrapItems) { _history = history; _goodItems = goodItems; _scrapItems = scrapItems; }
public void AddScrap(long historyId, ScrapItem item) { ReturnedHistory parentHistory = _context.ReturnedHistories.FirstOrDefault(h => h.Id == historyId); parentHistory.ScrapItems.Add(item); SaveChanges("AddScrap"); }
public void Edit(ReturnedHistory hToEdit) { ReturnedHistory oldHistory = _context.ReturnedHistories.FirstOrDefault(h => h.Id == hToEdit.Id); oldHistory.ProjectEngineer = hToEdit.ProjectEngineer; oldHistory.Date = hToEdit.Date; oldHistory.Note = hToEdit.Note; SaveChanges("Edit"); }
public ReturnedItemForm(ReturnedHistory history, ReturnedHistoryService returnedHistoryService, InOutService inOutService, DRService drService, string name) { _history = history; _returnedHistoryService = returnedHistoryService; _inOutService = inOutService; _drService = drService; _name = name; InitializeComponent(); _goodItems = new List <ReturnedItem>(); _scrapItems = new List <ScrapItem>(); }
private void CreateReturnHistory() { if (_dr == null) { MessageBox.Show("Please provide DR", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (string.IsNullOrWhiteSpace(txtProjectEngineer.Text)) { MessageBox.Show("Please provide Project Engr.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } ReturnedHistory h = new ReturnedHistory(); h.DR = _dr; h.DRNumber = _dr.DRNumber; h.ProjectEngineer = txtProjectEngineer.Text; h.Date = dateTimePicker1.Value; h.Note = txtNote.Text; h.CreatedBy = _name; _returnedHistoryService.Add(h); _history = _returnedHistoryService.NewlyCreatedHistory; LoadGoodAndScrapItemsToListView(); EnableDisableDrControls(false); cmdCreate.Enabled = false; EnableDisableItemControls(true); MessageBox.Show("Record Created!"); _dr = _history.DR; GetItemsWithinDr(); lblCreatedBy.Text = _history.CreatedBy; cmdPrint.Enabled = true; }
private void cmdEditReturn_Click(object sender, EventArgs e) { if (listViewReturn.SelectedItems.Count == 0) { MessageBox.Show("Please select History from the list", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } long returnId = Convert.ToInt64(listViewReturn.SelectedItems[0].SubItems[0].Text); ItemService itemService = new ItemService(_context); HistoryService historyService = new HistoryService(_context); ReturnedHistoryService returnedHistoryService = new ReturnedHistoryService(_context); DRService drService = new DRService(_context); InOutService inOutService = new InOutService(itemService, historyService, drService, returnedHistoryService); ReturnedHistory h = returnedHistoryService.GetHistory(returnId); ReturnedItemForm f = new ReturnedItemForm(h, returnedHistoryService, inOutService, drService, _name); f.ShowDialog(); }
public void Add(ReturnedHistory hToAdd) { _context.ReturnedHistories.Add(hToAdd); SaveChanges("Add"); _newlyCreatedHistory = hToAdd; }
private bool IsDRHasExistingReturnedHistory() { ReturnedHistory h = _returnedHistoryService.GetHistoryByDR(_dr.Id); return(h != null); }