Beispiel #1
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ctgry_Id) || string.IsNullOrEmpty(ctgry_Txt.Text))
            {
                MessageBox.Show("Oops Category is not selected !! Click on Category");
            }

            else

            {
                DialogResult dialogResult = MessageBox.Show("Are You Sure ", "Deleting Category", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    UpdateCategory updateCategory = new UpdateCategory();
                    if (updateCategory.updateCategory(ctgry_Id, ctgry_Txt.Text))
                    {
                        MessageBox.Show("Category is Updated to Database");
                        cnt = 0;
                        fillData.fillDataGridView(this.dataGridView1);
                        ctgry_Txt.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Error!! Category:" + ctgry_Txt.Text + " is not Updated to Database");
                    }
                }
            }
        }
Beispiel #2
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if ((ctgry_Txt.Text == ctgry_Name) || (ctgry_Txt.Text == " "))
            {
                MessageBox.Show("Please Update With New Value");
            }

            if ((ctgry_Txt.Text != "") && (ctgry_Txt.Text != ctgry_Name))

            {
                UpdateCategory updateCategory = new UpdateCategory();
                if (updateCategory.updateCategory(ctgry_Id, ctgry_Txt.Text))
                {
                    ctgry_Txt.Text = "";
                    MessageBox.Show("Category is Updated to Database");
                    cnt = 0;

                    fillData.fillDataGridView(this.dataGridView1);
                }
                else
                {
                    MessageBox.Show("Error!! Category:" + ctgry_Txt.Text + " is not Updated to Database");
                }
            }
        }