Exemplo n.º 1
0
        private void _view_OnUpdateData(object sender, EventArgs e)
        {
            using (new WaitCursorHandler())
            {
                ListDataGrid listDataGrid = null;

                if (sender is ListDataGrid)
                {
                    listDataGrid = (ListDataGrid)sender;
                }
                else
                {
                    listDataGrid = _view.ListDataGrid;
                }

                if (listDataGrid != null && listDataGrid.SelectedItem != null)
                {
                    var model = _barangServices.GetById(((BarangModel)listDataGrid.SelectedItem).id);

                    if (model != null)
                    {
                        var view = new BarangEntryView(false, model);
                        view.OnSaveData += BarangEntryView_OnSaveData;
                        view.ShowDialog();
                    }
                }
            }
        }
        private void _view_OnCreateData(object sender, EventArgs e)
        {
            var node = _view.TreeViewTipeBarang.SelectedNode;

            if (node != null && node.Parent != null)
            {
                var barangModel = _barangServices.GetById(node.Name);
                var view        = new StokBarangEntryView(barangID: int.Parse(node.Name), barangModel: barangModel);
                view.OnSaveData += StokBarangEntryView_OnSaveData;
                view.ShowDialog();
            }
        }
Exemplo n.º 3
0
        public void ShouldReturnModelMatchingId()
        {
            BarangModel model   = null;
            var         idToGet = 1;

            try
            {
                model = (BarangModel)_services.GetById(idToGet);
            }
            catch (DataAccessException ex)
            {
                _testOutputHelper.WriteLine(ex.DataAccessStatusInfo.GetFormatedValues());
            }

            Assert.True(model != null);
            Assert.True(model.id == idToGet);

            if (model != null)
            {
                TestsHelper.WriteModel(_testOutputHelper, model);
            }
        }