public Models.TeacherEvaluation.StudentPaymentModel GetStudentPaymentByID(int StudentPaymentID) { BusinessLogic.StudentPayment.StudentPaymentManager StudentPaymentManager = new BusinessLogic.StudentPayment.StudentPaymentManager(); BusinessEntity.TeacherEvaluation.StudentPaymentEntity StudentPayment = StudentPaymentManager.GetStudentPaymentByID(StudentPaymentID); return(new Models.TeacherEvaluation.StudentPaymentModel(StudentPayment)); }
public BusinessEntity.Result DeleteStudentPayment(BusinessEntity.TeacherEvaluation.StudentPaymentEntity StudentPayment) { BusinessEntity.Result result = new BusinessEntity.Result(); try { SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities(); var original = e.tblStudentPayments.Find(StudentPayment.ID); if (original != null) { e.tblStudentPayments.Remove(e.tblStudentPayments.Where(x => x.ID == StudentPayment.ID).First()); e.SaveChanges(); result.Message = "Deleted Successfully."; result.Status = true; return(result); } else { result.Message = "Failed to delete"; result.Status = false; return(result); } } catch (Exception) { result.Message = "Failed to delete"; result.Status = false; return(result); } }
public BusinessEntity.Result UpdateStudentPayment(BusinessEntity.TeacherEvaluation.StudentPaymentEntity StudentPayment) { BusinessEntity.Result result = new BusinessEntity.Result(); try { SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities(); var original = e.tblStudentPayments.Find(StudentPayment.ID); if (original != null) { e.Entry(original).CurrentValues.SetValues(StudentPayment); e.SaveChanges(); result.Message = "Updated Successfully."; result.Status = true; return(result); } else { result.Message = "Failed to update"; result.Status = false; return(result); } } catch (Exception) { result.Message = "Failed to update"; result.Status = false; return(result); } }
public StudentPaymentModel(BusinessEntity.TeacherEvaluation.StudentPaymentEntity StudentPayment) { this.ID = StudentPayment.ID; this.RecieptNumber = StudentPayment.RecieptNumber; this.CashierName = StudentPayment.CashierName; this.PaidBy = StudentPayment.PaidBy; this.IsFullyPaid = StudentPayment.IsFullyPaid; this.PaymentPeriod = new PaymentPeriodModel(StudentPayment.PaymentPeriod); this.PaymentReason = new PaymentReasonModel(StudentPayment.PaymentReason); this.Student = new StudentModel(StudentPayment.Student); this.CreatedBy = StudentPayment.CreatedBy; this.CreatedDate = StudentPayment.CreatedDate; this.UpdatedBy = StudentPayment.UpdatedBy; this.UpdatedDate = StudentPayment.UpdatedDate; }
public BusinessEntity.Result SaveStudentPayment(BusinessEntity.TeacherEvaluation.StudentPaymentEntity StudentPayment) { BusinessEntity.Result result = new BusinessEntity.Result(); try { SchoolInformationManagementSystemDBEntities e = new SchoolInformationManagementSystemDBEntities(); e.tblStudentPayments.Add(StudentPayment.MapToModel <DataAccessLogic.tblStudentPayment>()); e.SaveChanges(); result.Message = "Saved Successfully."; result.Status = true; return(result); } catch (Exception) { result.Message = "Failed to save"; result.Status = false; return(result); } }
public T MapToEntity <T>() where T : class { BusinessEntity.TeacherEvaluation.StudentPaymentEntity StudentPayment = new BusinessEntity.TeacherEvaluation.StudentPaymentEntity(); StudentPayment.ID = this.ID; StudentPayment.RecieptNumber = this.RecieptNumber; StudentPayment.CashierName = this.CashierName; StudentPayment.PaidBy = this.PaidBy; StudentPayment.IsFullyPaid = this.IsFullyPaid; StudentPayment.PaymentPeriod = this.PaymentPeriod.MapToEntity <BusinessEntity.Lookup.PaymentPeriodEntity>(); StudentPayment.PaymentReason = this.PaymentReason.MapToEntity <BusinessEntity.Lookup.PaymentReasonEntity>(); StudentPayment.Student = this.Student.MapToEntity <BusinessEntity.Admission.StudentEntity>(); StudentPayment.CreatedBy = this.CreatedBy; StudentPayment.CreatedDate = this.CreatedDate; StudentPayment.UpdatedBy = this.UpdatedBy; StudentPayment.UpdatedDate = this.UpdatedDate; return(StudentPayment as T); }