Beispiel #1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsList)
                {
                    if (objUIRights.AddRight)
                    {
                        Vehicle        objVehicle;
                        frmVehicleProp objFrmProp;

                        objVehicle                    = new Vehicle();
                        objFrmProp                    = new frmVehicleProp(objVehicle, currentUser);
                        objFrmProp.IsNew              = true;
                        objFrmProp.MdiParent          = this.MdiParent;
                        objFrmProp.Entry_DataChanged += new frmVehicleProp.VehicleUpdateHandler(Entry_DataChanged);
                        objFrmProp.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 (lvwVehicles.SelectedItems != null && lvwVehicles.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            Vehicle        objVehicle;
                            frmVehicleProp objFrmProp;

                            objVehicle                    = VehicleManager.GetItem(Convert.ToInt32(lvwVehicles.SelectedItems[0].Name));
                            objFrmProp                    = new frmVehicleProp(objVehicle, currentUser);
                            objFrmProp.MdiParent          = this.MdiParent;
                            objFrmProp.Entry_DataChanged += new frmVehicleProp.VehicleUpdateHandler(Entry_DataChanged);
                            objFrmProp.Show();
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }