示例#1
0
        public MainForm(Login lgnForm, bool admin)
        {
            InitializeComponent();
            objects = new ObjectHolder();
            initializeLookupTab();   
         
            if (admin)
            {
                lblAdmin.Text = "Hello, Administrator";
                isAdmin = true;
                initializeKeyTab();
                initializeKeySetTab();
                initializeDoorGroupTab();
                initializePersonnelTab();
            }  

            else
            {
                lblAdmin.Text = "Hello User";
                tabControl.TabPages.Remove(tabPageKeysets);
                tabControl.TabPages.Remove(tabPageKeys);
                tabControl.TabPages.Remove(tabPageDoorgroups);
                tabControl.TabPages.Remove(tabPagePersonnel);
            }

            this.loginForm = lgnForm;
            initializeCheckoutTab();//Depends on admin value. Must be placed after it's determined. 
        }
 public NewPersonnelForm(ObjectHolder objects)
 {
     InitializeComponent();
     this.objects = objects;
     SetupResultsView();
     PopulateResults("");
 }
        public LookupForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;

            initializeLookupTab();
        }
        public NewKeysForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;

            listBoxKeys.BackColor = evenLighterBlue;
            PopulateTypes();
        }
        public NewKeyringForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;

            PopulateKeyRings();
            PopulateKeys();
        }
示例#6
0
 public DoorsForm(ObjectHolder objects)
 {
     InitializeComponent();
     this.objects = objects;
     this.Doors = new BindingList<Door>(this.objects.doors);
     this.UnassignedKeyTypes = new BindingList<KeyType>();
     this.DoorGroups = new BindingList<Location>();
 }
        public NewLookupForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;

            SetupList();
            PopulateListKeys("");                        
        }
        public CheckoutForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;

            PopulatePeople();
            PopulateRings();
            PopulateKeys();
        }
        public NewDoorGroupForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;

            PopulateGroupTree();
            PopulateDoorTree();
            buttonRename.Enabled = false;
            buttonDelete.Enabled = false;
            buttonMap.Enabled = false;
        }
示例#10
0
        // Constructor to setup for a new door.
        public DoorDialog(ObjectHolder objects, MDI_ParentForm parent)
        {
            InitializeComponent();
            this.objects = objects;
            this.parent = parent;

            this.door = new Door();

            buttonDelete.Visible = false;
            buttonMap.Visible = false;
            PopulateKeyTree();
            PopulateComboBox();
        }
        public FloorPlanForm(ObjectHolder objects)
        {
            InitializeComponent();
            this.objects = objects;
            SetupListofFloors();
            SetupListofDoors();
            RefreshDoorLst();
            SetupListofDoorGroups();

            foreach (Door door in objects.doors)
            {
                cbDoors.Items.Add(door.RoomNumber);
            }
        }
示例#12
0
        // Constructor to edit an existing door
        public DoorDialog(ObjectHolder objects, MDI_ParentForm parent, Door door)
        {
            InitializeComponent();
            this.objects = objects;
            this.parent = parent;

            this.door = door;
            textBoxRoom.Text = door.RoomNumber;
            labelTitle.Text = "Edit Door";
            this.Text = "Edit Door";
            buttonCreate.Text = "Update";

            PopulateKeyTree();
            PopulateUnlockingTree();
            PopulateComboBox();
        }
        //private HelpForm helpForm;

        public MDI_ParentForm(Login lgnForm, int loginId)
        {
            InitializeComponent();
            objects = new ObjectHolder();
            currentUser = objects.GetPersonnelById(loginId);
                      
            if (currentUser.IsAdmin)
            {
                isAdmin = true;
                lblUserName.Text = currentUser.FirstName + " " + currentUser.LastName + "  \n(Administrator)";
            }  
            else
            {
                lblUserName.Text = currentUser.FirstName + " " + currentUser.LastName + "  \n(User)";
            }
            this.loginForm = lgnForm;

            
            SetupTreeView();
        }
示例#14
0
 public KeyDialog(ObjectHolder objects, Key ky = null)
 {
     InitializeComponent();
     this.objects = objects;
     this.key = ky;
     foreach (KeyType type in objects.keytypes)
     {
         comboBoxType.Items.Add(type.Name);
     }
     if (key == null)
     {
         key = new Key(-1, "", false, false);
         this.Text = "New Key Copy";
     }
     else
     {
         textBoxSerial.Text = key.Serial;
         checkBoxBroken.Checked = key.Broken;
         checkBoxMissing.Checked = key.Missing;
         comboBoxType.SelectedItem = key.KeyType.Name;
     }
     buttonSave.Enabled = false;
 }
 public AddMapPointDialog(ObjectHolder objects)
 {
     InitializeComponent();
     this.objects = objects;
 }
 public DoorGroupForm(ObjectHolder objects)
 {
     InitializeComponent();
     this.objects = objects;
     initializeDoorGroupTab();
 }
示例#17
0
 public KeyRingForm(ObjectHolder objects)
 {
     InitializeComponent();
     this.objects = objects;
     initializeKeySetTab();
 }
        private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.Reset();
            openFileDialog.AddExtension = true;
            openFileDialog.DefaultExt = ".sqlite";
            openFileDialog.Filter = "SQLite files (*.sqlite) | *.sqlite";
            openFileDialog.Title = "Select backup";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                string path = openFileDialog.FileName;
                if (!DbSetupManager.EvaluateExternalDB(path))
                {
                    // problem with selected database
                    MessageBox.Show(
                        "Cannot restore from the file you selected.\n" +
                        "Only restore from backups created by KeyManager\n" +
                        "usually name 'KEYMANAGER_BACKUP_###.sqlite'\n" +
                        "with some number in place of the '###'.",
                        "Restore Cancelled"
                    );
                }
                else
                {
                    // looks good
                    result = MessageBox.Show(
                        "Are you sure you want to restore from backup?\n" +
                        "All current data will be overwritten.",
                        "Confirm Restore from Backup",
                        MessageBoxButtons.OKCancel
                    );
                    if (result == DialogResult.OK)
                    {
                        string dbpath = DbSetupManager.GetDBPath();
                        File.Delete(dbpath);
                        File.Copy(path, dbpath);

                        // reset it all!
                        objects = new ObjectHolder();
                        currentUser = objects.GetPersonnelById(1);
                        isAdmin = true;
                        SetupTreeView();

                        MessageBox.Show("Restore complete.");
                    }
                }
            }
        }
        private void importFromCSVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.Reset();
            openFileDialog.AddExtension = true;
            openFileDialog.DefaultExt = "csv";
            openFileDialog.Filter = "CSV | *.csv";
            openFileDialog.Title = "Import from CSV";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                result = MessageBox.Show("Are you sure you wish to import? All current data will be overwritten", "Confirm Import", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    string status = (new CSV()).InsertCSV(openFileDialog.FileName);
                    if (status == "refuse")
                    {
                        MessageBox.Show("Import Cancelled. Can only import from a CSV created using KeyManager.", "Import Cancelled");
                    }
                    else if (status == "error")
                    {
                        MessageBox.Show("Encountered an Error while importing");
                    }
                    else
                    {
                        MessageBox.Show("Import Complete");

                        // reset it all!
                        objects = new ObjectHolder();
                        currentUser = objects.GetPersonnelById(1);
                        isAdmin = true;
                        SetupTreeView();
                    }
                }
            }
            
        }
 public PersonnelForm(ObjectHolder objects)
 {
     InitializeComponent();
     this.objects = objects;
     initializePersonnelTab();
 }