public bool Delete(int id)
 {
     using (UnitOfWork unitOfWork = new UnitOfWork())
     {
         SuppliersEntity res = unitOfWork.SuppliersRepository.GetById(id);
         if (res == null)
         {
             return(false);
         }
         unitOfWork.SuppliersRepository.Delete(res);
         return(unitOfWork.Save());
     }
 }
Beispiel #2
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         SuppliersEntity _SuppliersEntity = new SuppliersEntity(Id);
         if (adapter.FetchEntity(_SuppliersEntity))
         {
             adapter.DeleteEntity(_SuppliersEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Beispiel #3
0
        public bool Update(Guid Id, string SupplierCode, string SupplierName, string SupplierTypeId, bool IsVisible, int SortOrder, string PositionId)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                SuppliersEntity _SuppliersEntity = new SuppliersEntity(Id);
                if (adapter.FetchEntity(_SuppliersEntity))
                {

                    _SuppliersEntity.SupplierCode = SupplierCode;
                    _SuppliersEntity.SupplierName = SupplierName;
                    _SuppliersEntity.SupplierTypeId = SupplierTypeId;
                    _SuppliersEntity.IsVisible = IsVisible;
                    _SuppliersEntity.SortOrder = SortOrder;
                    _SuppliersEntity.PositionId = PositionId;
                    adapter.SaveEntity(_SuppliersEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Beispiel #4
0
 public bool Update(SuppliersEntity _SuppliersEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_SuppliersEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Beispiel #5
0
        public bool Update(SuppliersEntity _SuppliersEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(SuppliersFields.Id == _SuppliersEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_SuppliersEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Beispiel #6
0
 public SuppliersEntity SelectOne(Guid Id)
 {
     SuppliersEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         SuppliersEntity _SuppliersEntity = new SuppliersEntity(Id);
         if (adapter.FetchEntity(_SuppliersEntity))
         {
             toReturn = _SuppliersEntity;
         }
     }
     return toReturn;
 }
Beispiel #7
0
        public SuppliersEntity Insert(string SupplierCode, string SupplierName, string SupplierTypeId, bool IsVisible, int SortOrder, string PositionId)
        {
            SuppliersEntity _SuppliersEntity = new SuppliersEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _SuppliersEntity.SupplierCode = SupplierCode;
                _SuppliersEntity.SupplierName = SupplierName;
                _SuppliersEntity.SupplierTypeId = SupplierTypeId;
                _SuppliersEntity.IsVisible = IsVisible;
                _SuppliersEntity.SortOrder = SortOrder;
                _SuppliersEntity.PositionId = PositionId;
                adapter.SaveEntity(_SuppliersEntity, true);
            }
            return _SuppliersEntity;
        }
Beispiel #8
0
 public SuppliersEntity Insert(SuppliersEntity _SuppliersEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_SuppliersEntity, true);
     }
     return _SuppliersEntity;
 }