예제 #1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwDCList.SelectedItems != null && lvwDCList.SelectedItems.Count != 0)
                {
                    if (!IsList)
                    {
                        if (objUIRights.DeleteRight)
                        {
                            DialogResult dr = new DialogResult();
                            dr = MessageBox.Show("Do You Really Want to Delete Record ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                            if (dr == DialogResult.Yes)
                            {
                                ReturnableDC objDC = new ReturnableDC();
                                objDC = ReturnableDCManager.GetItem(Convert.ToInt32(lvwDCList.SelectedItems[0].Name));
                                ReturnableDCManager.Delete(objDC);
                                lvwDCList.Items.Remove(lvwDCList.SelectedItems[0]);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #2
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwDCList.SelectedItems != null && lvwDCList.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            ReturnableDC        objDC;
                            frmReturnableDCProp objFrmProp;

                            objDC                         = ReturnableDCManager.GetItem(Convert.ToInt32(lvwDCList.SelectedItems[0].Name), true);
                            objFrmProp                    = new frmReturnableDCProp(objDC, currentUser);
                            objFrmProp.MdiParent          = this.MdiParent;
                            objFrmProp.Entry_DataChanged += new frmReturnableDCProp.DCUpdateHandler(Entry_DataChanged);
                            objFrmProp.Show();
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }