/// <summary> /// Llena el grid de Wholesalers /// </summary> /// <history> /// [emoguel] created 07/06/2016 /// </history> private async void LoadWholesalers(WholesalerData wholesalersData = null) { try { status.Visibility = Visibility.Visible; int nIndex = 0; List <WholesalerData> lstWholesalers = await BRWholesalers.GetWholesalers(_WholeSalerFilter); dgrWholesalers.ItemsSource = lstWholesalers; if (lstWholesalers.Count > 0) { if (wholesalersData != null) { wholesalersData = lstWholesalers.Where(wh => wh.wscl == wholesalersData.wscl && wh.wsApplication == wholesalersData.wsApplication && wh.wsCompany == wholesalersData.wsCompany).FirstOrDefault(); nIndex = lstWholesalers.IndexOf(wholesalersData); } btnDel.IsEnabled = _blnDel; GridHelper.SelectRow(dgrWholesalers, nIndex); } else { btnDel.IsEnabled = false; } StatusBarReg.Content = lstWholesalers.Count + " Wholesalers."; status.Visibility = Visibility.Collapsed; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Guarda los datos /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 07/06/2016 /// </history> private async void btnAccept_Click(object sender, RoutedEventArgs e) { if (enumMode != EnumMode.Search) { if (ObjectHelper.IsEquals(wholesaler, oldWholesaler)) { _isClosing = true; Close(); } else { txtStatus.Text = "Saving Data..."; skpStatus.Visibility = Visibility.Visible; string strMsj = ""; strMsj = ValidateHelper.ValidateForm(this, "Wholesaler"); if (strMsj == "") { int nRes = await BRWholesalers.SaveWholesaler(wholesaler); UIHelper.ShowMessageResult("Whosaler", nRes); if (nRes > 0) { var wholesalersData = await BRWholesalers.GetWholesalers(new WholesalerData { wscl = wholesaler.wscl, wsApplication = wholesaler.wsApplication, wsCompany = wholesaler.wsCompany }); wholesalerData = wholesalersData.FirstOrDefault(); _isClosing = true; DialogResult = true; Close(); } } else { UIHelper.ShowMessage(strMsj); } skpStatus.Visibility = Visibility.Collapsed; } } else { _isClosing = true; DialogResult = true; Close(); } }