Exemplo n.º 1
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         AdvertsEntity _AdvertsEntity = new AdvertsEntity(Id);
         if (adapter.FetchEntity(_AdvertsEntity))
         {
             adapter.DeleteEntity(_AdvertsEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Exemplo n.º 2
0
 public AdvertsEntity Insert(AdvertsEntity _AdvertsEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_AdvertsEntity, true);
     }
     return _AdvertsEntity;
 }
Exemplo n.º 3
0
        public AdvertsEntity Insert(string AdvertName, DateTime BeginDate, DateTime EndDate, bool IsVisible, string Path, string AddressUrl, int Width, int Height, string Type, DateTime CreatedDate, string CreatedBy, DateTime UpdatedDate, string UpdatedBy)
        {
            AdvertsEntity _AdvertsEntity = new AdvertsEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _AdvertsEntity.AdvertName = AdvertName;
                _AdvertsEntity.BeginDate = BeginDate;
                _AdvertsEntity.EndDate = EndDate;
                _AdvertsEntity.IsVisible = IsVisible;
                _AdvertsEntity.Path = Path;
                _AdvertsEntity.AddressUrl = AddressUrl;
                _AdvertsEntity.Width = Width;
                _AdvertsEntity.Height = Height;
                _AdvertsEntity.Type = Type;
                _AdvertsEntity.CreatedDate = CreatedDate;
                _AdvertsEntity.CreatedBy = CreatedBy;
                _AdvertsEntity.UpdatedDate = UpdatedDate;
                _AdvertsEntity.UpdatedBy = UpdatedBy;
                adapter.SaveEntity(_AdvertsEntity, true);
            }
            return _AdvertsEntity;
        }
Exemplo n.º 4
0
        public bool Update(Guid Id, string AdvertName, DateTime BeginDate, DateTime EndDate, bool IsVisible, string Path, string AddressUrl, int Width, int Height, string Type, DateTime CreatedDate, string CreatedBy, DateTime UpdatedDate, string UpdatedBy)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                AdvertsEntity _AdvertsEntity = new AdvertsEntity(Id);
                if (adapter.FetchEntity(_AdvertsEntity))
                {

                    _AdvertsEntity.AdvertName = AdvertName;
                    _AdvertsEntity.BeginDate = BeginDate;
                    _AdvertsEntity.EndDate = EndDate;
                    _AdvertsEntity.IsVisible = IsVisible;
                    _AdvertsEntity.Path = Path;
                    _AdvertsEntity.AddressUrl = AddressUrl;
                    _AdvertsEntity.Width = Width;
                    _AdvertsEntity.Height = Height;
                    _AdvertsEntity.Type = Type;
                    _AdvertsEntity.CreatedDate = CreatedDate;
                    _AdvertsEntity.CreatedBy = CreatedBy;
                    _AdvertsEntity.UpdatedDate = UpdatedDate;
                    _AdvertsEntity.UpdatedBy = UpdatedBy;
                    adapter.SaveEntity(_AdvertsEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Exemplo n.º 5
0
 public bool Update(AdvertsEntity _AdvertsEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_AdvertsEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Exemplo n.º 6
0
        public bool Update(AdvertsEntity _AdvertsEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(AdvertsFields.Id == _AdvertsEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_AdvertsEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Exemplo n.º 7
0
 public AdvertsEntity SelectOne(Guid Id)
 {
     AdvertsEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         AdvertsEntity _AdvertsEntity = new AdvertsEntity(Id);
         if (adapter.FetchEntity(_AdvertsEntity))
         {
             toReturn = _AdvertsEntity;
         }
     }
     return toReturn;
 }
Exemplo n.º 8
0
    AdvertsEntity getAdvert()
    {
        AdvertsEntity advert = new AdvertsEntity();

        advert.Id = Guid.NewGuid();
        advert.AdvertName = Filter.GetMaxString(txtAdvertName.Text, AdvertsFields.AdvertName.MaxLength);
        advert.BeginDate = FDateTime.ConvertDate(txtBeginDate.Text);
        advert.EndDate = FDateTime.ConvertDate(txtEndDate.Text);
        advert.IsVisible = chkIsVisible.Checked;
        advert.AddressUrl = Filter.GetMaxString(txtAddressUrl.Text, AdvertsFields.AddressUrl.MaxLength);
        advert.Type = ddlType.Text;
        advert.UpdatedBy = Util.CurrentUserName;
        advert.UpdatedDate = DateTime.Now;
        int w = 0;
        int h = 0;
        if (int.TryParse(txtWidth.Text.Trim(), out w))
            advert.Width = w;
        if (int.TryParse(txtHeight.Text.Trim(), out h))
            advert.Height = h;
        return advert;
    }