Exemplo n.º 1
0
        public int AddSupplierType(SupplierTypeDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(SupplierTypeDTO.FormatSupplierTypeDTO(dto));

                R_SupplierType t = SupplierTypeDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddSupplierType(t);
                dto.SupplierTypeId = id;

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

                throw;
            }

            return(id);
        }
Exemplo n.º 2
0
        public void DeleteSupplierType(SupplierTypeDTO dto)
        {
            try
            {
                log.Debug(SupplierTypeDTO.FormatSupplierTypeDTO(dto));

                R_SupplierType t = SupplierTypeDTO.ConvertDTOtoEntity(dto);

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

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

                throw;
            }
        }
Exemplo n.º 3
0
        public void UpdateSupplierType(SupplierTypeDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "SupplierTypeId");

                log.Debug(SupplierTypeDTO.FormatSupplierTypeDTO(dto));

                R_SupplierType t = SupplierTypeDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateSupplierType(t);

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

                throw;
            }
        }