All pastes #201453 Raw Edit

Someone

public text v1 · immutable
#201453 ·published 2006-10-13 20:57 UTC
rendered paste body
<%
	on error resume next
	
	if isempty(request("idPhoto")) then
		response.redirect "viewAllPhotos.asp?error="& escape("ERROR: You must select a photo before adding a pricing option.")
		response.end
	end if
%>
<!-- #include file="inc/serv/db.asp"-->
<%
	dim proc, rs, idPricing, idPhoto
	dim name, size, price, resin_price, description, make_offer, offer_limit, is_active, in_stock
	dim status_msg, title, hierarchy(4, 2)
	
	status_msg = ""
	
	title = "Create Pricing Option"
	
	hierarchy(0, 0) = "Home"
	hierarchy(0, 1) = "home.asp"
	
	hierarchy(1, 0) = "Inventory Management"
	hierarchy(1, 2) = "inventoryOverview.asp"
	
	hierarchy(2, 0) = "Photographs"
	hierarchy(2, 1) = "viewAllPhotos.asp"
	
	hierarchy(3, 0) = "Add Pricing Option"
	hierarchy(3, 1) = "createPricing.asp"
	
	idPhoto = cLng(request("idPhoto"))
	
	set adoProc = server.createObject("ADODB.Command")
	
	if not isempty(request.form("btnInsertPricing")) then
		proc = run_proc_return(adoProc, "sp_insertPricing", adExecuteNoRecords, idPricing, adInteger)
		
		if proc = true then
			status_msg = status_msg &"<p class=""success"">Successfully Inserted Pricing Option ID # "& idPricing &"</p><br />"
		else
			status_msg = status_msg &"<p class=""error"">ERROR: Could not insert pricing option.<br />"& proc &"</p><br />"
			
			name = request.form("name")
			size = request.form("size")
			price = request.form("price")
			resin_price = request.form("resin_price")
			description = request.form("description")
			make_offer = request.form("make_offer")
			offer_limit = request.form("offer_limit")
			is_active = request.form("is_active")
			in_stock = request.form("in_stock")
		end if
	end if
	
	proc = run_proc(adoProc, "sp_getPhotograph", 0, rs)
	
	if proc <> true then
		status_msg = status_msg &"<p class=""error"">ERROR: Could not retrieve photograph info.<br />"& proc &"</p><br />"
	end if
	
	set adoProc = nothing
%>
<!-- #include file="doc.asp"-->
<!-- #include file="hierarchy.asp"-->

<h1 id="title">add pricing option</h1>

<form action="createPricing.asp" method="post" name="frmPricing">
<table cellspacing="2" cellpadding="0" border="0" class="form">
	<% if status_msg <> "" then %>
		<tr>
			<td colspan="2" class="status">
				<%= left(status_msg, len(status_msg) - 12)%>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="rowspace" />
		</tr>
	<% end if %>
	<tr>
		<th>photograph</th>
		<td class="text"><%= rs("title")%></td>
	</tr>
	<tr>
		<td colspan="2" class="rowspace" />
	</tr>
	<tr>
		<th>pricing name</th>
		<td><input type="text" name="name" <%
			if not isempty(name) then
				response.write " value="""& replace(name, """", "&quot;") &""" "
			end if
		%> maxlength="150" /></td>
	</tr>
	<tr>
		<th>photo size</th>
		<td><input type="text" name="size" <%
			if not isempty(size) then
				response.write " value="""& replace(size, """", "&quot;") &""" "
			end if
		%> maxlength="150" /></td>
	</tr>
	<tr>
		<td colspan="2" class="rowspace" />
	</tr>
	<tr>
		<th>price</th>
		<td><input type="text" name="price" <%
			if not isempty(price) then
				response.write " value="""& replace(price, """", "&quot;") &""" "
			end if
		%> maxlength="8" /></td>
	</tr>
	<tr>
		<th>resin price</th>
		<td><input type="text" name="resin_price" <%
			if not isempty(resin_price) then
				response.write " value="""& replace(resin_price, """", "&quot;") &""" "
			end if
		%> maxlength="8" /></td>
	</tr>
	<tr>
		<td colspan="2" class="rowspace" />
	</tr>
	<tr>
		<th colspan="2" class="textarea_title">description</th>
	</tr>
	<tr>
		<td colspan="2" class="textarea">
			<textarea name="description"><%
				if not isempty(description) then
					response.write description
				end if
			%></textarea>
		</td>
	</tr>
	<tr>
		<td colspan="2" class="rowspace" />
	</tr>
	<tr>
		<th>offer limit</th>
		<td><input type="text" name="offer_limit" <%
			if not isempty(offer_limit) then
				response.write " value="""& replace(offer_limit, """", "&quot;") &""" "
			end if
		%> maxlength="8" /></td>
	</tr>
	<tr>
		<td colspan="2" class="rowspace" />
	</tr>
	<tr>
		<td colspan="2" class="form_controls">
			<input type="hidden" name="is_active"<%
				if not isempty(is_active) then
					response.write " value="""& is_active &""" "
				end if
			%>/>
			<input id="disable" type="checkbox" name="disable" value="1"<%
				if not isempty(is_active) and is_active = "0" then
					response.write " checked=""checked"""
				end if
			%> class="chk" onclick="this.form.is_active.value = (this.checked) ? 0 : 1;" />
			<label for="disable">disable this pricing option</label>
			
			&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="hidden" name="in_stock"<%
				if not isempty(in_stock) then
					response.write " value="""& in_stock &""" "
				end if
			%>/>
			<input id="stock" type="checkbox" name="stock" value="1"<%
				if isempty(in_stock) or in_stock = "1" then
					response.write " checked=""checked"""
				end if
			%> class="chk" onclick="this.form.in_stock.value = (this.checked) ? 1 : 0;" />
			<label for="stock">in stock</label>
			
			&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="hidden" name="make_offer"<%
				if not isempty(make_offer) then
					response.write " value="""& make_offer &""" "
				end if
			%>/>
			<input id="offer" type="checkbox" name="offer" value="1"<%
				if not isempty(make_offer) and make_offer = "1" then
					response.write " checked=""checked"""
				end if
			%> class="chk" onclick="this.form.make_offer.value = (this.checked) ? 1 : 0;" />
			<label for="offer">make an offer enabled</label>
		</td>
	</tr>
	<tr>
		<td colspan="2" class="rowspace" />
	</tr>
	<tr>
		<td colspan="2" class="form_controls">
			<input type="hidden" name="idPhoto" value="<%= idPhoto%>" />
			<input type="submit" name="btnInsertPricing" value="Add Pricing Option" class="submit" />
		</td>
	</tr>
</table>
</form>

<!-- #include file="bottom.asp"-->