private void search_ConditionChanged(object sender, EventArgs e) { CBClass.Controls.Search search = sender as CBClass.Controls.Search; CBClass.SearchLocal searchLocal = sender as CBClass.SearchLocal; int startPosition; int endPosition; if (searchLocal == null) { startPosition = conditions.IndexOf(search.CBIdColumn); } else { startPosition = conditions.IndexOf(searchLocal.CBColumnName); } if (startPosition != -1)//Foi encontrado { endPosition = conditions.IndexOf("AND", startPosition); if (endPosition == -1)//Se for a ultima condicao nao vai ter AND ficar com o valor -1 -2 = -3 { conditions = conditions.Remove((startPosition - 5 >= 0) ? startPosition - 5 : 0); } else { conditions = conditions.Remove(startPosition, endPosition - startPosition + 3); } } if (search != null && search.CBValue != "")// Search normal { if (conditions != "") { conditions += " AND "; } conditions += search.CBIdColumn + " = " + search.CBValue; } else if (searchLocal != null)// SearchLocal { if (searchLocal.CBColumnName != "") { if (conditions != "") { conditions += " AND "; } conditions += searchLocal.CBColumnName + " LIKE '%" + searchLocal.CBValue + "%'"; } } Methods.updateListView(listView, columns, tables, conditions); }
private void search_ButtonClick(object sender, EventArgs e) { CBClass.Controls.Search search = sender as CBClass.Controls.Search; switch (search.CBFormName) { case "categoria": categoria a = new categoria(true); a.ShowDialog(); break; case "autores": autores b = new autores(true); b.ShowDialog(); break; case "editora": editora c = new editora(true); c.ShowDialog(); break; } search.CBValue = Variables.returnValue.ToString(); search.reload(); Variables.returnValue = 0; }
private void search_CheckBoxCheckedChange(object sender, EventArgs e) { CBClass.Controls.Search search = sender as CBClass.Controls.Search; if (search.CBisChecked) { listView.Columns.Add(search.CBText); columns += ", " + search.CBColumnName; } else { int i; for (i = 0; listView.Columns[i].Text != search.CBText; i++) { ; } listView.Columns[i].Dispose(); columns = columns.Replace(", " + search.CBColumnName, ""); } Methods.updateListView(listView, columns, tables, conditions); }