Esempio n. 1
0
        private void InitializeCollection()
        {
            Charges = new ObservableCollection<ChargeDataGrid>();
            using (var db = new DB.DomenaDBContext())
            {
                //var qa = db.Charges.Include(c => c.Components).Where(x => x.IsClosed).FirstOrDefault();
                var q = db.Charges.Include(x => x.Components).Include(x => x.Components.Select(y => y.GroupName)).Where(x => !x.IsDeleted);
                foreach (var ch in q)
                {
                    var cdg = new ChargeDataGrid(ch);
                    Charges.Add(cdg); 
                }
            }
            
            ChargesCV = (CollectionView)CollectionViewSource.GetDefaultView(Charges);
            ChargesCV.SortDescriptions.Add(new SortDescription("CreatedTime", ListSortDirection.Ascending)); 
            ChargesCV.Filter = FilterCollection;

            if (GroupByApartment)
            {
                ChargesCV.GroupDescriptions.Add(new PropertyGroupDescription("Apartment.ApartmentNumber"));
            }
            if (GroupByBuilding)
            {
                ChargesCV.GroupDescriptions.Add(new PropertyGroupDescription("Building.Name"));
            }
            ChargesCV.Refresh();
        }
Esempio n. 2
0
        private void InitializeCollection()
        {
            Charges = new ObservableCollection <ChargeDataGrid>();
            using (var db = new DB.DomenaDBContext())
            {
                foreach (var apartment in db.Apartments.Where(x => !x.IsDeleted))
                {
                    var c   = Helpers.ChargesOperations.CreateMonthlyCharge(apartment);
                    var cdg = new ChargeDataGrid(c);
                    Charges.Add(cdg);
                }
            }

            ChargesCV = (CollectionView)CollectionViewSource.GetDefaultView(Charges);
            ChargesCV.SortDescriptions.Add(new SortDescription("Apartment.ApartmentNumber", ListSortDirection.Ascending));
            ChargesCV.Filter = FilterCollection;

            if (GroupByApartment)
            {
                ChargesCV.GroupDescriptions.Add(new PropertyGroupDescription("Apartment.ApartmentNumber"));
            }
            if (GroupByBuilding)
            {
                ChargesCV.GroupDescriptions.Add(new PropertyGroupDescription("Building.Name"));
            }
            ChargesCV.Refresh();
        }
 private void LoadCharge(ChargeDataGrid charge)
 {
     if (charge != null)
     {
         ChargeDate       = charge.ChargeDate;
         SelectedBuilding = BuildingsCollection.FirstOrDefault(x => x.BuildingId.Equals(charge.Building.BuildingId));
         //ApartmentNumber = charge.Apartment.ApartmentNumber;
         SelectedApartmentNumber = ApartmentsNumbersCollection.FirstOrDefault(x => x.Equals(charge.Apartment.ApartmentNumber));
         OwnerName = charge.Owner.OwnerName + Environment.NewLine + charge.Owner.MailAddress;
     }
 }
 private void InitializeChargeComponents(ChargeDataGrid charge)
 {
     if (charge != null)
     {
         ChargeComponents = new ObservableCollection <ChargeComponent>(charge.Components);
     }
     else
     {
         ChargeComponents = new ObservableCollection <ChargeComponent>();
     }
     OnPropertyChanged("ComponentsSum");
 }
 public PreviewChargeWizard(ChargeDataGrid charge)
 {
     _charge = charge;
     if (_charge == null)
     {
         ChargeDate = DateTime.Today;
     }
     else
     {
         DataContext = this;
     }
     InitializeComponent();
     InitializeChargeStatusCollection();
     InitializeBuildingsList();
     InitializeCategoriesList();
     InitializeUnitsList();
     InitializeCategories();
     LoadCharge(charge);
     InitializeChargeComponents(charge);
 }
Esempio n. 6
0
 public EditChargeWizard(ChargeDataGrid charge)
 {
     _charge = charge;
     if (_charge == null)
     {
         CanEditApartment = true;
         ChargeDate       = DateTime.Today;
     }
     else
     {
         CanEditApartment = false;
     }
     DataContext = this;
     InitializeComponent();
     InitializeChargeStatusCollection();
     InitializeBuildingsList();
     InitializeCategoriesList();
     InitializeUnitsList();
     InitializeCategories();
     LoadCharge(charge);
     InitializeChargeComponents(charge);
 }