public void Update() { //try //{ DateTime dt1 = DateTime.Now; ElectionDb db = new ElectionDb(); db.FilterElctorByName(CurrentSearch.Name); if (CurrentSearch.Gender != Gender.NOT_SET) { string g = CurrentSearch.Gender == Gender.Mail ? "1" : "2"; db.FilterByGender(g); } db.FilterByElectorByGovernate("الكرك"); db.SortByAge(false); var results = db.GetResults(); CurrentPersonsList = new ObservableCollection <Person>(results); DateTime dt2 = DateTime.Now; double diff = dt2.Ticks - dt1.Ticks; double seconds = Math.Round(diff / 10000000.0, 2); SearchInfo = string.Format("{0} Records in {1} s", CurrentPersonsList.Count, seconds); //} //catch (Exception ex) //{ // System.Windows.MessageBox.Show(ex.Message); // CurrentPersonsList = null; //} }
public ElectionViewModel() { DateTime dt1 = DateTime.Now; //try //{ ElectionDb db = new ElectionDb(); db.FilterElctorByName("انس"); db.FilterByGender("2"); db.FilterByElectorByGovernate("الكرك"); db.SortByAge(false); var results = db.GetResults(); CurrentPersonsList = new ObservableCollection <Person>(results); DateTime dt2 = DateTime.Now; double diff = dt2.Ticks - dt1.Ticks; double ms = Math.Round(diff / 10000.0, 2); SearchInfo = string.Format("{0} Records in {1} ms", CurrentPersonsList.Count, ms); //} //catch (Exception ex) //{ // System.Windows.MessageBox.Show(ex.Message); // CurrentPersonsList= null; //} }
private void button1_Click(object sender, EventArgs e) { try { ElectionDb.ElectionDb db = new ElectionDb.ElectionDb(); db.FilterElctorByName("انس"); db.FilterByGender("2"); db.FilterByElectorByGovernate("الكرك"); db.SortByAge(false); var results = db.GetResults(); dataGridView1.DataSource = results; } catch (Exception ex) { MessageBox.Show(ex.Message); } }