예제 #1
0
        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);
        }
예제 #2
0
        public void UpdateContributionMonetaryReviewer(R_ContributionMonetaryReviewer t)
        {
            //Requires.NotNull(t);
            //Requires.PropertyNotNegative(t, "ContributionMonetaryReviewerId");

            t.Update();
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        public R_ContributionMonetaryReviewer GetContributionMonetaryReviewer(int contributionMonetaryReviewerId)
        {
            //Requires.NotNegative("contributionMonetaryReviewerId", contributionMonetaryReviewerId);

            R_ContributionMonetaryReviewer t = R_ContributionMonetaryReviewer.SingleOrDefault(contributionMonetaryReviewerId);

            return(t);
        }
예제 #6
0
 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;
 }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        // 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);
        }
예제 #12
0
        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;
            }
        }
예제 #13
0
        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);
        }
예제 #14
0
        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;
            }
        }
예제 #15
0
 public void DeleteContributionMonetaryReviewer(R_ContributionMonetaryReviewer t)
 {
     t.IsDeleted = true;
     t.Update();
 }
예제 #16
0
        public int AddContributionMonetaryReviewer(R_ContributionMonetaryReviewer t)
        {
            int id = (int)t.Insert();

            return(id);
        }