예제 #1
0
        public int AddBeneficiary(BeneficiaryDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(BeneficiaryDTO.FormatBeneficiaryDTO(dto));

                R_Beneficiary t = BeneficiaryDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddBeneficiary(t);
                dto.BeneficiaryId = id;

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

                throw;
            }

            return(id);
        }
예제 #2
0
        public void DeleteBeneficiary(BeneficiaryDTO dto)
        {
            try
            {
                log.Debug(BeneficiaryDTO.FormatBeneficiaryDTO(dto));

                R_Beneficiary t = BeneficiaryDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteBeneficiary(t);
                dto.IsDeleted = t.IsDeleted;

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

                throw;
            }
        }
예제 #3
0
        public void UpdateBeneficiary(BeneficiaryDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "BeneficiaryId");

                log.Debug(BeneficiaryDTO.FormatBeneficiaryDTO(dto));

                R_Beneficiary t = BeneficiaryDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateBeneficiary(t);

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

                throw;
            }
        }