コード例 #1
0
ファイル: Main.cs プロジェクト: birmar2/NOC
        private void listToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            panel1.Controls.Clear();
            ServerList myForm = new ServerList();

            myForm.TopLevel   = false;
            myForm.AutoScroll = true;
            panel1.Controls.Add(myForm);
            myForm.Show();
        }
コード例 #2
0
ファイル: UpdateServer.cs プロジェクト: birmar2/NOC
        private void button1_Click(object sender, EventArgs e)
        {
            string     serverName     = textBox1.Text;
            Servertype selectedType   = (Servertype)comboBox1.SelectedItem;
            string     servertype_id  = selectedType.Value;
            int        serverActive   = checkBox1.Checked ? 1 : 0;
            string     serverMemory   = textBox2.Text;
            string     serverDisk     = textBox3.Text;
            string     serverCpu      = textBox4.Text;
            string     serverOpsystem = textBox5.Text;

            bool   requiredError = false;
            string err           = "";

            if (serverName == "" || serverMemory == "" || serverDisk == "" || serverCpu == "" || serverOpsystem == "")
            {
                err           = "Minden mező kitöltése kötelező";
                requiredError = true;
            }

            if (requiredError == false)
            {
                string updateQuery = "UPDATE `servers` " +
                                     "SET " +
                                     "`servername` = '" + serverName + "', " +
                                     "`servertype_id` = '" + servertype_id + "', " +
                                     "`serveractive` = '" + serverActive + "', " +
                                     "`servermemory` = '" + serverMemory + "', " +
                                     "`serverdisk` = '" + serverDisk + "', " +
                                     "`servercpu` = '" + serverCpu + "', " +
                                     "`serveropsystem` = '" + serverOpsystem + "' " +
                                     "WHERE `serverid` =" + serverid;
                Framework.db.RunQuery(updateQuery);
                MessageBox.Show("Azonosítási szerver frissítve!");

                Framework.insertLog(Framework.MyUserId, Framework.Operation("Sikeres szerver frissítés"), Convert.ToInt32(serverid));

                Framework.mainForm.panel1.Controls.Clear();
                ServerList listForm = new ServerList();
                listForm.TopLevel   = false;
                listForm.AutoScroll = true;
                Framework.mainForm.panel1.Controls.Add(listForm);
                listForm.Show();
            }
            else
            {
                Framework.insertLog(Framework.MyUserId, Framework.Operation("Sikertelen szerver frissítés"), Convert.ToInt32(serverid));
                MessageBox.Show(err);
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string     serverName     = textBox1.Text;
            Servertype selectedType   = (Servertype)comboBox1.SelectedItem;
            string     servertype_id  = selectedType.Value;
            int        serverActive   = checkBox1.Checked ? 1 : 0;
            string     serverMemory   = textBox2.Text;
            string     serverDisk     = textBox3.Text;
            string     serverCpu      = textBox4.Text;
            string     serverOpsystem = textBox5.Text;

            bool   requiredError = false;
            string err           = "";

            if (serverName == "" || serverMemory == "" || serverDisk == "" || serverCpu == "" || serverOpsystem == "")
            {
                err           = "Minden mező kitöltése kötelező";
                requiredError = true;
            }

            if (requiredError == false)
            {
                string insertQuery = "INSERT INTO " +
                                     "servers " +
                                     "(`servername`,`servertype_id`,`serveractive`,`servermemory`,`serverdisk`,`servercpu`,`serveropsystem`) " +
                                     "VALUES " +
                                     "('" + serverName + "','" + servertype_id + "','" + serverActive + "','" + serverMemory + "','" + serverDisk + "','" + serverCpu + "','" + serverOpsystem + "') ";
                Framework.db.RunQuery(insertQuery);
                MessageBox.Show("Azonosítási szerver feltöltve!");

                int lastId = Framework.LastInsertId();
                Framework.insertLog(Framework.MyUserId, Framework.Operation("Sikeres szerver feltöltés"), lastId);

                Framework.mainForm.panel1.Controls.Clear();
                ServerList listForm = new ServerList();
                listForm.TopLevel   = false;
                listForm.AutoScroll = true;
                Framework.mainForm.panel1.Controls.Add(listForm);
                listForm.Show();
            }
            else
            {
                Framework.insertLog(Framework.MyUserId, Framework.Operation("Sikertelen szerver feltöltés"), 0);
                MessageBox.Show(err);
            }
        }