コード例 #1
0
ファイル: frmVehInOutList.cs プロジェクト: ganeshsoley/VMS
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwVehInOut.SelectedItems != null && lvwVehInOut.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)
                            {
                                VehInOut objVehInOut = new VehInOut();
                                objVehInOut = VehInOutManager.GetItem(Convert.ToInt32(lvwVehInOut.SelectedItems[0].Name));
                                VehInOutManager.Delete(objVehInOut);
                                lvwVehInOut.Items.Remove(lvwVehInOut.SelectedItems[0]);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #2
0
ファイル: frmVehInOutList.cs プロジェクト: ganeshsoley/VMS
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwVehInOut.SelectedItems != null && lvwVehInOut.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        //if (objUIRights.ModifyRight)
                        //{
                        VehInOut        objVehInOut;
                        frmVehInOutProp objFrmProp;

                        objVehInOut                   = VehInOutManager.GetItem(Convert.ToInt32(lvwVehInOut.SelectedItems[0].Name));
                        objFrmProp                    = new frmVehInOutProp(objVehInOut, objCurUser);
                        objFrmProp.MdiParent          = this.MdiParent;
                        objFrmProp.Entry_DataChanged += new frmVehInOutProp.VehInOutUpdateHandler(Entry_DataChanged);
                        objFrmProp.Show();
                        //}
                        //else
                        //{
                        //    throw new Exception("Not Authorised.");
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }