Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (textGroupName.Text != "")
            {
                if (textDescription.Text != "")
                {
                    GroupBLL = GroupDAL.checkGroupAvailableOrNot(textGroupName.Text);

                    if (textGroupName.Text != GroupBLL.Group_Name)
                    {
                        GroupBLL.Group_Name  = textGroupName.Text;
                        GroupBLL.Description = textDescription.Text;

                        bool success = GroupDAL.Insert(GroupBLL);
                        if (success == true)
                        {
                            MessageBox.Show("Categoriy Inserted Succesfully .!!");
                            clear();
                            DataTable dt = GroupDAL.Select();
                            dgvGroup.DataSource = dt;
                        }
                        else
                        {
                            MessageBox.Show("Failed to insert category :/ ");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Group is Already Added in Database Please choose another Group");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter Description");
                }
            }
            else
            {
                MessageBox.Show("Please enter Group Name");
            }
        }