private void GridSubCategory_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
        {
            bool ok = false;

            //var _emp = e.Row.Item as Employee;
            SubCategoryVO cat = e.Row.DataContext as SubCategoryVO;

            _cvm             = (SubCategoryViewModel)ViewModel;
            cat.ModifiedDate = DateTime.Now;

            ok = _cvm.ManageSave(cat);

            //if (ok)
            //{
            //    MessageBox.Show(SubCategoryModule.Properties.Resources.SaveSuccess,
            //        SubCategoryModule.Properties.Resources.SaveSubCategoryResult,
            //        MessageBoxButton.OK,
            //        MessageBoxImage.Information);
            //}
            //else
            //{
            //    MessageBox.Show(SubCategoryModule.Properties.Resources.SaveSuccess,
            //        SubCategoryModule.Properties.Resources.SaveSubCategoryResult,
            //        MessageBoxButton.OK,
            //        MessageBoxImage.Exclamation);
            //}
        }
        private void GridSubCategory_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            bool     ok = false;
            DataGrid dg = sender as DataGrid;

            if (dg != null)
            {
                DataGridRow dgr = (DataGridRow)(dg.ItemContainerGenerator.ContainerFromIndex(dg.SelectedIndex));
                if (e.Key == Key.Delete && !dgr.IsEditing)
                {
                    // User is attempting to delete the row
                    var result = MessageBox.Show(
                        "About to delete the current row.\n\nProceed?",
                        "Delete",
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Question,
                        MessageBoxResult.No);

                    if (result == MessageBoxResult.Yes)
                    {
                        foreach (var row in dg.SelectedItems)
                        {
                            SubCategoryVO subCat = row as SubCategoryVO;
                            _cvm = (SubCategoryViewModel)ViewModel;

                            ok = _cvm.ManageDelete(subCat);
                        }
                    }
                    e.Handled = (result == MessageBoxResult.No);
                }
            }
        }
        public Boolean ManageDelete(SubCategoryVO subCategory)
        {
            bool ok = false;

            ok = _subCategoryBl.Remove(subCategory.SubCategoryID);

            return(ok);
        }
        public Boolean ManageSave(SubCategoryVO subCategory)
        {
            bool ok = false;

            ok = _subCategoryBl.Save(subCategory);

            return(ok);
        }
 public void InsertOrUpdate(SubCategoryVO category)
 {
     if (category.SubCategoryID == default(int))
     {
         _context.SetAdd(category);
     }
     else
     {
         _context.SetModified(category);
     }
 }
        private void GridSubCategory_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
        {
            bool ok = false;

            SubCategoryVO cat = e.Row.DataContext as SubCategoryVO;

            _cvm             = (SubCategoryViewModel)ViewModel;
            cat.ModifiedDate = DateTime.Now;

            ok = _cvm.ManageSave(cat);
        }
 public void InsertOrUpdateGraph(SubCategoryVO customerGraph)
 {
     if (customerGraph.State == State.Added)
     {
         _context.SubCategories.Add(customerGraph);
     }
     else
     {
         _context.SubCategories.Add(customerGraph);
         _context.ApplyStateChanges();
     }
 }
Exemple #8
0
        private void CategoryInfo(SubCategoryVO subcategory)
        {
            if (subcategory != null && subcategory.CategoryID > 0)
            {
                CategoryVO category   = _categoryBl.GetAll().FirstOrDefault(x => x.CategoryID == subcategory.CategoryID);
                var        parameters = new NavigationParameters();
                parameters.Add("To", category);
                _regionManager.RequestNavigate("ContentRegion", new Uri("CategoryInfoView", UriKind.Relative),
                                               NavigationCompleted, parameters);

                //IRegion region = ...
                //region.RequestNavigate(newUri("MyView", UriKind.Relative));
            }
        }
 public bool Save(SubCategoryVO vo)
 {
     _subCategoryAccessor.Repo.InsertOrUpdate(vo);
     return(_subCategoryAccessor.Save());
 }