I fill datagrid from DataBase using sqlite - ShowDataBase(string a);
Then I want to sort It,When Button is Clicked (Note! I want to sort it only in program(not modding the DB). Just want to delete wrong rows)
private void Button_Click(object sender, RoutedEventArgs e)
{
ShowDataBase("Pacients");
if ((bool)SortFromCheckBox.IsChecked)
{
//Delete all data earlier than data that user asked for
for (int i = DataGridMain.Items.Count - 1; i >= 0; i--)
{
DataGridRow row = (DataGridRow)DataGridMain.ItemContainerGenerator.ContainerFromIndex(i);
var item = DataGridMain.Items[i];
var data = DataGridMain.Columns[4].GetCellContent(item);
if ((Convert.ToDateTime(data)) <= (Convert.ToDateTime(SortFromTextBox.Text)))
{
//Smth to delete row № i from datagrid
}
}
}
if ((bool)SortUntilCheckBox.IsChecked)
{
//Delete all data older than data that user asked for
}
if ((bool)SortByClientCheckBox.IsChecked)
{
//Delete all data where client cell is != name that user want to sort by
}
if ((bool)SortByDoctorCheckBox.IsChecked)
{
//Delete all data where doctor cell is != name that user want to sort by
}
}
Aucun commentaire:
Enregistrer un commentaire