public string InsertOrUpdate(RentalContratDTO rentalContrat) { try { var validate = Validate(rentalContrat); if (!string.IsNullOrEmpty(validate)) { return(validate); } if (ObjectExists(rentalContrat)) { return(GenericMessages.DatabaseErrorRecordAlreadyExists); } ////if the Contrat is the last one //var room = _roomRepository.FindById(rentalContrat.RoomId); //room.LastRenteeId = rentalContrat.RenteeId; //_roomRepository.InsertUpdate(room); _rentalContratRepository.InsertUpdate(rentalContrat); _unitOfWork.Commit(); return(string.Empty); } catch (Exception exception) { return(exception.Message); } }
public RentalContratEntry(RentalContratDTO contrat) { RentalContratEntryViewModel.Errors = 0; InitializeComponent(); Messenger.Default.Send <RentalContratDTO>(contrat); Messenger.Reset(); }
public RentalPaymentEntry(RentalContratDTO rentalContrat, bool isRenewal) { RentalPaymentEntryViewModel.Errors = 0; InitializeComponent(); Messenger.Default.Send <bool>(isRenewal); Messenger.Default.Send <RentalContratDTO>(rentalContrat); Messenger.Reset(); }
private bool ExcuteAddNewRentalContractCommand2() { var selectedRentalContrat2 = new RentalContratDTO { RoomId = SelectedRoom.Id }; return(ShowDiag(selectedRentalContrat2)); }
private void ExcuteAddNewRentalContractCommand() { var selectedRentalContrat2 = new RentalContratDTO { RoomId = SelectedRoom.Id }; ShowDiag(selectedRentalContrat2); }
private bool ShowDiag(RentalContratDTO selectedRentalContrat) { var contratEntry = new RentalContratEntry(selectedRentalContrat); contratEntry.ShowDialog(); var dialogueResult = contratEntry.DialogResult; if (dialogueResult != null && (bool)dialogueResult) { var conId = Convert.ToInt32(contratEntry.TxtId.Text); SelectedRentalContrat = new RentalContratService(true).GetAll().FirstOrDefault(c => c.Id == conId); return(true); } return(false); }
public string Validate(RentalContratDTO rentalContrat) { if (null == rentalContrat)// || rentalContrat.Room == null || rentalContrat.Rentee == null) { return(GenericMessages.ObjectIsNull); } //if (String.IsNullOrEmpty(rentalContrat.RentalContratNumber)) // return rentalContrat.RentalContratNumber + " " + GenericMessages.StringIsNullOrEmpty; //if (rentalContrat.RentalContratNumber.Length > 50) // return rentalContrat.RentalContratNumber + " can not be more than 50 characters "; //if (rentalContrat.RentalFee<=0) // return rentalContrat.RentalContratNumber + " fee can not be less than 0"; return(string.Empty); }
public string Disable(RentalContratDTO rentalContrat) { if (rentalContrat == null) { return(GenericMessages.ObjectIsNull); } string stat; try { _rentalContratRepository.Update(rentalContrat); _unitOfWork.Commit(); stat = string.Empty; } catch (Exception exception) { stat = exception.Message; } return(stat); }
public bool ObjectExists(RentalContratDTO rentalContrat) { var objectExists = false; //var iDbContext = DbContextUtil.GetDbContextInstance(); //try //{ // var catRepository = new Repository<RentalContratDTO>(iDbContext); // var catExists = catRepository.Query().Filter(bp => bp.RentalContratNumber == rentalContrat.RentalContratNumber && bp.Id != rentalContrat.Id) // .Get() // .FirstOrDefault(); // if (catExists != null) // objectExists = true; //} //finally //{ // iDbContext.Dispose(); //} return(objectExists); }