コード例 #1
0
ファイル: NewRent_ViewModel.cs プロジェクト: sikisuti/gyorok
        public NewRent_ViewModel()
        {
            if (!this.IsInDesignMode)
            {
                //t = new Timer(300000);
                //t.Start();
                //t.Elapsed += new ElapsedEventHandler(t_Elapsed);

                payType = DataProxy.Instance.GetPayTypes();
                newRentalGroup = new RentalGroup_Representation();
                newRental = new RentalRepresentation();

                selectedPayType = payType.SingleOrDefault(pt => pt.id == 1);
                newRental.payType = selectedPayType;

                //changeEnabled = true;
            }
        }
コード例 #2
0
        public object Clone()
        {
            RentalRepresentation clonedRental = this.MemberwiseClone() as RentalRepresentation;

            return(clonedRental);
        }
コード例 #3
0
 public void RemoveRental(RentalRepresentation rental)
 {
     rentals.Remove(rental);
     RaisePropertyChanged("TotalCost");
 }
コード例 #4
0
ファイル: NewRent_ViewModel.cs プロジェクト: sikisuti/gyorok
        void deleteRentExecute()
        {
            if (MessageBoxResult.Yes != MessageBox.Show("Valóban törölni akarod a kijelölt bérlést?", "Bérlés törlése", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No))
            {
                return;
            }

            newRentalGroup.rentals.Remove(selectedRental);
            selectedRental = null;
            OnRentGroupChanged();
        }
コード例 #5
0
ファイル: AppMessages.cs プロジェクト: sikisuti/gyorok
 public static void Send(RentalRepresentation r)
 {
     Messenger.Default.Send(r, MessageTypes.newRentRemoved);
 }
コード例 #6
0
 public void RemoveRental(RentalRepresentation rental)
 {
     rentals.Remove(rental);
     RaisePropertyChanged("TotalCost");
 }
コード例 #7
0
        public static Rentals convertRental(RentalRepresentation rental)
        {
            Rentals convertedRental = new Rentals()
            {
                actualPrice = rental.actualPrice,
                customerID = rental.customer.id,
                discount = (float)rental.discount * 100,
                isClean = rental.isClean,
                rentalID = rental.id,
                rentalEnd = rental.rentalEnd,
                isPaid = rental.isPaid,
                payTypeID = rental.payType.id,
                rentalRealEnd = rental.rentalRealEnd,
                rentalStart = rental.rentalStart,
                toolID = rental.tool.id
            };

            if (rental.group != null && rental.group.id != default(long))
            {
                convertedRental.groupID = rental.group.id;
            }

            convertedRental.Tools = convertTool(rental.tool);

            if (rental.customer.isFirm && rental.contact != null)
            {
                convertedRental.contactID = rental.contact.id;
                convertedRental.Customers1 = convertCustomer(rental.contact);
            }

            return convertedRental;
        }
コード例 #8
0
        public static RentalRepresentation convertRental(Rentals rental)
        {
            RentalRepresentation convertedRental = new RentalRepresentation()
            {
                actualPrice = rental.actualPrice,
                contact = convertCustomer(rental.Customers1),
                customer = convertCustomer(rental.Customers),
                discount = rental.discount / 100,
                //group = DataProxy.Instance.GetRentalGroupById(rental.groupID),    - Couses infinite cycle
                isClean = rental.isClean,
                id = rental.rentalID,
                isPaid = rental.isPaid,
                payType = convertPayType(rental.PayTypes),
                rentalEnd = rental.rentalEnd,
                rentalRealEnd = rental.rentalRealEnd,
                rentalStart = rental.rentalStart,
                tool = convertTool(rental.Tools)
            };

            //int selfIndex = convertedRental.group.rentals.IndexOf(convertedRental.group.rentals.SingleOrDefault(r => r.id == convertedRental.id));
            //convertedRental.group.rentals[selfIndex] = convertedRental;

            return convertedRental;
        }