/// <summary> /// Carga los sale Types del combobox y el Datagrid /// </summary> /// <history> /// [emoguel] created 01-Ago-2016 /// </history> private async void LoadSaleTypes() { try { List <SaleType> lstSaleTypes = await BRSaleTypes.GetSalesTypes(); _lstOldSaleTypes = (!string.IsNullOrWhiteSpace(saleTypeCategory.stcID)) ? lstSaleTypes.Where(st => st.ststc == saleTypeCategory.stcID).Select(st => st).ToList() : new List <SaleType>(); cmbSalesTypes.ItemsSource = lstSaleTypes; dgrSaleType.ItemsSource = _lstOldSaleTypes.ToList(); btnAccept.Visibility = Visibility.Visible; skpStatus.Visibility = Visibility.Collapsed; cmbSalesTypes.Header = "Sale Types (" + _lstOldSaleTypes.Count + ")"; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Llena el grid de salesTypes /// </summary> /// <param name="saleType">Objeto a seleccionar</param> /// <history> /// [emoguel] created 19/04/2016 /// </history> private async void LoadSalesTypes(SaleType saleType = null) { try { status.Visibility = Visibility.Visible; int nIndex = 0; List <SaleType> lstSalestypes = await BRSaleTypes.GetSalesTypes(_nStatus, _saletTypeFilter); dgrSaleTypes.ItemsSource = lstSalestypes; if (lstSalestypes.Count > 0 && saleType != null) { saleType = lstSalestypes.Where(st => st.stID == saleType.stID).FirstOrDefault(); nIndex = lstSalestypes.IndexOf(saleType); } GridHelper.SelectRow(dgrSaleTypes, nIndex); StatusBarReg.Content = lstSalestypes.Count + " Sale Types."; status.Visibility = Visibility.Collapsed; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }