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)); }
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); }
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); }
public virtual GiftCardStore DeleteGiftCardStore(GiftCardStore entity) { this.DeleteGiftCardStore(entity.GiftCardId); return(entity); }
public GiftCardStore InsertGiftCardStore(GiftCardStore entity) { return(_iGiftCardStoreRepository.InsertGiftCardStore(entity)); }
public GiftCardStore UpdateGiftCardStore(GiftCardStore entity) { return(_iGiftCardStoreRepository.UpdateGiftCardStore(entity)); }