Beispiel #1
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         ProductPhotosEntity _ProductPhotosEntity = new ProductPhotosEntity(Id);
         if (adapter.FetchEntity(_ProductPhotosEntity))
         {
             adapter.DeleteEntity(_ProductPhotosEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Beispiel #2
0
 ProductPhotosEntity getPhoto()
 {
     ProductPhotosEntity photo = new ProductPhotosEntity();
     photo.Id = Guid.NewGuid();
     photo.ProductId = ProductId;
     photo.PhotoName = Filter.GetMaxString(txtPhotoName.Text.Trim(), ProductPhotosFields.PhotoName.MaxLength);
     if (uploadPhoto.HasFile)
         photo.Path = FileUploadControl.FullPath(uploadPhoto, photo.PhotoName, ProductPhotosFields.Path.MaxLength, EnumsFile.Catalogs);
     else
         photo.Path = "";
     return photo;
 }
Beispiel #3
0
        public bool Update(Guid Id, Guid ProductId, string PhotoName, string Path, bool IsVisible)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                ProductPhotosEntity _ProductPhotosEntity = new ProductPhotosEntity(Id);
                if (adapter.FetchEntity(_ProductPhotosEntity))
                {

                    _ProductPhotosEntity.ProductId = ProductId;
                    _ProductPhotosEntity.PhotoName = PhotoName;
                    _ProductPhotosEntity.Path = Path;
                    _ProductPhotosEntity.IsVisible = IsVisible;
                    adapter.SaveEntity(_ProductPhotosEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Beispiel #4
0
 public bool Update(ProductPhotosEntity _ProductPhotosEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_ProductPhotosEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Beispiel #5
0
        public bool Update(ProductPhotosEntity _ProductPhotosEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(ProductPhotosFields.Id == _ProductPhotosEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_ProductPhotosEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Beispiel #6
0
 public ProductPhotosEntity SelectOne(Guid Id)
 {
     ProductPhotosEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         ProductPhotosEntity _ProductPhotosEntity = new ProductPhotosEntity(Id);
         if (adapter.FetchEntity(_ProductPhotosEntity))
         {
             toReturn = _ProductPhotosEntity;
         }
     }
     return toReturn;
 }
Beispiel #7
0
        public ProductPhotosEntity Insert(Guid ProductId, string PhotoName, string Path, bool IsVisible)
        {
            ProductPhotosEntity _ProductPhotosEntity = new ProductPhotosEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _ProductPhotosEntity.ProductId = ProductId;
                _ProductPhotosEntity.PhotoName = PhotoName;
                _ProductPhotosEntity.Path = Path;
                _ProductPhotosEntity.IsVisible = IsVisible;
                adapter.SaveEntity(_ProductPhotosEntity, true);
            }
            return _ProductPhotosEntity;
        }
Beispiel #8
0
 public ProductPhotosEntity Insert(ProductPhotosEntity _ProductPhotosEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_ProductPhotosEntity, true);
     }
     return _ProductPhotosEntity;
 }