Exemple #1
0
        public BenificiaryMemberDTO GetBenificiaryMember(int benificiaryMemberId)
        {
            try
            {
                //Requires.NotNegative("benificiaryMemberId", benificiaryMemberId);

                log.Debug("benificiaryMemberId: " + benificiaryMemberId + " ");

                // get
                R_BenificiaryMember t = Repository.GetBenificiaryMember(benificiaryMemberId);

                BenificiaryMemberDTO dto = new BenificiaryMemberDTO(t);

                log.Debug(BenificiaryMemberDTO.FormatBenificiaryMemberDTO(dto));

                return(dto);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemple #2
0
        public int AddBenificiaryMember(BenificiaryMemberDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(BenificiaryMemberDTO.FormatBenificiaryMemberDTO(dto));

                R_BenificiaryMember t = BenificiaryMemberDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddBenificiaryMember(t);

                log.Debug("result: 'success', id: " + id);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }

            return(id);
        }
Exemple #3
0
        private BenificiaryMemberDTO Update(BenificiaryMemberViewModel viewModel)
        {
            try
            {
                log.Debug(BenificiaryMemberViewModel.FormatBenificiaryMemberViewModel(viewModel));

                // get
                log.Debug("_benificiaryMemberService.GetBenificiaryMember - benificiaryMemberId: " + viewModel.BenificiaryMemberId + " ");

                var existingBenificiaryMember = _benificiaryMemberService.GetBenificiaryMember(viewModel.BenificiaryMemberId);

                log.Debug("_benificiaryMemberService.GetBenificiaryMember - " + BenificiaryMemberDTO.FormatBenificiaryMemberDTO(existingBenificiaryMember));

                if (existingBenificiaryMember != null)
                {
                    // copy values
                    existingBenificiaryMember.BenificiaryId = viewModel.BenificiaryId;
                    existingBenificiaryMember.Name          = viewModel.Name;
                    existingBenificiaryMember.IsChild       = viewModel.IsChild;
                    existingBenificiaryMember.Description   = viewModel.Description;
                    existingBenificiaryMember.BirthDate     = viewModel.BirthDate;
                    existingBenificiaryMember.Active        = viewModel.Active;
                    existingBenificiaryMember.IsDeleted     = viewModel.IsDeleted;

                    // audit
                    //existingBenificiaryMember.UpdateBy = UserInfo.UserID;
                    existingBenificiaryMember.UpdateOn = DateTime.UtcNow;

                    // update
                    log.Debug("_benificiaryMemberService.UpdateBenificiaryMember - " + BenificiaryMemberDTO.FormatBenificiaryMemberDTO(existingBenificiaryMember));

                    _benificiaryMemberService.UpdateBenificiaryMember(existingBenificiaryMember);

                    log.Debug("result: 'success'");
                }
                else
                {
                    log.Error("existingBenificiaryMember: null, BenificiaryMemberId: " + viewModel.BenificiaryMemberId);
                }

                return(existingBenificiaryMember);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemple #4
0
        private BenificiaryMemberDTO Create(BenificiaryMemberViewModel viewModel)
        {
            try
            {
                log.Debug(BenificiaryMemberViewModel.FormatBenificiaryMemberViewModel(viewModel));

                BenificiaryMemberDTO benificiaryMember = new BenificiaryMemberDTO();

                // copy values
                benificiaryMember.BenificiaryMemberId = viewModel.BenificiaryMemberId;
                benificiaryMember.BenificiaryId       = viewModel.BenificiaryId;
                benificiaryMember.Name        = viewModel.Name;
                benificiaryMember.IsChild     = viewModel.IsChild;
                benificiaryMember.Description = viewModel.Description;
                benificiaryMember.BirthDate   = viewModel.BirthDate;
                benificiaryMember.Active      = viewModel.Active;
                benificiaryMember.IsDeleted   = viewModel.IsDeleted;


                // audit
                //benificiaryMember.CreateBy = UserInfo.UserID;
                //benificiaryMember.UpdateBy = UserInfo.UserID;
                benificiaryMember.CreateOn = DateTime.UtcNow;
                benificiaryMember.UpdateOn = DateTime.UtcNow;

                // add
                log.Debug("_benificiaryMemberService.AddBenificiaryMember - " + BenificiaryMemberDTO.FormatBenificiaryMemberDTO(benificiaryMember));

                int id = _benificiaryMemberService.AddBenificiaryMember(benificiaryMember);

                benificiaryMember.BenificiaryMemberId = id;

                log.Debug("result: 'success', id: " + id);

                return(benificiaryMember);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemple #5
0
        public void DeleteBenificiaryMember(BenificiaryMemberDTO dto)
        {
            try
            {
                log.Debug(BenificiaryMemberDTO.FormatBenificiaryMemberDTO(dto));

                R_BenificiaryMember t = BenificiaryMemberDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteBenificiaryMember(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemple #6
0
        public void UpdateBenificiaryMember(BenificiaryMemberDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "BenificiaryMemberId");

                log.Debug(BenificiaryMemberDTO.FormatBenificiaryMemberDTO(dto));

                R_BenificiaryMember t = BenificiaryMemberDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateBenificiaryMember(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }