Пример #1
0
        public int AddEnergySource(EnergySourceDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(EnergySourceDTO.FormatEnergySourceDTO(dto));

                R_EnergySource t = EnergySourceDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddEnergySource(t);
                dto.EnergySourceId = id;

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

                throw;
            }

            return(id);
        }
Пример #2
0
        public void DeleteEnergySource(EnergySourceDTO dto)
        {
            try
            {
                log.Debug(EnergySourceDTO.FormatEnergySourceDTO(dto));

                R_EnergySource t = EnergySourceDTO.ConvertDTOtoEntity(dto);

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

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

                throw;
            }
        }
Пример #3
0
        public void UpdateEnergySource(EnergySourceDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "EnergySourceId");

                log.Debug(EnergySourceDTO.FormatEnergySourceDTO(dto));

                R_EnergySource t = EnergySourceDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateEnergySource(t);

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

                throw;
            }
        }