Пример #1
0
        /// <summary>
        /// Handles the Click event of the mnuItemDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// Created by SMK 
        private void mnuItemDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn chắc muốn xoá ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                return;

            if (gvEstimation.Row >= 0)
            {
                var guid = (Guid)gvEstimation.Rows[gvEstimation.Row]["Id"];

                // Delete chil first
                var dataItem = new EstimationItem(Config.ConnectionString);
                dataItem.Delete(guid);
                // Delete parent later
                var data = new Estimation(Config.ConnectionString);
                data.Delete(guid);
                gvEstimation.Rows.Remove(gvEstimation.Row);
            }
        }