private void BtnSave(object sender, RoutedEventArgs e)
        {
            var result = MessagesBox.ShowDialog("¿Esta seguro de agregar proyeccion?", MessagesBox.Buttons.Yes_No);


            if (result == "1")
            {
                proj.Date    = (DateTime)dtpDate.Value;
                proj.MovieId = Convert.ToInt32(cmbMovie.SelectedValue);
                proj.HallId  = Convert.ToInt32(cmbHall.SelectedValue);
                if (!isEdit)
                {
                    int projectionId = wk.AddProjection(proj);
                    GiveProjection(proj.HallId, projectionId);
                    Projections.viewProjections.Add(proj);
                    ShortNotifications.ShowDialog("Se añadio exitosamente!!!");
                }
                else
                {
                    MessageBox.Show("Se actualizó con éxito");
                    wk.Update(proj);
                }
                Reset();
                //  dataGridUpdate.ItemsSource = wk.GetAll();
                // CollectionViewSource.GetDefaultView(dataGridUpdate.ItemsSource).Refresh();
                this.Close();
            }
        }
示例#2
0
        private void addCustomer(object sender, RoutedEventArgs e)
        {
            c          = new Customer();   //Se carga los campos de un nuevo cliente
            c.Dni      = txtDni.Text;
            c.Lastname = txtLastname.Text;
            c.Name     = txtName.Text;
            c.Email    = txtEmail.Text;
            c.Phone    = txtPhone.Text;

            var result = MessagesBox.ShowDialog("¿Esta seguro de agregar cliente?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                try
                {
                    if (workCustomer.AddCustom(c))
                    {
                        ShortNotifications.ShowDialog("Se agrego exitosamente!!!");
                        this.Close();
                        //clear();
                    }
                    else
                    {
                        DataContext = c;
                    }
                }
                catch (Exception)
                {
                    ShortNotifications.ShowDialog("Datos incorrectos!!!");
                }
            }
        }
示例#3
0
        private void BtnPreview_Click(object sender, RoutedEventArgs e)
        {
            var result = MessagesBox.ShowDialog("¿Desea generar Documento?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                DocumentFilterUser documentFilterUser = new DocumentFilterUser(List);
                ShortNotifications.ShowDialog("Se genero documento con exito!!!");
                documentFilterUser.Show();
            }
        }
示例#4
0
        private void BtnEliminar_Click(object sender, RoutedEventArgs e)
        {
            var result = MessagesBox.ShowDialog("¿Esta seguro de eliminar usuario: " + currentUser.Username + "?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                EnableButtons();
                wu.Delete(users.ElementAt(Vista.CurrentPosition).Id);
                users.RemoveAt(Vista.CurrentPosition);
                ShortNotifications.ShowDialog("Se elimino exitosamente!!!");
            }
        }
示例#5
0
        private void BtnSave_Group(object sender, RoutedEventArgs e)
        {
            Group group  = SetGroup();
            var   result = MessagesBox.ShowDialog("¿Desea agregar grupo de butacas?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                SaveSeats(group);
                hallFactory.CreateHall();
                ShortNotifications.ShowDialog("Se agrego exitosamente!!!");
                this.Close();
            }
        }
示例#6
0
        private void ListBoxItemDeleteC_Selected(object sender, RoutedEventArgs e) //opcion eliminar un cliente
        {
            var      baseobj  = sender as FrameworkElement;
            Customer customer = baseobj.DataContext as Customer;
            var      result   = MessagesBox.ShowDialog("¿Estás seguro de eliminar?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                wc.Delete(customer.Id);
                CollectionViewSource.GetDefaultView(List.ItemsSource).Refresh();
                SetDefaultCustomers();
                ShortNotifications.ShowDialog("Se elimino exitosamente!!!");
            }
        }
示例#7
0
        //Boton para acceder a la sesion
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (workLogin.LoginUser(txtUsername.Text, txtPassword.Password))

            {
                User logged = workLogin.getUserLogged();
                RememberUser(logged);
                userLogged(logged);
                ShortNotifications.ShowDialog("Bienvenido " + workLogin.getUserLogged().Fullname);
            }
            else
            {
                ShortNotifications.ShowDialog("Usuario o contraseña incorrecta");
            }
        }
示例#8
0
        private void BtnSave_Group(object sender, RoutedEventArgs e)
        {
            Hall hall = new Hall();

            hall.Capacity   = Convert.ToInt32(txtCapacity.Text);
            hall.HallNumber = Convert.ToInt32(txtHallNumber.Text);
            var result = MessagesBox.ShowDialog("¿Esta seguro de agregar sala?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                wh.Add(hall);
                hallFactory.RefreshCombobox();
                hallFactory.CreateHall();
                ShortNotifications.ShowDialog("Se añadio exitosamente!!!");
                this.Close();
            }
        }
