private async void Window_Loaded(object sender, RoutedEventArgs e) { try { _driverData = await DDriver.GetData(); } catch (Exception exception) { Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در دریافت اطلاعات\n" + exception.Message); Close(); return; } _driverSearchData = _driverData; if (string.IsNullOrEmpty(TxtSearch.Text.Trim()) || _add) { DgdData.ItemsSource = _driverSearchData; TxtSearch.Text = string.Empty; } else { TxtSearch_TextChanged(null, null); } DgdData.ItemsSource = _driverSearchData; BtnNew_Click(null, null); }
private async void Window_Loaded(object sender, RoutedEventArgs e) { try { _havalehData = await DHavaleh.GetHavaleh(); _countyData = await DHavaleh.GetCounty(); _factoryData = await DFactory.GetData(); _buyerData = await DBuyer.GetData(); _driverData = await DDriver.GetData(); CboProvince.ItemsSource = await DHavaleh.GetProvince(); CboVehicle.ItemsSource = await DVehicle.GetData(); CboProduct.ItemsSource = await DProduct.GetData(); CboCapacity.ItemsSource = await DCapacity.GetData(); } catch (Exception exception) { Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در دریافت اطلاعات\n" + exception.Message); Close(); return; } _havalehSearchData = _havalehData; if (string.IsNullOrEmpty(TxtSearch.Text.Trim()) || _add) { DgdHavaleh.ItemsSource = _havalehSearchData; TxtSearch.Text = string.Empty; } else { TxtSearch_TextChanged(null, null); } CboFactory.ItemsSource = _factoryData; CboBuyer.ItemsSource = _buyerData; CboDriver.ItemsSource = _driverData; CboCounty.ItemsSource = _countyData; DgdHavaleh.ItemsSource = _havalehSearchData; BtnNew_Click(null, null); }
private async void BtnAddDriver_Click(object sender, RoutedEventArgs e) { var winDriver = new WinDriver(); winDriver.ShowDialog(); try { _driverData = await DDriver.GetData(); } catch (Exception exception) { Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در دریافت اطلاعات\n" + exception.Message); Close(); } LblMobile.Content = null; LblPelak.Content = null; CboDriver.ItemsSource = _driverData; }