private void EditClient_Click(object sender, RoutedEventArgs e)
 {
     if (_clientId != null)
     {
         ProcesarAbrirVentana.AbrirVentana(ConstantsClients.NameWindowClientsEdit, typeof(ClientsEdit), _clientId);
     }
 }
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            var parameter = ((Button)sender).CommandParameter;

            if (parameter != null)
            {
                ProcesarAbrirVentana.AbrirVentana(ConstantsServiceGymContracts.NameWindowServiceGymContractsDelete, typeof(ServiceGymContractsDelete), int.Parse(parameter.ToString()));
            }
        }
Пример #3
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            var parameter = ((Button)sender).CommandParameter;

            if (parameter != null)
            {
                ProcesarAbrirVentana.AbrirVentana(ConstantsClients.NameWindowClientsDelete, typeof(ClientsDelete), parameter);
            }
        }
        private void DeleteClient_Click(object sender, RoutedEventArgs e)
        {
            var salir = MessageBox.Show("Deseas eliminar el registro.", "KallpaBox", MessageBoxButton.YesNoCancel);

            if (salir == MessageBoxResult.Yes)
            {
                var clientViewModel = _clientRepository.GetClientViewModelById(_clientId);
                var sessions        = _sessionRepository.GetAllSessionGymViewByClientIdView(_clientId);

                try
                {
                    if (clientViewModel != null)
                    {
                        _clientRepository.DeleteClient(clientViewModel.Id, clientViewModel);
                    }
                    if (sessions.Any())
                    {
                        foreach (var i in sessions)
                        {
                            _sessionRepository.DeleteSessionGymView(i.ClientId);
                        }
                    }

                    PresentationMessage.ShowMessegeQueue(this.SnackBarDeleteClients.MessageQueue, "Cliente Eliminado con exito");


                    this.EliminarButton.IsEnabled = false;

                    Thread.Sleep(5000);

                    ProcesarAbrirVentana.AbrirVentana(ConstantsClients.NameWindowClientsList, typeof(ClientsList), null);
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format(CultureInfo.CurrentCulture, "Error: {0})", ex.Message));
                }
            }
        }
        private void CreateServiceGymContract_Click(object sender, RoutedEventArgs e)
        {
            if (!InValidContext())
            {
                return;
            }
            var serviceGymContractViewModel = new ServiceGymContractViewModel()
            {
                ServiceGymId = int.Parse(ServiceGymId.SelectedValue.ToString()),
                ClientId     = int.Parse(ClientId.SelectedValue.ToString()),
                Price        = decimal.Parse(Price.Text),
                Quantity     = int.Parse(Quantity.Text),
                TypeQuantity = int.Parse(TypeQuantity.SelectedValue.ToString()),
                State        = true
            };

            try
            {
                if (serviceGymContractViewModel.TypeQuantity == (int)EnumsApp.TypeQuantitiesGym.Month)
                {
                    serviceGymContractViewModel.DateExpiration = serviceGymContractViewModel.DateCelebrate.AddMonths(serviceGymContractViewModel.Quantity);
                }

                if (serviceGymContractViewModel.TypeQuantity == (int)EnumsApp.TypeQuantitiesGym.Days)
                {
                    serviceGymContractViewModel.DateExpiration = serviceGymContractViewModel.DateCelebrate.AddDays(serviceGymContractViewModel.Quantity);
                }
                _serviceGymContractRepository.CreateServiceGymContract(serviceGymContractViewModel);
                ProcesarAbrirVentana.AbrirVentana(ConstantsServiceGymContracts.NameWindowServiceGymContractsList, typeof(ServiceGymContractsList), null);

                CleanControls();
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Пример #6
0
 private void CerrarVentana()
 {
     ProcesarAbrirVentana.AbrirVentana(ConstantsServiceGym.NameWindowServiceGymsList, typeof(ServiceGymsList), null);
 }
Пример #7
0
 private void CerrarVentana()
 {
     ProcesarAbrirVentana.AbrirVentana(ConstantsClients.NameWindowClientsCreate, typeof(ClientsList), null);
 }
Пример #8
0
 private void BackToListClients_Click(object sender, RoutedEventArgs e)
 {
     ProcesarAbrirVentana.AbrirVentana(ConstantsClients.NameWindowClientsList, typeof(ClientsList), null);
 }
 private void CreateServiceGymContract_Click(object sender, RoutedEventArgs e)
 {
     ProcesarAbrirVentana.AbrirVentana(ConstantsServiceGymContracts.NameWindowServiceGymContractsCreate, typeof(ServiceGymContractsCreate), null);
 }
Пример #10
0
 private void CreateClient_Click(object sender, RoutedEventArgs e)
 {
     ProcesarAbrirVentana.AbrirVentana(ConstantsClients.NameWindowClientsCreate, typeof(Clients), null);
 }
Пример #11
0
 private void BackToListServiceGymType_Click(object sender, RoutedEventArgs e)
 {
     ProcesarAbrirVentana.AbrirVentana(ConstantsServiceGymType.NameWindowServiceGymTypeList, typeof(ServiceGymTypesList), null);
 }