示例#9
0
        void ChangeButtonColor(object sender, RoutedEventArgs e)
        {
            //Obtengo el botón al que clickeé
            Button btn = (sender as Button);
            //obtengo el nombre del grid que contiene al botón
            string gridName    = (btn.Parent as Grid).Name;
            var    idGroup     = Convert.ToInt32(Between(gridName, "d", "z"));
            var    row         = Convert.ToInt32(Between(btn.Name, "r", "R"));
            int    column      = Convert.ToInt32(Between(btn.Name, "c", "C"));
            bool   isAvailable = true;
            Seat   seat        = ws.GetByProjection(projection.Id, idGroup, row, column);

            if (seat.Status == STATUS.OCUPADO.ToString())
            {
                ShortNotifications.ShowDialog("Butaca ocupada!!!");
                isAvailable = false;
            }
            else if (seat.Status == STATUS.DISPONIBLE.ToString())
            {
                SetButtonColor(btn, Brushes.Green);
                seatsAvailable--;
                seatsSelected++;
                seat.Status = STATUS.OCUPADO.ToString();
            }
            else if (seat.Status == STATUS.FUERA_SERVICIO.ToString())
            {
                SetButtonColor(btn, Brushes.Yellow);
                ShortNotifications.ShowDialog("Butaca fuera de servicio!!!");
                isAvailable = false;
                seatsAvailable--;
            }

            if (isAvailable && (seat.Status == STATUS.OCUPADO.ToString() || seat.Status == STATUS.FUERA_SERVICIO.ToString()))
            {
                seats.Add(seat);
            }
            else
            {
                seats.Remove(seat);
            }
            SetLabels();
        }
示例#10
0
        private void BtnImage_Click(object sender, RoutedEventArgs e)
        {
            Ticket ticket = new Ticket();

            ticket.ProjectionId = projection.Id;
            ticket.Ticketnumber = generateNumberTicket();
            ticket.CustomerId   = Convert.ToInt32(cmbCustomer.SelectedValue);
            ticket.Dateofsale   = DateTime.Now;
            ticket.Total        = totalPrice;
            var result = MessagesBox.ShowDialog("¿Desea generar Ticket?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                UpdateSeats(seats);
                wticket.Add(ticket);
                ShortNotifications.ShowDialog("Se genero ticket!!!");
                this.Close();
                PrintTicket(ticket, seats);
            }
        }
示例#11
0
        //delete
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            var   baseobj = sender as FrameworkElement;
            Movie movie   = baseobj.DataContext as Movie;
            var   result  = MessagesBox.ShowDialog("¿Estás seguro de eliminar?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                try
                {
                    workMovie.Delete(movie.Id);
                    ShortNotifications.ShowDialog("Se elimino exitosamente!!!");
                    ListCardMovies.listMovie.Remove(movie);
                    CollectionViewSource.GetDefaultView(ListCardMovies.listMovie).Refresh();//refresca la lista
                }
                catch
                {
                    ShortNotifications.ShowDialog("No se puede eliminar pelicula, esta en proyeccion");
                }
            }
        }
示例#12
0
        private void BtnGuardar_Click(object sender, RoutedEventArgs e)
        {
            if (agregando)
            {
                var result = MessagesBox.ShowDialog("¿Esta seguro de agregar usuario: " + currentUser.Username + "?", MessagesBox.Buttons.Yes_No);

                if (result == "1")
                {
                    user.Fullname = txtFullname.Text;
                    user.Username = txtUsername.Text;
                    user.Password = txtPassword.Text;
                    Rol rol = cmbRol.SelectedItem as Rol;
                    user.RolId = rol.Id;
                    wu.Add(user);
                    EnableButtons();
                    ShortNotifications.ShowDialog("Se agrego exitosamente!!!");
                    agregando = false;
                }
            }
            else
            {
                var result = MessagesBox.ShowDialog("¿Esta seguro de modificar el usuario: " + currentUser.Username + "?", MessagesBox.Buttons.Yes_No);

                if (result == "1")
                {
                    User userModified = new User();
                    userModified.Id       = users.ElementAt(Vista.CurrentPosition).Id;
                    userModified.Fullname = txtFullname.Text;
                    userModified.Username = txtUsername.Text;
                    userModified.Password = txtPassword.Text;
                    Rol rol = cmbRol.SelectedItem as Rol;
                    userModified.Rol   = rol;
                    userModified.RolId = userModified.Rol.Id;
                    wu.Update(userModified);
                    EnableButtons();
                    ShortNotifications.ShowDialog("Se modifico exitosamente!!!");
                    copyCurrentUser();
                }
            }
        }
示例#13
0
        //add
        private void BtnAceptMovie_Click(object sender, RoutedEventArgs e)
        {
            var result = MessagesBox.ShowDialog("¿Estas seguro de agregar pelicula?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                movie.Title        = txtTitulo.Text;
                movie.Duration     = txtDuracion.Text;
                movie.Description  = txtDescripcion.Text;
                movie.UrlYoutube   = txtUrlYoutube.Text;
                movie.Classofmovie = cmbClassMovie.SelectedValue.ToString();
                Category asd = cmbCategory.SelectedItem as Category;
                movie.CategoryId = asd.Id;
                wm.Add(movie);
                ListCardMovies.listMovie.Insert(0, movie);
                ListCardMovies.listMovieFirstPage.Insert(0, movie);
                ShortNotifications.ShowDialog("Se agrego exitosamente!!!");
                movie      = new Movie();
                descending = true;
            }
            Reset();
        }
示例#14
0
        private void UpdateCustomer(object sender, RoutedEventArgs e)
        {
            c.Lastname = txtLastname.Text;
            c.Name     = txtName.Text;
            c.Email    = txtEmail.Text;
            c.Phone    = txtPhone.Text;

            var result = MessagesBox.ShowDialog("¿Esta seguro de modificar cliente?", MessagesBox.Buttons.Yes_No);

            if (result == "1")
            {
                if (workCustomer.UpdateCustom(c))
                {
                    ShortNotifications.ShowDialog("Se modifico exitosamente!!!");
                    this.Close();
                }
                else
                {
                    DataContext = c;
                }
            }
        }
示例#15
0
 private void BtnSeatConfiguration_Click(object sender, RoutedEventArgs e)
 {
     ws.UpdateAll(seatsUpdate);
     ShortNotifications.ShowDialog("Butacas actualizadas");
     CreateHall();
 }