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; } }
public object Clone() { RentalRepresentation clonedRental = this.MemberwiseClone() as RentalRepresentation; return(clonedRental); }
public void RemoveRental(RentalRepresentation rental) { rentals.Remove(rental); RaisePropertyChanged("TotalCost"); }
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(); }
public static void Send(RentalRepresentation r) { Messenger.Default.Send(r, MessageTypes.newRentRemoved); }
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; }
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; }