Exemplo n.º 1
0
        /// <summary>
        /// Itenta obtener la configuración del usuario (cliente) y pregunta por uno nuevo si no encuentra configuración previa
        /// </summary>
        /// <returns>True si el usuario se configuro exitosamente</returns>
        public bool ConfigureCustomer()
        {
            bool existCustomerConfiguration = CheckCustomerConfiguration();

            if (!existCustomerConfiguration)
            {
                try
                {
                    SessionManagerClient sessionManagerClient = new SessionManagerClient(SessionManagerClient.CreateDefaultBinding(), new EndpointAddress(UtnEmall.Client.SmartClientLayer.Connection.ServerUri + "SessionManager"));
                    sessionManagerClient.ValidateCustomer("", "");

                    CustomerConfigurationForm customerConfigurationForm = new CustomerConfigurationForm();
                    customerConfigurationForm.Owner = mainMenu;
                    customerConfigurationForm.ShowDialog();
                }
                catch (TargetInvocationException invocationException)
                {
                    Debug.WriteLine(invocationException.Message);
                    HelpForm helpForm = new HelpForm(global::PresentationLayer.GeneralResources.ServerNotFoundHelp);
                    helpForm.ShowDialog();
                    return(false);
                }
                catch (CommunicationException communicationError)
                {
                    Debug.WriteLine(communicationError.Message);
                    HelpForm helpForm = new HelpForm(global::PresentationLayer.GeneralResources.ServerNotFoundHelp);
                    helpForm.ShowDialog();
                    return(false);
                }
            }
            return(true);
        }
        /// <summary>
        /// Método llamado cuando se selecciona "Seleccionar".
        /// Abre el formulario adecuado de acuerdo a la selección del usuario.
        /// </summary>
        /// <param name="sender">
        /// El objeto que genero el evento
        /// </param>
        /// <param name="e">
        /// Un objeto que contiene información sobre el evento
        /// </param>
        private void menuItemSelect_Click(object sender, EventArgs e)
        {
            ListViewItem itemSelected = listViewConfigurationOption.FocusedItem;

            if (itemSelected == null)
            {
                return;
            }

            switch (itemSelected.Index)
            {
            case 0:
                MallConfigurationForm mallConfigurationForm = new MallConfigurationForm();
                mallConfigurationForm.Owner = this;
                mallConfigurationForm.ShowDialog();
                break;

            case 1:
                CustomerConfigurationForm customerConfigurationForm = new CustomerConfigurationForm();
                customerConfigurationForm.Owner = this;
                customerConfigurationForm.ShowDialog();
                break;

            case 2:
                HelpForm helpForm = new HelpForm(global::PresentationLayer.GeneralResources.ConfigurationHelp);
                helpForm.ShowDialog();
                break;

            default: break;
            }
        }