ziadanky - multifilter cast 2
This commit is contained in:
Binary file not shown.
@@ -508,7 +508,7 @@ namespace Mip
|
|||||||
{
|
{
|
||||||
|
|
||||||
//IPaddress = "127.0.0.1";
|
//IPaddress = "127.0.0.1";
|
||||||
IPaddress = "192.168.1.11";
|
IPaddress = "192.168.1.18";
|
||||||
pingReply = pingIP.Send(IPaddress);
|
pingReply = pingIP.Send(IPaddress);
|
||||||
if (pingReply.Status.ToString() == "Success")
|
if (pingReply.Status.ToString() == "Success")
|
||||||
{
|
{
|
||||||
|
|||||||
490
Mip/frmMain.Designer.cs
generated
490
Mip/frmMain.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
127
Mip/frmMain.cs
127
Mip/frmMain.cs
@@ -28,6 +28,8 @@ namespace Mip
|
|||||||
public string SelectedZiadankaGridIds { get; private set; }
|
public string SelectedZiadankaGridIds { get; private set; }
|
||||||
public bool ReloadSelected { get; private set; } = true;
|
public bool ReloadSelected { get; private set; } = true;
|
||||||
|
|
||||||
|
public Queue<string> FilterQueue { get; private set; } = new Queue<string>(2);
|
||||||
|
|
||||||
public frmMain()
|
public frmMain()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -7073,8 +7075,8 @@ namespace Mip
|
|||||||
if (dataGridView16.SelectedRows.Count > 0) selectedIndex = Convert.ToInt32(dataGridView16.SelectedRows[0].Index);
|
if (dataGridView16.SelectedRows.Count > 0) selectedIndex = Convert.ToInt32(dataGridView16.SelectedRows[0].Index);
|
||||||
|
|
||||||
|
|
||||||
string strTextBoxCondition = "";
|
string strTextBoxCondition = $"{textBox52.Tag} {textBox38.Tag}";
|
||||||
if (ZiadankyColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dataGridView16.Columns[ZiadankyColorIndex].Name + "`, '" + textBox38.Text + "')>0 ";
|
//if (ZiadankyColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dataGridView16.Columns[ZiadankyColorIndex].Name + "`, '" + textBox38.Text + "')>0 ";
|
||||||
|
|
||||||
string sqlCommandZiadanky;
|
string sqlCommandZiadanky;
|
||||||
string strCommandZiadankyWhere = "WHERE (`IDUser` = " + classUser.ID.ToString() + ")";
|
string strCommandZiadankyWhere = "WHERE (`IDUser` = " + classUser.ID.ToString() + ")";
|
||||||
@@ -9254,25 +9256,26 @@ namespace Mip
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
int ZiadankyColorIndex = -1;
|
|
||||||
private void dataGridView16_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
private void dataGridView16_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
{
|
{
|
||||||
|
var pocet = FilterQueue?.Count();
|
||||||
|
var nazovStlpca = dataGridView16.Columns[e.ColumnIndex].Name.ToString();
|
||||||
|
|
||||||
if (ZiadankyColorIndex != -1)
|
if (!FilterQueue.Contains(nazovStlpca))
|
||||||
{
|
{
|
||||||
ZiadankyColorIndex = -1;
|
if (pocet < 2)
|
||||||
textBox38.Text = "";
|
{
|
||||||
label174.Text = "Stĺpec nevybraný";
|
FilterQueue.Enqueue(nazovStlpca);
|
||||||
textBox38.Enabled = false;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FilterQueue.Dequeue();
|
||||||
|
FilterQueue.Enqueue(nazovStlpca);
|
||||||
|
}
|
||||||
|
ConfigureFilters(pocet.Value);
|
||||||
|
refreshZiadanky();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ZiadankyColorIndex = e.ColumnIndex;
|
|
||||||
textBox38.Text = "";
|
|
||||||
label174.Text = dataGridView16.Columns[e.ColumnIndex].Name.ToString();
|
|
||||||
textBox38.Enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(NacenovanieColorIndex != e.ColumnIndex && NacenovanieColorIndex != -1) dataGridView7.Columns[NacenovanieColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
if(NacenovanieColorIndex != e.ColumnIndex && NacenovanieColorIndex != -1) dataGridView7.Columns[NacenovanieColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
||||||
|
|
||||||
@@ -9293,15 +9296,74 @@ namespace Mip
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ConfigureFilters(int pocet)
|
||||||
|
{
|
||||||
|
var queueList = FilterQueue.ToArray();
|
||||||
|
var first = string.Empty;
|
||||||
|
var second = string.Empty;
|
||||||
|
|
||||||
|
switch (queueList.Length)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
first = queueList[0] == string.Empty ? string.Empty : queueList[0].ToString();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
first = queueList[0] == string.Empty ? string.Empty : queueList[0].ToString();
|
||||||
|
second = queueList[1] == string.Empty ? string.Empty : queueList[1].ToString();
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (first == string.Empty)
|
||||||
|
{
|
||||||
|
label174.Text = "Stĺpec 1 nevybraný";
|
||||||
|
textBox38.Text = "";
|
||||||
|
textBox38.Enabled = false;
|
||||||
|
//textBox38.Tag = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label174.Text = first;
|
||||||
|
if (pocet > 1) textBox38.Text = textBox52.Text;
|
||||||
|
textBox38.Enabled = true;
|
||||||
|
//textBox38.Tag = $" AND INSTR(`{first}`, '{textBox38.Text}')>0 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (second == string.Empty)
|
||||||
|
{
|
||||||
|
label227.Text = "Stĺpec 2 nevybraný";
|
||||||
|
textBox52.Text = "";
|
||||||
|
textBox52.Enabled = false;
|
||||||
|
//textBox52.Tag = $" AND INSTR(`{second}`, '{textBox52.Text}')>0 ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label227.Text = second;
|
||||||
|
textBox52.Text = "";
|
||||||
|
textBox52.Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void textBox38_TextChanged(object sender, EventArgs e)
|
private void textBox38_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (textBox38.Text == string.Empty)
|
||||||
|
{
|
||||||
|
textBox38.Tag = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBox38.Tag = $" AND INSTR(`{label174.Text}`, '{textBox38.Text}')>0 ";
|
||||||
|
}
|
||||||
|
|
||||||
refreshZiadanky();
|
refreshZiadanky();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void label174_TextChanged(object sender, EventArgs e)
|
private void label174_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (label174.Text == "Stĺpec nevybraný" || label174.Text == "Stĺpec") label174.BackColor = Color.Empty;
|
if (label174.Text.Contains("Stĺpec")) label174.BackColor = Color.Empty;
|
||||||
else label174.BackColor = Color.Coral;
|
else label174.BackColor = Color.Coral;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10292,5 +10354,36 @@ namespace Mip
|
|||||||
SelectedZiadankaGridIds = String.Join(", ", grigIds);
|
SelectedZiadankaGridIds = String.Join(", ", grigIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void textBox52_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (textBox52.Text == string.Empty)
|
||||||
|
{
|
||||||
|
textBox52.Tag = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBox52.Tag = $" AND INSTR(`{label227.Text}`, '{textBox52.Text}')>0 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshZiadanky();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void label227_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (label227.Text.Contains("Stĺpec")) label227.BackColor = Color.Empty;
|
||||||
|
else label227.BackColor = Color.Coral;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button202_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
label174.Text = "Stĺpec 1 nevybraný";
|
||||||
|
label227.Text = "Stĺpec 2 nevybraný";
|
||||||
|
textBox38.Text = "";
|
||||||
|
textBox38.Enabled = false;
|
||||||
|
textBox52.Text = "";
|
||||||
|
textBox52.Enabled = false;
|
||||||
|
FilterQueue.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user