Initial commit
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
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 MotorStockChFromCatalogForm : Form
|
||||
{
|
||||
public MotorStockChFromCatalogForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// Ładuje stan silników
|
||||
private void LoadCurrentMotorLists(string motorName = null)
|
||||
{
|
||||
dataGridViewMotorLists.Rows.Clear();
|
||||
|
||||
dataGridViewMotorLists.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewMotorLists.ColumnCount = 7;
|
||||
dataGridViewMotorLists.Columns[0].Name = "id";
|
||||
dataGridViewMotorLists.Columns[1].Name = "Typ silnika";
|
||||
dataGridViewMotorLists.Columns[2].Name = "Moc [kW]";
|
||||
dataGridViewMotorLists.Columns[3].Name = "Napięcie [V]";
|
||||
dataGridViewMotorLists.Columns[4].Name = "Sprawność";
|
||||
dataGridViewMotorLists.Columns[5].Name = "Obroty";
|
||||
dataGridViewMotorLists.Columns[6].Name = "Producent";
|
||||
|
||||
dataGridViewMotorLists.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
|
||||
dataGridViewMotorLists.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewMotorLists.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewMotorLists.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewMotorLists.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewMotorLists.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewMotorLists.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
|
||||
|
||||
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand("select * from seg_engines left join seg_manufacturers on MCF_ID=ENG_MCF_ID where ENG_NAME like '%"+ motorName + "%' order by ENG_NAME,ENG_POWER", mySqlFunctions.connection);
|
||||
MySql.Data.MySqlClient.MySqlDataReader dataReader = cmd.ExecuteReader();
|
||||
while (dataReader.Read())
|
||||
{
|
||||
dataGridViewMotorLists.Rows.Add(
|
||||
dataReader["ENG_ID"],
|
||||
dataReader["ENG_NAME"],
|
||||
dataReader["ENG_POWER"],
|
||||
dataReader["ENG_VOLTAGE"],
|
||||
dataReader["ENG_ETA"],
|
||||
dataReader["ENG_RPM"],
|
||||
dataReader["MCF_NAME"]
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void MotorStockChFromCatalogForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
buttonWybierz.Enabled = false;
|
||||
|
||||
mySqlFunctions.initConnection();
|
||||
if (mySqlFunctions.OpenConnection())
|
||||
{
|
||||
|
||||
LoadCurrentMotorLists();
|
||||
mySqlFunctions.CloseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
private void textBoxSearchPump_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
mySqlFunctions.initConnection();
|
||||
if (mySqlFunctions.OpenConnection())
|
||||
{
|
||||
|
||||
LoadCurrentMotorLists(textBoxSearchMotor.Text);
|
||||
mySqlFunctions.CloseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridViewMotorLists_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
buttonWybierz.Enabled = true;
|
||||
}
|
||||
catch{ }
|
||||
}
|
||||
|
||||
private void buttonWybierz_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
MotorStockEditForm.newMotorID = Convert.ToInt32(this.dataGridViewMotorLists.CurrentRow.Cells[0].Value.ToString().Replace(".", ","));
|
||||
MotorStockEditForm.newMotorName = this.dataGridViewMotorLists.CurrentRow.Cells[1].Value.ToString();
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user