115 lines
3.6 KiB
C#
115 lines
3.6 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 CompanyLists : Form
|
|
{
|
|
public CompanyLists()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
// Ładuje listę klientów
|
|
private void LoadCurrentCompanyLists(string cpmName = null)
|
|
{
|
|
dataGridViewCompanyLists.Rows.Clear();
|
|
|
|
dataGridViewCompanyLists.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
dataGridViewCompanyLists.ColumnCount = 3;
|
|
dataGridViewCompanyLists.Columns[0].Name = "id";
|
|
dataGridViewCompanyLists.Columns[1].Name = "Nazwa skrócona";
|
|
dataGridViewCompanyLists.Columns[2].Name = "Pełna nazwa";
|
|
|
|
dataGridViewCompanyLists.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
|
|
dataGridViewCompanyLists.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
|
|
dataGridViewCompanyLists.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
|
|
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand("select * from sys_participants where PRT_DESCRIPTION like '%" + cpmName + "%' order by PRT_ID", mySqlFunctions.connection);
|
|
MySql.Data.MySqlClient.MySqlDataReader dataReader = cmd.ExecuteReader();
|
|
while (dataReader.Read())
|
|
{
|
|
dataGridViewCompanyLists.Rows.Add(
|
|
dataReader[0],
|
|
dataReader[1],
|
|
dataReader[2]
|
|
);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void CompanyLists_Load(object sender, EventArgs e)
|
|
{
|
|
mySqlFunctions.initConnection();
|
|
if (mySqlFunctions.OpenConnection())
|
|
{
|
|
|
|
LoadCurrentCompanyLists();
|
|
mySqlFunctions.CloseConnection();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
private void textBoxSearchCompany_TextChanged(object sender, EventArgs e)
|
|
{
|
|
mySqlFunctions.initConnection();
|
|
if (mySqlFunctions.OpenConnection())
|
|
{
|
|
|
|
LoadCurrentCompanyLists(textBoxSearchCompany.Text);
|
|
mySqlFunctions.CloseConnection();
|
|
}
|
|
|
|
//MessageBox.Show(textBoxSearchCompany.Text);
|
|
|
|
}
|
|
|
|
private void dataGridViewCompanyLists_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
int rowIndex = e.RowIndex;
|
|
DataGridViewRow row = dataGridViewCompanyLists.Rows[rowIndex];
|
|
vGlobal.app_participants_id = Convert.ToInt32(row.Cells[0].Value);
|
|
vGlobal.app_participants_name = row.Cells[2].Value.ToString();
|
|
this.Close();
|
|
}
|
|
catch {}
|
|
|
|
|
|
|
|
/*
|
|
pumpCatalogueAdd form = new pumpCatalogueAdd();
|
|
form.pumpID = Convert.ToInt32(pumpID);
|
|
form.textBoxTypPompy.Text = inPumpType.Text;
|
|
form.textBoxQn.Text = inQn.Text;
|
|
form.textBoxHp.Text = inHp.Text;
|
|
form.textBoxETAmax.Text = inETAmax.Text;
|
|
form.textBoxDlugosc.Text = inDlugosc.Text;
|
|
form.textBoxSrednica.Text = inSrednica.Text;
|
|
form.textBoxMasa.Text = inMasa.Text;
|
|
form.comboBoxProd.Text = inManufacturers.Text;
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
private void buttonClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|