Ejemplo n.º 1
0
        public virtual GiftCardStore UpdateGiftCardStore(GiftCardStore entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            GiftCardStore other = GetGiftCardStore(entity.GiftCardId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update GiftCardStore set  [ID]=@ID
							, [StoreID]=@StoreID
							, [CreatedOn]=@CreatedOn 
							 where GiftCardID=@GiftCardID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@GiftCardID", entity.GiftCardId)
                , new SqlParameter("@ID", entity.Id)
                , new SqlParameter("@StoreID", entity.StoreId)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetGiftCardStore(entity.GiftCardId));
        }
Ejemplo n.º 2
0
        public virtual GiftCardStore InsertGiftCardStore(GiftCardStore entity)
        {
            GiftCardStore other = new GiftCardStore();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into GiftCardStore ( [GiftCardID]
				,[ID]
				,[StoreID]
				,[CreatedOn] )
				Values
				( @GiftCardID
				, @ID
				, @StoreID
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@GiftCardID", entity.GiftCardId)
                    , new SqlParameter("@ID", entity.Id)
                    , new SqlParameter("@StoreID", entity.StoreId)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetGiftCardStore(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Ejemplo n.º 3
0
        public virtual GiftCardStore GiftCardStoreFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            GiftCardStore entity = new GiftCardStore();

            entity.Id         = (System.Int32)dr["ID"];
            entity.GiftCardId = (System.Int32)dr["GiftCardID"];
            entity.StoreId    = (System.Int32)dr["StoreID"];
            entity.CreatedOn  = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
Ejemplo n.º 4
0
 public virtual GiftCardStore DeleteGiftCardStore(GiftCardStore entity)
 {
     this.DeleteGiftCardStore(entity.GiftCardId);
     return(entity);
 }
Ejemplo n.º 5
0
 public GiftCardStore InsertGiftCardStore(GiftCardStore entity)
 {
     return(_iGiftCardStoreRepository.InsertGiftCardStore(entity));
 }
Ejemplo n.º 6
0
 public GiftCardStore UpdateGiftCardStore(GiftCardStore entity)
 {
     return(_iGiftCardStoreRepository.UpdateGiftCardStore(entity));
 }