Exemple #1
0
        public void AddReturnedGoodItem(long historyId, ReturnedItem item)
        {
            ReturnedHistory parentHistory = _context.ReturnedHistories.FirstOrDefault(h => h.Id == historyId);

            parentHistory.GoodItems.Add(item);
            SaveChanges("AddReturnedItem");
        }
Exemple #2
0
 public ReturnHistoryReporter(ReturnedHistory history,
                              List <ReturnedItem> goodItems, List <ScrapItem> scrapItems)
 {
     _history    = history;
     _goodItems  = goodItems;
     _scrapItems = scrapItems;
 }
Exemple #3
0
        public void AddScrap(long historyId, ScrapItem item)
        {
            ReturnedHistory parentHistory = _context.ReturnedHistories.FirstOrDefault(h => h.Id == historyId);

            parentHistory.ScrapItems.Add(item);
            SaveChanges("AddScrap");
        }
Exemple #4
0
        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");
        }
Exemple #5
0
 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>();
 }
Exemple #6
0
        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;
        }
Exemple #7
0
        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();
        }
Exemple #8
0
 public void Add(ReturnedHistory hToAdd)
 {
     _context.ReturnedHistories.Add(hToAdd);
     SaveChanges("Add");
     _newlyCreatedHistory = hToAdd;
 }
Exemple #9
0
        private bool IsDRHasExistingReturnedHistory()
        {
            ReturnedHistory h = _returnedHistoryService.GetHistoryByDR(_dr.Id);

            return(h != null);
        }