public void DeleteUsedGood(UsedGoodViewModel usedGood)
        {
            UsedGood selectedUsedGood = _usedGoodRepository.GetById <int>(usedGood.Id);

            _usedGoodRepository.Delete(selectedUsedGood);
            _unitOfWork.SaveChanges();
        }
        public void UpdateUsedGood(UsedGoodViewModel usedGood)
        {
            UsedGood entity = _usedGoodRepository.GetById <int>(usedGood.Id);

            Map(usedGood, entity);
            _usedGoodRepository.Update(entity);
            _unitOfWork.SaveChanges();
        }
        public void InsertUsedGood(UsedGoodViewModel usedGood)
        {
            usedGood.Status = (int)DbConstant.DefaultDataStatus.Active;
            UsedGood entity = new UsedGood();

            Map(usedGood, entity);
            _usedGoodRepository.Add(entity);
            _unitOfWork.SaveChanges();
        }
 public override void RefreshDataView()
 {
     if (!bgwMain.IsBusy)
     {
         MethodBase.GetCurrentMethod().Info("Fecthing UsedGood data...");
         _selectedUsedGood = null;
         FormHelpers.CurrentMainForm.UpdateStatusInformation("Memuat data barang bekas...", false);
         bgwMain.RunWorkerAsync();
     }
 }
        private void bgwMain_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result is Exception)
            {
                this.ShowError("Proses memuat data gagal!");
            }

            if (gvUsedGood.RowCount > 0)
            {
                SelectedUsedGood = gvUsedGood.GetRow(0) as UsedGoodViewModel;
            }

            FormHelpers.CurrentMainForm.UpdateStatusInformation("Memuat data barang bekas selesai", true);
        }
        private void cbUsedGood_EditValueChanged(object sender, EventArgs e)
        {
            UsedGoodViewModel model = cbUsedGood.GetSelectedDataRow() as UsedGoodViewModel;;

            this.Stock = model.Stock;
        }