public bool UpdateLoan(string id, int sts) { LoanRepo repo = new LoanRepo(); if (IsReturnLate(id)) { StudentBL stuBl = new StudentBL(); stuBl.UpdatePrice(id); } if (sts == 3) { StudentBL stuBl = new StudentBL(); stuBl.UpdatePriceMissing(id); } else if (IsResourceMissing(id) || sts == 4) { StudentBL stuBl = new StudentBL(); stuBl.UpdatePriceMissing(id); sts = 4; } return(repo.UpdateLoan(id, sts)); }
public bool ReturnTransaction(string studentId, int resourceId, DateTime returnDate, int loanStatus) { //OverDue(loanId,studentId,resourceId,returnDate); LoanRepo repo = new LoanRepo(); return(repo.Return(studentId, resourceId, returnDate, loanStatus)); }
private void OverDueIsGreaterThanFive() { LoanRepo repo = new LoanRepo(); if (repo.CalculateDate(l.StudentId, l.ResourceId) > 0 && repo.CalculateDate(l.StudentId, l.ResourceId) < 5) { l.OverDueCharge += (l.DateReturned - l.DueDate).Days * 5m; l.NonReturnCharge += r.PurchasePrice; } }
private void OverDueIsZero() { LoanRepo repo = new LoanRepo(); if (repo.CalculateDate(l.StudentId, l.ResourceId) < 0) { l.OverDueCharge = 0; l.NonReturnCharge = 0; } }
private bool IsReturnLate(string id) { LoanRepo repo = new LoanRepo(); if (repo.CheckIfReturnIsLate(id) > 0) { Errors.Add(new ValidationError("This student is returning this resource late and will be charged for it")); return(true); } return(false); }
private bool IsResourceUnavailable(string id) { LoanRepo repo = new LoanRepo(); if (repo.CheckIfResourceUnavailable(id) > 0) { Errors.Add(new ValidationError("This resource is no longer in the library.")); return(true); } return(false); }
private bool Check_SameType(string studendId, int resourceType) { LoanRepo repo = new LoanRepo(); if (repo.Check_SameType(studendId, resourceType) > 0) { Errors.Add(new ValidationError("This Student has already borrowed same type item in the loan ")); return(false); } return(true); }
public bool ResourceTransaction(DateTime checkoutDate, DateTime dueDate) { LoanRepo repo = new LoanRepo(); Validation(); if (Errors.Count == 0) { return(repo.Transaction(s.StudentId, r.ResourceId, checkoutDate, dueDate)); } return(false); }
private bool IsResourceMissing(string id) { LoanRepo repo = new LoanRepo(); if (repo.CheckIfReturnIsMissing(id) > 0) { Errors.RemoveAt(0); Errors.Add(new ValidationError("This resource is missing for 10 days and will be concidered lost, resource price will be charged to student")); return(true); } return(false); }
private bool Check_Reservation() { if (r.IsReserved == true && (int)r.ResourceStatus == 0) { LoanRepo repo = new LoanRepo(); if (s == null || !repo.Check_Reservation(s.StudentId, r.ResourceId)) { Errors.Add(new ValidationError("This is not the student who has reserved this item")); return(false); } } return(true); }
CreateLoan(Loan loan, Resource re) { _lo = loan; LoanRepo repo = new LoanRepo(); Validate(_lo, re); if (Errors.Count == 0) { return(repo.AddLoan(loan)); } return(false); }
public List <Loan> GetLoan(string id = "") { LoanRepo repo = new LoanRepo(); return(repo.RetrieveByLoanByStudentId(id)); }