Exemplo n.º 1
0
 /// <summary>
 /// Initialize current instance
 /// </summary>
 /// <param name="window">Owner window</param>
 /// <param name="purchase">Pruchase to do payment</param>
 /// <param name="model">Data model</param>
 public PaymentsPurchase(Window window, Purchase purchase, LeposWPFModel model)
 {
     this.Model = model;
     this.Purchase = purchase;
     this.Owner = window;
     InitializeComponent();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Save user's password
 /// </summary>
 public static void savePassword()
 {
     LeposWPFModel model = new LeposWPFModel();
     var searchUser = model.Users.Where(a => a.ID == loggedUser.ID).FirstOrDefault();
     searchUser.Password = loggedUser.Password;
     model.SaveChanges();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Validate user
 /// </summary>
 /// <param name="ID">ID of user</param>
 /// <param name="password">Password of user</param>
 /// <returns>Whether or not the user and password validates</returns>
 public static Boolean isUser(String ID, string password)
 {
     LeposWPFModel model = new LeposWPFModel();
     var searchUser = model.Users.Where(a=> a.ID == ID && a.Password == password).FirstOrDefault();
     loggedUser = searchUser;
     return loggedUser != null;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initialize current instance
 /// </summary>
 /// <param name="window">Owner window</param>
 /// <param name="sale">Sale to do payment</param>
 /// <param name="model">Data model</param>
 public PaymentsSale(Window window, Sale sale, LeposWPFModel model)
 {
     this.Model = model;
     this.Sale = sale;
     this.Owner = window;
     InitializeComponent();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Saving event
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event of sender object</param>
 private void saveButton_Click(object sender, RoutedEventArgs e)
 {
     if (startDatePicker.SelectedDate == null || endDatePicker.SelectedDate == null)
     {
         messageTextBlock.Foreground = Brushes.Red;
         messageTextBlock.Text = "No estan seleccionadas las fechas";
     }
     else
     {
         LeposWPFModel model = new LeposWPFModel();
         switch (catalogComboBox.SelectedIndex)
         {
             case 0: // case purchases
                 var purchases = model.Purchases.Where(a=> a.Date >= startDatePicker.SelectedDate && a.Date <= endDatePicker.SelectedDate).ToList();
                 model.Purchases.RemoveRange(purchases);
                 break;
             case 1: //case sales
                 var sales = model.Sales.Where(a => a.Date >= startDatePicker.SelectedDate && a.Date <= endDatePicker.SelectedDate).ToList();
                 model.Sales.RemoveRange(sales);
                 break;
         }
         messageTextBlock.Foreground = Brushes.Green;
         messageTextBlock.Text = "La información ha sido eliminada";
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Window loaded event
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event of sender object</param>
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     collectionViewSource = (CollectionViewSource)FindResource("collectionViewSource");
     auxiliarCollectionViewSource = (CollectionViewSource)FindResource("auxiliarCollectionViewSource");
     conn = new LeposWPFModel();
     storyBoard = (Storyboard)FindResource("animate");
     initInterface();
     dataGridTag = productsButton.Tag.ToString();
     displayText("Obteniendo información...");
     fillDataGrid();
     if (UserHelper.loggedUser.Type == 1)
     {
         deleteButton.IsEnabled = false;
     }
 }