Exemple #1
0
        /// <summary>
        /// Making new Workstations document if not exists
        /// </summary>
        /// <param name="workstationName">Name of workstation.</param>
        /// <param name="studentFirstAndLastName">Student first and last name.</param>
        /// <param name="hostName">Host name.</param>
        /// <param name="ipAdress">Local IP address.</param>
        /// <param name="userName">Logged user name.</param>
        /// <param name="alertsList">List of alerts.</param>
        /// <param name="appList">List of processes.</param>
        public void WorkstaionsMakeNew(
            string workstationName,
            string studentFirstAndLastName,
            string hostName,
            string ipAdress,
            string userName,
            List <Alerts> alertsList,
            List <string> appList)
        {
            Workstations newDocument = new Workstations
            {
                WorkstationName         = workstationName,
                StudentFirstAndLastName = studentFirstAndLastName,
                HostName = hostName,
                IPAdress = ipAdress,
                UserName = userName,
                Alerts   = alertsList,
                Apps     = appList
            };

            try
            {
                RefreshWorkstations();
                workstationsCollection.InsertOne(newDocument);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Wystąpił błąd podczas dodawania dokumentu do bazy danych. Treść błędu: /n /n" + ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Making new Workstations document if not exists. AlertList and AppList empty.
        /// </summary>
        public void WorkstationsMakeNew()
        {
            Workstations newDocument = new Workstations
            {
                WorkstationName         = StationInformation.WorkstationName,
                StudentFirstAndLastName = StationInformation.StudentFirstAndLastName,
                HostName = StationInformation.HostName,
                IPAdress = StationInformation.IpAdress,
                UserName = StationInformation.Username,
                Alerts   = new List <Alerts>(),
                Apps     = new List <string>()
            };

            try
            {
                RefreshWorkstations();
                workstationsCollection.InsertOne(newDocument);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Wystąpił błąd podczas dodawania dokumentu do bazy danych. Treść błędu: /n /n" + ex);
            }
        }