Beispiel #1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsList)
                {
                    if (objUIRights.AddRight)
                    {
                        User        objUser    = new User();
                        frmUserProp objFrmUser = new frmUserProp(objUser, currentUser);

                        objFrmUser.IsNew              = true;
                        objFrmUser.MdiParent          = this.MdiParent;
                        objFrmUser.Entry_DataChanged += new frmUserProp.UserUpdateHandler(Entry_DataChanged);
                        objFrmUser.Show();
                    }
                    else
                    {
                        throw new Exception("Not Authorised.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #2
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwUsers.SelectedItems != null && lvwUsers.SelectedItems.Count == 1)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            User        objUser;
                            frmUserProp objFrmUser;

                            objUser = UserManager.GetItem(Convert.ToInt32(lvwUsers.SelectedItems[0].Name));
                            if (objUser != null)
                            {
                                objFrmUser                    = new frmUserProp(objUser, currentUser);
                                objFrmUser.IsNew              = false;
                                objFrmUser.MdiParent          = this.MdiParent;
                                objFrmUser.Entry_DataChanged += new frmUserProp.UserUpdateHandler(Entry_DataChanged);
                                objFrmUser.Show();
                            }
                            else
                            {
                                MessageBox.Show(this, "Record Can't be Displayed due to Null Object.", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }