Initial commit
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
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 AggregateStockChPumpForm : Form
|
||||
{
|
||||
public AggregateStockChPumpForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// Ładuje stan pomp
|
||||
private void LoadCurrentPumpStockLists(string pumpName = null)
|
||||
{
|
||||
string query = "";
|
||||
|
||||
dataGridViewPumpLists.Rows.Clear();
|
||||
|
||||
dataGridViewPumpLists.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewPumpLists.ColumnCount = 8;
|
||||
dataGridViewPumpLists.Columns[0].Name = "id";
|
||||
dataGridViewPumpLists.Columns[1].Name = "Typ pompy";
|
||||
dataGridViewPumpLists.Columns[2].Name = "Numer pompy";
|
||||
dataGridViewPumpLists.Columns[3].Name = "Qn [m3/h]";
|
||||
dataGridViewPumpLists.Columns[4].Name = "Hn [m]";
|
||||
dataGridViewPumpLists.Columns[5].Name = "Status";
|
||||
dataGridViewPumpLists.Columns[6].Name = "Producent";
|
||||
dataGridViewPumpLists.Columns[7].Name = "Kontrahent";
|
||||
|
||||
dataGridViewPumpLists.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
|
||||
dataGridViewPumpLists.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewPumpLists.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewPumpLists.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewPumpLists.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewPumpLists.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewPumpLists.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewPumpLists.Columns[7].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
|
||||
if (vGlobal.app_participants_id > 0)
|
||||
query = "select DRS_ID,DRS_SN_NUMBER,PUP_ID,PUP_NAME,PUP_Q_N,PUP_H_P,MCF_NAME,(select DIC_POL_LANG from sys_dictionaries where DIC_ID=DRS_STATUS_DIC_ID) DIC_POL_LANG,(select PRT_DESCRIPTION from sys_participants where PRT_ID=DRS_AUDIT_USR) PRT_DESCRIPTION from seg_dev_resources,seg_pumps left join seg_manufacturers on MCF_ID=PUP_MCF_ID where DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID and DRS_AUDIT_USR=" + vGlobal.app_participants_id.ToString() + " and DRS_ID not in (select distinct APE_PUP_DRS_ID from seg_aggregate_pup_eng where APE_PUP_DRS_ID>0) and (PUP_NAME like '%" + pumpName + "%' or DRS_SN_NUMBER like '%" + pumpName + "%') order by PUP_NAME,PUP_Q_N";
|
||||
else
|
||||
query = "select DRS_ID,DRS_SN_NUMBER,PUP_ID,PUP_NAME,PUP_Q_N,PUP_H_P,MCF_NAME,(select DIC_POL_LANG from sys_dictionaries where DIC_ID=DRS_STATUS_DIC_ID) DIC_POL_LANG,(select PRT_DESCRIPTION from sys_participants where PRT_ID=DRS_AUDIT_USR) PRT_DESCRIPTION from seg_dev_resources,seg_pumps left join seg_manufacturers on MCF_ID=PUP_MCF_ID where DRS_DEV_TYPE=10 and DRS_DEV_ID=PUP_ID and DRS_ID not in (select distinct APE_PUP_DRS_ID from seg_aggregate_pup_eng where APE_PUP_DRS_ID>0) and (PUP_NAME like '%" + pumpName + "%' or DRS_SN_NUMBER like '%" + pumpName + "%') order by PUP_NAME,PUP_Q_N";
|
||||
|
||||
|
||||
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(query, mySqlFunctions.connection);
|
||||
MySql.Data.MySqlClient.MySqlDataReader dataReader = cmd.ExecuteReader();
|
||||
while (dataReader.Read())
|
||||
{
|
||||
dataGridViewPumpLists.Rows.Add(
|
||||
dataReader["DRS_ID"],
|
||||
dataReader["PUP_NAME"],
|
||||
dataReader["DRS_SN_NUMBER"],
|
||||
dataReader["PUP_Q_N"],
|
||||
dataReader["PUP_H_P"],
|
||||
dataReader["DIC_POL_LANG"],
|
||||
dataReader["MCF_NAME"],
|
||||
dataReader["PRT_DESCRIPTION"]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AggregateStockChPumpForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
buttonWybierz.Enabled = false;
|
||||
|
||||
mySqlFunctions.initConnection();
|
||||
if (mySqlFunctions.OpenConnection())
|
||||
{
|
||||
|
||||
LoadCurrentPumpStockLists();
|
||||
mySqlFunctions.CloseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
private void textBoxSearchPump_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
mySqlFunctions.initConnection();
|
||||
if (mySqlFunctions.OpenConnection())
|
||||
{
|
||||
|
||||
LoadCurrentPumpStockLists(textBoxSearchPump.Text);
|
||||
mySqlFunctions.CloseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGridViewPumpLists_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
buttonWybierz.Enabled = true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void buttonWybierz_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
AggregateStockEditForm.newPumpDevID = Convert.ToInt32(this.dataGridViewPumpLists.CurrentRow.Cells[0].Value.ToString().Replace(".", ","));
|
||||
AggregateStockEditForm.newPumpDevName = this.dataGridViewPumpLists.CurrentRow.Cells[1].Value.ToString();
|
||||
AggregateStockEditForm.newPumpDevSN = this.dataGridViewPumpLists.CurrentRow.Cells[2].Value.ToString();
|
||||
AggregateStockEditForm.newPumpDevQn = this.dataGridViewPumpLists.CurrentRow.Cells[3].Value.ToString();
|
||||
AggregateStockEditForm.newPumpDevHn = this.dataGridViewPumpLists.CurrentRow.Cells[4].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