Beispiel #1
0
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            int              ch                  = 0;
            int              CatId               = 0;
            string           CatName             = txtName.Text;
            ClsCategoryLogic objClsCategoryLogic = new ClsCategoryLogic();

            if (CatName.Trim() == "")
            {
                MessageBox.Show("Please Enter Category Name");
            }
            else
            {
                if (varState == 0)
                {
                    CatId = -1;
                }
                else if (varState == 1)
                {
                    CatId    = varID;
                    varState = 0;
                }
                ch = objClsCategoryLogic.UpdateCategory(CatId, CatName);
                if (ch == 0)
                {
                    MessageBox.Show("Duplicate entry is not allowed");
                }
                else
                {
                    MessageBox.Show("Record is saved successfully");
                }
                fncsetGrid();
            }
        }
Beispiel #2
0
        private void ctlGrid_btnDeleteClicked(int rowID)
        {
            varID = Convert.ToInt32(objclsCategory[rowID].CategoryId);
            MessageBoxResult r = System.Windows.MessageBox.Show("Do You Really Want To Delete This Record ?", "->Delete Script", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (r == MessageBoxResult.Yes)
            {
                ClsCategoryLogic objClsCategoryLogic = new ClsCategoryLogic();
                objClsCategoryLogic.DeleteCategory(varID);
                System.Windows.MessageBox.Show("Record Deleted!!", "Delete Category", MessageBoxButton.OK, MessageBoxImage.Error);
                fncsetGrid();
            }
        }