Beispiel #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignment_TFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
            HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys    LadeAssignmentKey       = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
            try
            {
                if (LadeAssignmentGridView.SelectedRows.Count > 0)
                {
                    if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                    {
                        return;
                    }


                    LadeAssignmentKey.LadeAssignmentID_bint = (Int64?)LadeAssignmentGridView.CurrentRow.Cells["colLadeAssignmentID_bint"].Value;
                    LadeAssignment_TFactory.Delete(LadeAssignmentKey);

                    DataRow[] dr = ((DataTable)this.LadeAssignmentGridView.DataSource).Select(HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T.LadeAssignment_TField.LadeAssignmentID_bint.ToString() + "='" + LadeAssignmentKey.LadeAssignmentID_bint.ToString() + "'");
                    if (dr.Length > 0)
                    {
                        dr[0].Delete();
                    }
                    ((DataTable)this.LadeAssignmentGridView.DataSource).AcceptChanges();
                }
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }