예제 #1
0
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            string message = "";

            try
            {
                PaymentsEntering.RefreshPayments(LoggedUser);
                lstPayments.DataContext = PaymentsEntering.PaymentList;
                message = string.Format(Localization.Language.PaymentListUpdatedAtX, DateTime.Now);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                MessageBox.Show(ex.Message);
            }
            finally
            {
                lbMessages.Content = message;
            }
        }
예제 #2
0
        private void btnGet_Click(object sender, RoutedEventArgs e)
        {
            //var options = new SearchOptions
            //{
            //  StartDate = dtpDate1.SelectedDate,
            //  EndDate = dtpDate2.SelectedDate,
            //  CategoryId = (Guid?)cboCategory.SelectedValue,
            //  SubCategoryId = (Guid?)cboSubCategory.SelectedValue,
            //  UserId = LoggedUser.Id
            //};

            PaymentsEntering.RefreshPayments(LoggedUser);
            localData = PaymentsEntering.PaymentList;

            // View for filttering
            view = CollectionViewSource.GetDefaultView(localData);
            CollectionView view2 = new ListCollectionView(localData);

            // Filter payments according selected period, category and subcategory
            view.Filter  = Filtering;
            view2.Filter = Filtering;

            dgReports.DataContext = localData;

            lbMessages.Content = string.Format(Localization.Language.DataRetrievedDetailsMessage,
                                               ((DateTime)dtpDate1.SelectedDate).ToShortDateString(),
                                               ((DateTime)dtpDate2.SelectedDate).ToShortDateString(),
                                               cboCategory.Text,
                                               cboSubCategory.Text
                                               );

            double sum = 0;

            foreach (var item in view2)
            {
                sum += ((Payment)item).Amount;
            }

            lbRows.Content  = string.Format(Localization.Language.RowsCountX, view2.Count);
            lbTotal.Content = string.Format(Localization.Language.RowsSumX, string.Format("{0:C}", sum));
        }