Exemple #1
0
 private void lnkAddcategory_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     Items.Add_Category go = new Items.Add_Category();
     go.MdiParent = this.ParentForm;
     go.Show();
 }
Exemple #2
0
        private void datagridcategories_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // Delete category
                if (e.ColumnIndex == datagridcategories.Columns["del"].Index && e.RowIndex >= 0)
                {
                    foreach (DataGridViewRow rowdel in datagridcategories.SelectedRows)
                    {
                        DialogResult result = MessageBox.Show("Do you want to Delete?", "Yes or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                        if (result == DialogResult.Yes)
                        {
                            string sqldel = " delete from tbl_category     where ID = '" + rowdel.Cells[2].Value.ToString() + "'";
                            DataAccess.ExecuteSQL(sqldel);
                            MessageBox.Show("Deleted");
                            categorybind();
                        }
                    }
                }

                // Delete items From Gridview
                if (e.ColumnIndex == datagridcategories.Columns["Edit"].Index && e.RowIndex >= 0)
                {
                    foreach (DataGridViewRow row in datagridcategories.SelectedRows)
                    {
                        this.Hide();
                        Items.Add_Category mkc = new Items.Add_Category();
                        mkc.categoryID   = row.Cells[2].Value.ToString();
                        mkc.categoryName = row.Cells[3].Value.ToString();
                        mkc.MdiParent    = this.ParentForm;
                        mkc.Show();
                    }
                }
            }
            catch
            {
            }
        }