public void GetContributionMonetaryReviewers_Success_Test() { // Arrange R_ContributionMonetaryReviewer contributionMonetaryReviewer = SampleContributionMonetaryReviewer(1); IList <R_ContributionMonetaryReviewer> list = new List <R_ContributionMonetaryReviewer>(); list.Add(contributionMonetaryReviewer); // create mock for repository var mock = new Mock <IContributionMonetaryReviewerRepository>(); mock.Setup(s => s.GetContributionMonetaryReviewers()).Returns(list); // service ContributionMonetaryReviewerService contributionMonetaryReviewerService = new ContributionMonetaryReviewerService(); ContributionMonetaryReviewerService.Repository = mock.Object; // Act var resultList = contributionMonetaryReviewerService.GetContributionMonetaryReviewers(); ContributionMonetaryReviewerDTO result = resultList.FirstOrDefault(); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.ContributionMonetaryReviewerId); }
public void UpdateContributionMonetaryReviewer(R_ContributionMonetaryReviewer t) { //Requires.NotNull(t); //Requires.PropertyNotNegative(t, "ContributionMonetaryReviewerId"); t.Update(); }
public ContributionMonetaryReviewerDTO GetContributionMonetaryReviewer(int contributionMonetaryReviewerId) { try { //Requires.NotNegative("contributionMonetaryReviewerId", contributionMonetaryReviewerId); log.Debug("contributionMonetaryReviewerId: " + contributionMonetaryReviewerId + " "); // get R_ContributionMonetaryReviewer t = Repository.GetContributionMonetaryReviewer(contributionMonetaryReviewerId); ContributionMonetaryReviewerDTO dto = new ContributionMonetaryReviewerDTO(t); log.Debug(ContributionMonetaryReviewerDTO.FormatContributionMonetaryReviewerDTO(dto)); return(dto); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public int AddContributionMonetaryReviewer(ContributionMonetaryReviewerDTO dto) { int id = 0; try { log.Debug(ContributionMonetaryReviewerDTO.FormatContributionMonetaryReviewerDTO(dto)); R_ContributionMonetaryReviewer t = ContributionMonetaryReviewerDTO.ConvertDTOtoEntity(dto); // add id = Repository.AddContributionMonetaryReviewer(t); dto.ContributionMonetaryReviewerId = id; log.Debug("result: 'success', id: " + id); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } return(id); }
public R_ContributionMonetaryReviewer GetContributionMonetaryReviewer(int contributionMonetaryReviewerId) { //Requires.NotNegative("contributionMonetaryReviewerId", contributionMonetaryReviewerId); R_ContributionMonetaryReviewer t = R_ContributionMonetaryReviewer.SingleOrDefault(contributionMonetaryReviewerId); return(t); }
public ContributionMonetaryReviewerDTO(R_ContributionMonetaryReviewer contributionMonetaryReviewer) { ContributionMonetaryReviewerId = contributionMonetaryReviewer.ContributionMonetaryReviewerId; VolunteerId = contributionMonetaryReviewer.VolunteerId; IsDeleted = contributionMonetaryReviewer.IsDeleted; CreateBy = contributionMonetaryReviewer.CreateBy; CreateOn = contributionMonetaryReviewer.CreateOn; UpdateBy = contributionMonetaryReviewer.UpdateBy; UpdateOn = contributionMonetaryReviewer.UpdateOn; }
public IList <R_ContributionMonetaryReviewer> GetContributionMonetaryReviewers(string searchTerm, int pageIndex, int pageSize) { IList <R_ContributionMonetaryReviewer> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_ContributionMonetaryReviewer") .Where("IsDeleted = 0") ; results = R_ContributionMonetaryReviewer.Fetch(pageIndex, pageSize, sql); return(results); }
public static R_ContributionMonetaryReviewer ConvertDTOtoEntity(ContributionMonetaryReviewerDTO dto) { R_ContributionMonetaryReviewer contributionMonetaryReviewer = new R_ContributionMonetaryReviewer(); contributionMonetaryReviewer.ContributionMonetaryReviewerId = dto.ContributionMonetaryReviewerId; contributionMonetaryReviewer.VolunteerId = dto.VolunteerId; contributionMonetaryReviewer.IsDeleted = dto.IsDeleted; contributionMonetaryReviewer.CreateBy = dto.CreateBy; contributionMonetaryReviewer.CreateOn = dto.CreateOn; contributionMonetaryReviewer.UpdateBy = dto.UpdateBy; contributionMonetaryReviewer.UpdateOn = dto.UpdateOn; return(contributionMonetaryReviewer); }
public IEnumerable <R_ContributionMonetaryReviewer> GetContributionMonetaryReviewers() { IEnumerable <R_ContributionMonetaryReviewer> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_ContributionMonetaryReviewer") .Where("IsDeleted = 0") ; results = R_ContributionMonetaryReviewer.Query(sql); return(results); }
public IEnumerable <R_ContributionMonetaryReviewer> GetContributionMonetaryReviewerListAdvancedSearch( int?volunteerId ) { IEnumerable <R_ContributionMonetaryReviewer> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_ContributionMonetaryReviewer") .Where("IsDeleted = 0" + (volunteerId != null ? " and VolunteerId like '%" + volunteerId + "%'" : "") ) ; results = R_ContributionMonetaryReviewer.Query(sql); return(results); }
// example data public static R_ContributionMonetaryReviewer SampleContributionMonetaryReviewer(int id = 1) { R_ContributionMonetaryReviewer contributionMonetaryReviewer = new R_ContributionMonetaryReviewer(); // int contributionMonetaryReviewer.ContributionMonetaryReviewerId = id; // int? contributionMonetaryReviewer.VolunteerId = 1; // bool contributionMonetaryReviewer.IsDeleted = false; // int? contributionMonetaryReviewer.CreateBy = 1; // System.DateTime? contributionMonetaryReviewer.CreateOn = new System.DateTime(); // int? contributionMonetaryReviewer.UpdateBy = 1; // System.DateTime? contributionMonetaryReviewer.UpdateOn = new System.DateTime(); return(contributionMonetaryReviewer); }
public void DeleteContributionMonetaryReviewer(ContributionMonetaryReviewerDTO dto) { try { log.Debug(ContributionMonetaryReviewerDTO.FormatContributionMonetaryReviewerDTO(dto)); R_ContributionMonetaryReviewer t = ContributionMonetaryReviewerDTO.ConvertDTOtoEntity(dto); // delete Repository.DeleteContributionMonetaryReviewer(t); dto.IsDeleted = t.IsDeleted; log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public void GetContributionMonetaryReviewer_Success_Test() { // Arrange int id = 1; R_ContributionMonetaryReviewer contributionMonetaryReviewer = SampleContributionMonetaryReviewer(id); // create mock for repository var mock = new Mock <IContributionMonetaryReviewerRepository>(); mock.Setup(s => s.GetContributionMonetaryReviewer(Moq.It.IsAny <int>())).Returns(contributionMonetaryReviewer); // service ContributionMonetaryReviewerService contributionMonetaryReviewerService = new ContributionMonetaryReviewerService(); ContributionMonetaryReviewerService.Repository = mock.Object; // Act ContributionMonetaryReviewerDTO result = contributionMonetaryReviewerService.GetContributionMonetaryReviewer(id); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.ContributionMonetaryReviewerId); }
public void UpdateContributionMonetaryReviewer(ContributionMonetaryReviewerDTO dto) { try { //Requires.NotNull(t); //Requires.PropertyNotNegative(t, "ContributionMonetaryReviewerId"); log.Debug(ContributionMonetaryReviewerDTO.FormatContributionMonetaryReviewerDTO(dto)); R_ContributionMonetaryReviewer t = ContributionMonetaryReviewerDTO.ConvertDTOtoEntity(dto); // update Repository.UpdateContributionMonetaryReviewer(t); log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public void DeleteContributionMonetaryReviewer(R_ContributionMonetaryReviewer t) { t.IsDeleted = true; t.Update(); }
public int AddContributionMonetaryReviewer(R_ContributionMonetaryReviewer t) { int id = (int)t.Insert(); return(id); }