127 lines
6.0 KiB
C#
127 lines
6.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace StacjaProb
|
|
{
|
|
public partial class placeSetUpForm : Form
|
|
{
|
|
public placeSetUpForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void placeSetUpForm_Load(object sender, EventArgs e)
|
|
{
|
|
mySqlFunctions.initConnection();
|
|
if (mySqlFunctions.OpenConnection())
|
|
{
|
|
int index = 1;
|
|
// Ładuje listę pol
|
|
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand("select * from tst_power_path order by TPP_NAME", mySqlFunctions.connection);
|
|
MySql.Data.MySqlClient.MySqlDataReader dataReader = cmd.ExecuteReader();
|
|
while (dataReader.Read())
|
|
{
|
|
//dataReader["TPP_NAME"]
|
|
if (index==1)
|
|
{
|
|
textBoxZS1.Text = dataReader["TPP_ADDRESS"].ToString();
|
|
textBoxMbQuestion01.Text = dataReader["TPP_MbQuestion"].ToString();
|
|
textBoxMbRqs01.Text = dataReader["TPP_MbRqs"].ToString();
|
|
textBoxMbReset01.Text = dataReader["TPP_MbReset"].ToString();
|
|
textBoxMbOnHigh01.Text = dataReader["TPP_MbOnHigh"].ToString();
|
|
textBoxMbOnLow01.Text = dataReader["TPP_MbOnLow"].ToString();
|
|
textBoxMbOffHigh01.Text = dataReader["TPP_MbOffHigh"].ToString();
|
|
textBoxMbOffLow01.Text = dataReader["TPP_MbOffLow"].ToString();
|
|
}
|
|
else if (index == 2)
|
|
{
|
|
textBoxZS2.Text = dataReader["TPP_ADDRESS"].ToString();
|
|
textBoxMbQuestion02.Text = dataReader["TPP_MbQuestion"].ToString();
|
|
textBoxMbRqs02.Text = dataReader["TPP_MbRqs"].ToString();
|
|
textBoxMbReset02.Text = dataReader["TPP_MbReset"].ToString();
|
|
textBoxMbOnHigh02.Text = dataReader["TPP_MbOnHigh"].ToString();
|
|
textBoxMbOnLow02.Text = dataReader["TPP_MbOnLow"].ToString();
|
|
textBoxMbOffHigh02.Text = dataReader["TPP_MbOffHigh"].ToString();
|
|
textBoxMbOffLow02.Text = dataReader["TPP_MbOffLow"].ToString();
|
|
}
|
|
else if (index == 3)
|
|
{
|
|
textBoxZS3.Text = dataReader["TPP_ADDRESS"].ToString();
|
|
textBoxMbQuestion03.Text = dataReader["TPP_MbQuestion"].ToString();
|
|
textBoxMbRqs03.Text = dataReader["TPP_MbRqs"].ToString();
|
|
textBoxMbReset03.Text = dataReader["TPP_MbReset"].ToString();
|
|
textBoxMbOnHigh03.Text = dataReader["TPP_MbOnHigh"].ToString();
|
|
textBoxMbOnLow03.Text = dataReader["TPP_MbOnLow"].ToString();
|
|
textBoxMbOffHigh03.Text = dataReader["TPP_MbOffHigh"].ToString();
|
|
textBoxMbOffLow03.Text = dataReader["TPP_MbOffLow"].ToString();
|
|
}
|
|
else if (index == 4)
|
|
{
|
|
textBoxZS4.Text = dataReader["TPP_ADDRESS"].ToString();
|
|
textBoxMbQuestion04.Text = dataReader["TPP_MbQuestion"].ToString();
|
|
textBoxMbRqs04.Text = dataReader["TPP_MbRqs"].ToString();
|
|
textBoxMbReset04.Text = dataReader["TPP_MbReset"].ToString();
|
|
textBoxMbOnHigh04.Text = dataReader["TPP_MbOnHigh"].ToString();
|
|
textBoxMbOnLow04.Text = dataReader["TPP_MbOnLow"].ToString();
|
|
textBoxMbOffHigh04.Text = dataReader["TPP_MbOffHigh"].ToString();
|
|
textBoxMbOffLow04.Text = dataReader["TPP_MbOffLow"].ToString();
|
|
}
|
|
|
|
index++;
|
|
}
|
|
mySqlFunctions.CloseConnection();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void buttonSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
/*
|
|
mySqlFunctions.initConnection();
|
|
if (mySqlFunctions.OpenConnection())
|
|
{
|
|
string query_insert_01 = "truncate table tst_power_path";
|
|
MySql.Data.MySqlClient.MySqlCommand cmd_01 = new MySql.Data.MySqlClient.MySqlCommand(query_insert_01, mySqlFunctions.connection);
|
|
cmd_01.ExecuteNonQuery();
|
|
|
|
string query_insert_02 = "INSERT INTO tst_power_path SET TPP_NAME='" + nameTV1.Text + "',TPP_ADDRESS='" + textBoxZS1.Text + "'";
|
|
MySql.Data.MySqlClient.MySqlCommand cmd_02 = new MySql.Data.MySqlClient.MySqlCommand(query_insert_02, mySqlFunctions.connection);
|
|
cmd_02.ExecuteNonQuery();
|
|
|
|
string query_insert_03 = "INSERT INTO tst_power_path SET TPP_NAME='" + nameTV2.Text + "',TPP_ADDRESS='" + textBoxZS2.Text + "'";
|
|
MySql.Data.MySqlClient.MySqlCommand cmd_03 = new MySql.Data.MySqlClient.MySqlCommand(query_insert_03, mySqlFunctions.connection);
|
|
cmd_03.ExecuteNonQuery();
|
|
|
|
string query_insert_04 = "INSERT INTO tst_power_path SET TPP_NAME='" + nameTV3.Text + "',TPP_ADDRESS='" + textBoxZS2.Text + "'";
|
|
MySql.Data.MySqlClient.MySqlCommand cmd_04 = new MySql.Data.MySqlClient.MySqlCommand(query_insert_04, mySqlFunctions.connection);
|
|
cmd_03.ExecuteNonQuery();
|
|
|
|
mySqlFunctions.CloseConnection();
|
|
}
|
|
*/
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
this.Close();
|
|
}
|
|
|
|
private void buttonClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|