Exemplo n.º 1
0
        private void DeleteAttachment()
        {
            if (!mboDeleteTransactionItemAttachment)
            {
                MessageBox.Show("Sorry you are not allowed to delete posted attachments, please consult your system administrator.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
            }
            else
            {
                if (dgvItems.SelectedRows.Count == 1)
                {
                    if (MessageBox.Show("Are you sure you want to delete the attachment.", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        foreach (DataGridViewRow dr in dgvItems.SelectedRows)
                        {
                            string strOrigFileName = dr.Cells["OrigFileName"].Value.ToString();
                            Int64  iTransactionItemAttachmentsID = Int64.Parse(dr.Cells["TransactionItemAttachmentsID"].Value.ToString());

                            Data.SalesTransactionItemAttachments clsSalesTransactionItemAttachments = new Data.SalesTransactionItemAttachments();
                            clsSalesTransactionItemAttachments.Delete(iTransactionItemAttachmentsID.ToString());
                            clsSalesTransactionItemAttachments.CommitAndDispose();

                            LoadData();

                            MessageBox.Show("The attachment: " + strOrigFileName + " has been deleted.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void DeleteAttachment()
        {
            if (!mboDeleteTransactionItemAttachment)
            {
                MessageBox.Show("Sorry you are not allowed to delete posted attachments, please consult your system administrator.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
            }
            else
            {
                if (dgvItems.SelectedRows.Count == 1)
                {
                    if (MessageBox.Show("Are you sure you want to delete the attachment.", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        foreach (DataGridViewRow dr in dgvItems.SelectedRows)
                        {
                            string strOrigFileName = dr.Cells["OrigFileName"].Value.ToString();
                            Int64 iTransactionItemAttachmentsID = Int64.Parse(dr.Cells["TransactionItemAttachmentsID"].Value.ToString());

                            Data.SalesTransactionItemAttachments clsSalesTransactionItemAttachments = new Data.SalesTransactionItemAttachments();
                            clsSalesTransactionItemAttachments.Delete(iTransactionItemAttachmentsID.ToString());
                            clsSalesTransactionItemAttachments.CommitAndDispose();

                            LoadData();

                            MessageBox.Show("The attachment: " + strOrigFileName +" has been deleted.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }