Ejemplo n.º 1
0
 //handle edit operation(categoryId present in Editing mode)
 private void editCategory_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (category.CategoryId != 0)
         {
             //pass select category id for editing in constructor
             ModifyCategory mc = new ModifyCategory(category.CategoryId);
             mc.Show();
             this.Close();
         }
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message, " error");
     }
 }
Ejemplo n.º 2
0
 // add new category to the database
 private void AddNewCategoryButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ModifyCategory mc = new ModifyCategory();
         mc.modifyCategory.Content = "ADD";
         mc.modifyName.Focus();
         mc.LMlabel.Visibility     = Visibility.Hidden;
         mc.LMdateLabel.Visibility = Visibility.Hidden;
         mc.LMtimeLabel.Visibility = Visibility.Hidden;
         mc.LMdate.Visibility      = Visibility.Hidden;
         mc.LMtime.Visibility      = Visibility.Hidden;
         mc.Show();
         refreshCategories();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, " error");
     }
 }
Ejemplo n.º 3
0
 //handle add operation(No CategoryId in Adding mode)
 public void addCategory_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ModifyCategory mc = new ModifyCategory();
         mc.modifyCategory.Content = "ADD";
         mc.modifyName.Focus();
         //Hide Date Labels on Adding Category
         mc.LMlabel.Visibility     = Visibility.Hidden;
         mc.LMdateLabel.Visibility = Visibility.Hidden;
         mc.LMtimeLabel.Visibility = Visibility.Hidden;
         mc.LMdate.Visibility      = Visibility.Hidden;
         mc.LMtime.Visibility      = Visibility.Hidden;
         mc.Show();
         this.Close();
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message, " error");
     }
 }