Exemplo n.º 1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsList)
                {
                    if (objUIRights.AddRight)
                    {
                        VisitorGatePass  objVisitorGP;
                        frmVisitorGPProp objFrmProp;

                        objVisitorGP                  = new VisitorGatePass();
                        objFrmProp                    = new frmVisitorGPProp(objVisitorGP, currentUser);
                        objFrmProp.IsNew              = true;
                        objFrmProp.MdiParent          = this.MdiParent;
                        objFrmProp.Entry_DataChanged += new frmVisitorGPProp.VisitorGPUpdateHandler(Entry_DataChanged);
                        objFrmProp.Show();
                    }
                    else
                    {
                        throw new Exception("Not Authorised.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 2
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwGPs.SelectedItems != null && lvwGPs.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            VisitorGatePass  objVisitorGP;
                            frmVisitorGPProp objFrmProp;

                            objVisitorGP                  = VisitorGatePassManager.GetItem(Convert.ToInt32(lvwGPs.SelectedItems[0].Name));
                            objFrmProp                    = new frmVisitorGPProp(objVisitorGP, currentUser);
                            objFrmProp.MdiParent          = this.MdiParent;
                            objFrmProp.Entry_DataChanged += new frmVisitorGPProp.VisitorGPUpdateHandler(Entry_DataChanged);
                            objFrmProp.Show();
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                AppLogger.Error(ex.Message.ToString());
                AppLogger.Error(ex.StackTrace.ToString());
            }
        }