/// <summary> /// Carga clientes desde un servicio web /// </summary> /// <param name="session">Identificador de sesión de usuario</param> /// <returns>true si la carga se realizó con éxito</returns> public bool Load(string session) { Clear(); try { foreach (ServiceEntity entity in Services.Service.GetAllService(true, session)) { ComboBoxItemWithEntity item = new ComboBoxItemWithEntity(); item.Entity = entity; item.Content = entity.Name; comboBoxService.Items.Add(item); } } catch (TargetInvocationException) { return(false); } catch (EndpointNotFoundException) { return(false); } catch (CommunicationException) { return(false); } return(true); }
private void comboBoxStore_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItemWithEntity storeItem = (comboBoxStore.SelectedItem as ComboBoxItemWithEntity); ComboBoxItem dataModalityItem = (comboBoxDataModality.SelectedItem as ComboBoxItem); List <DictionaryEntry> statisticValues; // Verifica si los dos combos tienen la misma selección. if (storeItem != null && dataModalityItem != null) { list.Items.Clear(); StoreEntity store = storeItem.Entity as StoreEntity; if (store.Id == 0) { // Todas las tiendas están seleccionadas. if ((dataModalityItem.Content as string).Equals(UIResources.Time)) { statisticValues = Services.StatisticsAnalyzer.GetCustomersTimeAmount(session); } else { statisticValues = Services.StatisticsAnalyzer.GetCustomersAccessAmount(session); } } else { // Se ha seleccionado una tienda. if ((dataModalityItem.Content as string).Equals(UIResources.Time)) { statisticValues = Services.StatisticsAnalyzer.GetCustomersTimeAmountByStore(store, session); } else { statisticValues = Services.StatisticsAnalyzer.GetCustomersAccessAmountByStore(store, session); } } foreach (DictionaryEntry item in statisticValues) { list.Items.Add(item); } } }
private void OnViewerSelected(object sender, EventArgs e) { ComboBoxItemWithEntity serviceItem = (ComboBoxItemWithEntity)viewer.comboBoxService.SelectedItem; if (serviceItem == null) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.NoServiceSelected); return; } if (statistics != null && statistics.IsVisible) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.ServiceStatisticsViewerOpened); return; } statistics = new ServiceStatistics((ServiceEntity)serviceItem.Entity, control.Session); statistics.ShowDialog(); }
/// <summary> /// carga clientes desde un servicio web /// </summary> /// <param name="session"> /// el identificador de sesión para invocar al servicio web /// </param> /// <returns> /// True si la carga se realizó exitosamente /// </returns> public bool Load(string sessionValue) { session = sessionValue; Clear(); try { // Carga una clase de ayuda para establecer el primer elemento de selección. ComboBoxItemWithEntity fakeStoreItem = new ComboBoxItemWithEntity(); fakeStoreItem.Entity = new StoreEntity(); fakeStoreItem.Entity.Id = 0; (fakeStoreItem.Entity as StoreEntity).Name = UtnEmall.ServerManager.Properties.Resources.AllStores; fakeStoreItem.Content = UtnEmall.ServerManager.Properties.Resources.AllStores; comboBoxStore.Items.Add(fakeStoreItem); foreach (StoreEntity storeEntity in Services.Store.GetAllStore(true, session)) { ComboBoxItemWithEntity item = new ComboBoxItemWithEntity(); // Inserta un nuevo elemento para la tienda item.Entity = storeEntity; item.Content = storeEntity.Name; comboBoxStore.Items.Add(item); } } catch (TargetInvocationException) { return(false); } catch (EndpointNotFoundException) { return(false); } catch (CommunicationException) { return(false); } return(true); }