Hello. After applying the 2010.3.1215.35 upgrade, the code below began to throw a javascript error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method. As soon as I reverted to 2010.3.1109.35, the error went away. There is quite a bit of code - mostly in a WebUserControl:
ASPX -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ServiceAdd.aspx.cs" Inherits="AMSOILGarage.ServiceAdd" %>
<%@ Register src="WebControls/wucServiceAdd.ascx" tagname="wucServiceAdd" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MyAMSOILGarage - Add Service Wizard</title>
<link href="Theme/css/main.css" type="text/css" media="screen" rel="stylesheet" />
<link href="Theme/css/wizard.css" type="text/css" media="screen" rel="stylesheet" />
<link href="Theme/css/serviceWizard.css" type="text/css" media="screen" rel="stylesheet" />
<script type="text/javascript" language="javascript">
function getProduct() {
if (navigator.appName == "Microsoft Internet Explorer") {
var cSearchValue = showModalDialog("/lit/g1490/1490.html", "Select Product", "dialogWidth:600px;dialogHeight:465px;");
SetSearchValue(cSearchValue);
} else {
winModalWindow = window.open("/lit/g1490/1490.html", "Select Product", "dependent=yes,width:600px,height=465px")
winModalWindow.focus()
}
return false;
}
function SetSearchValue(cSearchValue) {
if (cSearchValue != null) {
document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_txtOtherAmsoilProductCode').value = cSearchValue;
lookupOnBlur();
}
}
function toggle(id) {
var styleObj = document.getElementById('instructionSection').style;
if (styleObj.display == 'block') {
document.getElementById(id).innerHTML = "Show Instructions <img src=\"/MyGarage/images/miniHelp.png\" />";
styleObj.display = 'none';
} else {
document.getElementById(id).innerHTML = "Hide Instructions <img src=\"/MyGarage/images/miniHelp.png\" />";
styleObj.display = 'block';
}
}
</script>
<script type="text/javascript" src="fancybox/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.0.pack.js"></script>
<link rel="stylesheet" type="text/css" href="fancybox/fancybox.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$("a.tutorial").fancybox({
'titlePosition' : 'over',
'transitionIn' : 'none',
'transitionOut' : 'none'
});
$("a.whatsThis").fancybox({
'titleShow' : false,
'padding' : 15
});
});
function pageLoad(sender, args) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function() {
$("a.tutorial").fancybox({
'titlePosition' : 'over',
'transitionIn' : 'none',
'transitionOut' : 'none'
});
$("a.whatsThis").fancybox({
'titleShow' : false,
'padding' : 15
});
});
}
</script>
</head>
<body onkeydown="if (event.keyCode==13) {event.keyCode=9; return event.keyCode }" >
<form id="form1" runat="server">
<telerik:RadScriptManager ID="ScriptManager1" runat="server">
</telerik:RadScriptManager>
<div id="rightHeader">
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server">
<ContentTemplate>
<div id="rightHeaderNav">
<h3 class="left">
Welcome,
<%= Session["FirstLast"]%></h3>
<h3 class="right topFont">
<asp:LinkButton ID="lbtBack" runat="server" OnClick="lbtBack_Click" CssClass="">Back to <%= wucServiceAdd1.NickName%></asp:LinkButton>
</h3>
</div>
<div id="rightDisplayName">
<h1 class="left">
<%= wucServiceAdd1.WizardCaption%></h1>
<div class="right" id="progressBar">
<asp:UpdateProgress ID="progress1" DisplayAfter="1" runat="server">
<ProgressTemplate>
<div>
<img src="/MyGarage/images/ajax-loader.gif" alt="Please wait..." />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="actionBar">
<h3 class="center"><%= wucServiceAdd1.NickName%></h3><!--<a class="tutorial right" style="margin: -29px 8px 0 0;"href="http://www.adobe.com/jp/events/cs3_web_edition_tour/swfs/perform.swf"><img src="/MyGarage/images/help.png" title="Video Tutorial" alt="Video Tutorial" /></a>-->
</div>
<div class="content">
<div>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Always" runat="server">
<ContentTemplate>
<asp:HiddenField ID="hdnErrorNotification" runat="server" />
<uc1:wucServiceAdd ID="wucServiceAdd1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<script type="text/javascript" language="javascript">
Sys.Application.add_load(load);
function load() {
var hdn = document.getElementById('hdnErrorNotification');
if (hdn.value != '') {
alert(hdn.value);
hdn.value = '';
}
}
</script>
</form>
</body>
</html>
ASPX Code Behind -
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AMSOILGarage.classes;
namespace AMSOILGarage
{
public partial class ServiceAdd : cGarageAJAX
{
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager1.AsyncPostBackTimeout = 3600;
}
protected void lbtBack_Click(object sender, EventArgs e)
{
Response.Redirect("GarageVehicle.aspx?id=" + wucServiceAdd1.UnitInstanceID.ToString());
}
protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
AmsWebLibrary.Module1.LogError("ServiceAdd.ScriptManager1_AsyncPostBackError", e.Exception, false, string.Empty, string.Empty);
}
protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is ErrorNotificationEventArgs)
{
ErrorNotificationEventArgs ee = (ErrorNotificationEventArgs)e;
hdnErrorNotification.Value = ee.ErrorNotification;
return true;
}
return false;
}
}
}
WebUserControl -
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="wucServiceAdd.ascx.cs" Inherits="AMSOILGarage.WebControls.wucServiceAdd" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="wucServiceProductRadioList2.ascx" TagName="wucServiceProductRadioList2" TagPrefix="uc1" %>
<%@ Register Src="wucServiceProductOtherAmsoil.ascx" TagName="wucServiceProductOtherAmsoil" TagPrefix="uc2" %>
<%@ Register Src="wucServiceProductNonAmsoil.ascx" TagName="wucServiceProductNonAmsoil" TagPrefix="uc3" %>
<%@ Register TagPrefix="uc4" Namespace="AMSOILGarage.classes" Assembly="AMSOILGarage" %>
<script type="text/javascript">
function checkMeOnly(opt, recentlySelectedLabelID, optionText, productCode, purchaseLinkID, purchaseLinkText, optIDFragment) {
resetRadioButtons(optIDFragment);
opt.checked = true;
var hdn = document.getElementById('wucServiceAdd1_hdnProductSource');
hdn.value = '1';
}
function resetRadioButtons(optIDFragment) {
var allInputs = document.getElementsByTagName("input");
for (i = 0; i < allInputs.length; i++) {
var input = allInputs[i];
if (input.id != null) {
if ((input.type == "radio") && (input.id.indexOf(optIDFragment) > -1)) {
input.checked = false;
}
}
}
}
function lookupOnBlur() {
if (document.getElementById('wucServiceAdd1_hdnMoveOn') != null) {
if (document.getElementById('wucServiceAdd1_hdnMoveOn').value != '1') {
setTimeout("document.forms[0].submit();", 300);
}
document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_hdnDoLookup').value = '1';
}
}
function resetAndSubmitForm() {
}
function stepNext(WizardID) {
if (document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_hdnDoLookup') != null) {
if (document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_hdnDoLookup').value != '1') {
setTimeout("document.forms[0].submit();", 300);
}
document.getElementById('wucServiceAdd1_hdnMoveOn').value = '1';
}
}
// function doPostBackAsync(eventName, eventArgs) {
// var prm = Sys.WebForms.PageRequestManager.getInstance();
// if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
// prm._asyncPostBackControlIDs.push(eventName);
// }
// if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
// prm._asyncPostBackControlClientIDs.push(eventName);
// }
// __doPostBack(eventName, eventArgs);
// }
</script>
<!--<asp:Label ID="lblWizardCaption" runat="server" Text=""></asp:Label>-->
<input id="hdnCode" type="hidden" />
<input id="hdnName" type="hidden" />
<input id="hdnAnchor" type="hidden" />
<asp:HiddenField ID="hdnMoveOn" runat="server" />
<asp:HiddenField ID="hdnProductCodeReturned" Value="" runat="server" />
<asp:HiddenField ID="hdnUpdateAnchors" Value="0" runat="server" />
<asp:Label ID="lblUnitInstanceID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductCount" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblServiceID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblEquipmentTypeID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblEquipmentUnitID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblStepDisplay" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblEquipmentDescriptor" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblServiceType" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductType" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductIndex" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductSource" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblShowServiceEdit" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblNoTechContact" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblPreviousServiceTypeID" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductTypeCount" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductCodes" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductNames" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductSources" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblScreenCounts" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblNickname" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductSourceSelected" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblDivProductSelectionWasShowing" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductName" runat="server" Visible="false" Text=""></asp:Label>
<asp:HiddenField ID="hdnProductSource" runat="server" />
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
<StyleSheets>
<telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Calendar.css" Assembly="Telerik.Web.UI" />
<telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Web20.Calendar.Web20.css" Assembly="Telerik.Web.UI" />
</StyleSheets>
</telerik:RadStyleSheetManager>
<div id="wizard">
<uc4:CustomWizard ID="Wizard1" runat="server" OnNextButtonClick="Wizard1_NextButtonClick" OnFinishButtonClick="Wizard1_FinishButtonClick" Width="100%" OnPreviousButtonClick="Wizard1_PreviousButtonClick" OnSideBarButtonClick="Wizard1_SideBarButtonClick" CancelDestinationPageUrl="/amsoilgarage.aspx" DisplayCancelButton="False" onactivestepchanged="Wizard1_ActiveStepChanged">
<SideBarTemplate>
<asp:DataList ID="SideBarList" runat="server" OnItemDataBound="SideBarList_ItemDataBound">
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" runat="server"></asp:LinkButton>
</ItemTemplate>
<SelectedItemStyle Font-Bold="True" />
</asp:DataList>
</SideBarTemplate>
<StartNextButtonStyle CssClass="button blue" />
<FinishCompleteButtonStyle CssClass="button blue" />
<StepNextButtonStyle CssClass="button blue" />
<FinishPreviousButtonStyle CssClass="button gray" />
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Select Service Type">
<h3><span class="wizardStep">Select Service Type</span></h3><br/>
<div class="formStyle">
<table>
<tr>
<td width="120px">
<asp:Button ID="btnUpdatePurchaseLinks" CssClass="invisible" runat="server" Text="You can't see me" />Service: <span class="required">*</span>
</td>
<td>
<asp:DropDownList ID="ddlServiceType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlServiceType_SelectedIndexChanged"></asp:DropDownList>
</td>
</tr>
<tr>
<td>
Date: <span class="required">*</span>
</td>
<td>
<telerik:RadDatePicker ID="rdpServiceDate" runat="server" MinDate="1900-01-01" ToolTip="Open the calendar popup" Skin="Web20" Calendar-ShowRowHeaders="False">
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
<DateInput DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy"></DateInput>
</telerik:RadDatePicker>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblVehicleMilesCaption" runat="server" Text="">Vehicle Miles:</asp:Label>
</td>
<td>
<telerik:RadNumericTextBox ID="txtVehicleMiles" MaxLength="8" Width="100px" runat="server" Skin="Web20">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
</tr>
</table>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both;">
<hr/>
<p>Adding a service to this equipment record means you will be tracking a maintenance action and a possible AMSOIL product (or other non-AMSOIL product) associated with this maintenance.</p>
<span class="left">
<p>1. First, define the <b>Service</b> by choosing a service type. You can pick from any of the types we have provided for you, or choose <b>Custom Service Type</b> from the bottom of the list to add your own.</p>
<p>2. Next, select a <b>Date</b> of service. You can enter it in dd/mm/yyyy format, or use the calendar assistant link to the left to choose a date.</p>
</span>
<span class="left">
<p>3. The <b>Equipment Miles</b> text box will automatically fill in with a number based upon the information you have entered into this equipment record’s <b>Current Mileage</b> field. If you would like to change this, you can type any mileage into the text field.</p>
<p>4. When you are ready to proceed, click the <b>Next</b> button.</p>
</span>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Select Products">
<h3><%= StepDisplay %> - <span class="wizardStep"><b>Select <%= ProductTypeDisplay%></b> for <%= ServiceType%> Service</span></h3><br/>
<p>
<asp:Panel ID="pnlProductSourceSelection" runat="server">
<div style="padding-left: 10px;">
<asp:Panel ID="pnlRecommended" runat="server">
<div runat="server" id="divGotProducts">
<h3>Recommended AMSOIL Products</h3>
</div>
<div runat="server" id="divNoTechContact">
<h3>Recommended AMSOIL Products</h3>
<p class="instructions">
AMSOIL currently does not currently recommend a specific product for this service
on this equipment. You may call <%= TechServicesPhone%> or <%= TechServicesEmail%> for
more help in finding a product recommendation.
</p>
</div>
<div>
<uc1:wucServiceProductRadioList2 ID="wucServiceProductRadioList21" runat="server" />
</div>
</asp:Panel>
</div>
</asp:Panel>
</p>
<div runat="server" id="divProductSelection">
<uc2:wucServiceProductOtherAmsoil ID="wucServiceProductOtherAmsoil1" runat="server" />
<uc3:wucServiceProductNonAmsoil ID="wucServiceProductNonAmsoil1" runat="server" />
</div>
<!--<div runat="server" id="divRecentlySelected">
<%= ProductType%>:<asp:HyperLink ID="hypPurchase" runat="server">Purchase</asp:HyperLink>
<asp:Label ID="lblSelected" runat="server" Text=""></asp:Label>
</div>-->
<div id="divInfo" runat="server" class="invisible">
<p>
<asp:HyperLink ID="hypInfo" runat="server">Click here</asp:HyperLink> for information on selecting the correct AMSOIL product for your vehicle, or call 1-800-399-TECH for a live technical rep.
</p>
</div>
<div id="divNoInfo" runat="server" class="invisible">
<p>For information on selecting the correct AMSOIL product for your vehicle, call 1-800-399-TECH for a live technical rep.</p>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both;">
<hr/>
<div id="divDefaultInstructions" runat="server" class="clear">
<p>Based upon the service type you have chosen for this equipment, this next step will offer you the chance to attach an AMSOIL product or other product to this service record. <b>You can click on the radio buttons just above the bold text to highlight any one of these four options.</b></p>
<span class="left">
<p>
1. If your equipment type and engine are represented in one of the AMSOIL databases of known equipment, we will attempt to match products for you under the <b>AMSOIL Recommended Products</b> section. If products are available, you may use one of the radio selection buttons to choose a product. If you are setting up a record for a multi-step service (such as <b>Change Engine Oil & Filter</b>) you will need to select products several times to complete this step.
<br/><i><b>NOTE:</b> If no products are found or we cannot match this equipment, this area has contact information which you can use to request product selection help from the <b>AMSOIL Technical Services Department.</b></i>
</p>
<p>2. If we did not match specific products to the equipment you are attempting to service, you can also choose to have the website assist you with finding and attaching an AMSOIL product yourself. Choose the <b>AMSOIL Products</b> section to lookup a product.</p>
</span>
<span class="left">
<p>3. If you need to enter a product for a service which AMSOIL does not offer (such as electrical parts or tires), you can select the <b>Other Products</b> section to use a free form textbox to attach a non-AMSOIL part number to this service record.</p>
<p>4. If you do not want to attach any products to this service at this time, select the <b>None</b> option.</p>
<p>5. When you are ready to move on, click the <b>Next</b> button. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
<div id="divOtherAMSOILInstructions" runat="server" class="clear">
<p>In order to help you select an AMSOIL product for this service record, we have included a product lookup feature.</p>
<span class="left">
<p>1. Enter your AMSOIL Product Code (if known). To select from a list of AMSOIL products, enter the first 3 characters of the Product Code then click TAB or NEXT.</p>
<p>2. If you would like more help determining which motor oil you would like to use for an oil change service, click on the <b>Lookup a Motor Oil</b> button to use our Product Recommendation and Drain Interval Guide. It consists of a series of questions which will guide you to your best lubricant options. When finished you will be able to click on a motor oil product and attach it to this service.</p>
</span>
<span class="left">
<p>3. When you have determined the AMSOIL product you wish to use for this service record, click <b>Next</b> to continue. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
<div id="divOtherInstructions" runat="server" class="clear">
<span class="left">
<p>1. Use the text box above to enter descriptive details about the non-AMSOIL product your are attaching to this equipment’s service record.</p>
</span>
<span class="left">
<p>2. Click <b>Next</b> to continue. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3" runat="server" Title="Service Details/Procedures Comments">
<h3><%= StepDisplay %> - <span class="wizardStep"><b>(Optional)</b> - Procedure Details</span></h3><br/>
<div class="formStyle">
<table>
<tr>
<td valign="top">
Details:
</td>
<td>
<telerik:RadTextBox ID="txtDetails" TextMode="MultiLine" Height="80" Width="50%"
MaxLength="1000" runat="server" Skin="Web20">
</telerik:RadTextBox><br/>
</td>
</tr>
<tr>
<td width="120px">
Service Cost:
</td>
<td>
<telerik:RadNumericTextBox ID="txtServiceCost" MaxLength="8" Width="100px" runat="server" Skin="Web20" MaxValue="1000000" Type="Currency">
<NumberFormat DecimalDigits="2" />
</telerik:RadNumericTextBox>
<div runat="server" id="divTechInfo">
<a href="#tech" class="whatsThis">Technical Information</a>
<div class="invisible">
<div id="tech">
<table>
<tr runat="server" id="trTech">
<td>
<h3><asp:Label ID="lblTechCaption" runat="server" Text=""></asp:Label></h3>
<asp:Label ID="lblTech" runat="server" Text=""></asp:Label>
<p align="right"><a href="#" onclick="$.fancybox.close()" class="button gray">Close</a></p>
</td>
</tr>
</table>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="clear instructions" id="instructionSection" style="display: none;">
<hr/>
<p>The step allows you to provide some optional maintenance procedure details for your records.</p>
<span class="left">
<p>1. If you would like to record a <b>Service Cost</b> for this maintenance record, you may do so in the text box available.</p>
<p>2. You can also provide details about the service in the <b>Details</b> text box. This can be useful for reference the next time you look up this service item.</p>
</span>
<span class="left">
<p>3. Click <b>Next</b> to continue. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep4" runat="server" Title="E-Mail Reminders">
<h3> <%= StepDisplay %> - <span class="wizardStep"><b>(Optional)</b> - Set Email Reminder</span></h3> <br/>
<div class="formStyle">
<p><asp:CheckBox ID="chkSendEmailNextChange" runat="server" /> Send me an e-mail reminder to follow up on this procedure</p>
<p>
<div style="display: none; visibility: hidden;">
<table>
<tr>
<td width="150px">
Recommended Oil Change Date: <span class="required">*</span>
</td>
<td>
<asp:Label ID="lblNextOilChangeDate" Font-Bold="true" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
</div>
<table>
<tr>
<td width="220px">
Select Your Email Reminder Date:
</td>
<td>
<telerik:RadDatePicker ID="rdpNextEmailDate" runat="server" MinDate="1900-01-01" ToolTip="Open the calendar popup" CssClass="RadCalendar_Default" Skin="Web20" Calendar-ShowRowHeaders="False">
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Web20"></Calendar>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
<DateInput DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy"></DateInput>
</telerik:RadDatePicker>
</td>
</tr>
</table>
<br/><b>Note:</b> To ensure that your important MyAMSOILGarage™ email messages are not filtered into your Spam, Junk or Bulk Mail folder, select the Add/Save to Address Book function in your email browser and follow the appropriate instructions to add AMSOIL to your safe senders list. See your email providers Safe Senders List instructions for more details on how to accomplish this.
</p>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both;">
<hr/>
<p>The final step allows you to set up an email reminder for this service to the address we have on file for your MyAMSOILGarage™ account. If you do not wish to set up an email reminder right now, you will also be able to do so later from the <b>Email Reminders</b> screen.</p>
<span class="left">
<p>1. Check the box next to “<b>Send me an e-mail reminder to follow up in this procedure</b>” to enable this feature.</p>
<p>2. Set the <b>Email Reminder Date</b>. You can enter it in dd/mm/yyyy format, or use the calendar assistant link to the left to choose a date.</p>
</span>
<span class="left">
<p>3. Click <b>Finish</b> to save this equipment service record. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep5" runat="server" Title="Complete" StepType="Complete">
<div id="wizardEnd">
<h3 class="center"><%= ServiceType%> recorded for <%= NickName%></h3><br/><br />
<h4>Please select your next option:</h4><br />
<asp:ImageButton ID="btnBackToEquipment" ImageUrl="~/AmsoilGarage/Theme/images/equip1.gif" OnClick="btnBackToEquipment_Click" runat="server" /> <a href="#details" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/><br />
<asp:ImageButton ID="btnAddNewService" ImageUrl="~/AmsoilGarage/Theme/images/add1.gif" OnClick="btnAddNewService_Click" runat="server" /> <a href="#service" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br /><br />
<asp:ImageButton ID="btnEmail" ImageUrl="~/AmsoilGarage/Theme/images/email1.gif" OnClick="btnEmail_Click" runat="server" /> <a href="#reminders" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br /><br />
<div runat="server" id="productLookup">
<h4>Or...</h4><br />
<asp:ImageButton ID="btnAddNewEquipment" ImageUrl="~/AmsoilGarage/Theme/images/addEquip1.gif" OnClick="btnAddNewEquipment_Click" runat="server" /><a href="#equipment" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a>
</div>
<!-- Help Information -->
<div style="display: none;">
<div id="details">
<h3>View Equipment Details</h3>
<p>Look at the information you used to create this equipment record.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
<div id="service">
<h3>Add New Service</h3>
<p>Start tracking maintenance actions and products for this equipment record.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
<div id="reminders">
<h3>Set-Up Email Reminders</h3>
<p>Set up a scheduled email to remind you to look at this equipment record.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
<div id="equipment">
<h3>Add New Equipment</h3>
<p>Start the process over and add another piece of equipment to your account.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both; text-align: left;">
<hr/>
<p>To get started, you must first choose a type of equipment to add to your MyAMSOILGarage™ account. Follow these steps to add a new piece of equipment:</p>
<span class="left">
<p>1. Choose the <b>Equipment Details</b> button to see a summary screen of everything you just entered for this equipment. From this screen, you can <b>Adjust Equipment Details</b> if something may not be correct or <b>Add a Photo</b> to this equipment record.</p>
<p>2. Choose the <b>Add New Service</b> button if you would like to begin tracking your maintenance of this equipment and start attaching products to the equipment.</p>
</span>
<span class="left">
<p>3. Choose <b>Set Up E-Mail Reminders</b> if you would like to schedule maintenance email reminders for this piece of equipment. This can also be done after you have attached products and maintenance types through the Add New Service option.</p>
<p>4. Or, if you have more equipment records which you would like to enter now, you may choose <b>Add Additional Equipment</b> to start the process over and redefine another equipment record.</p>
</span>
</ol>
</div>
</div>
<hr class="clear" />
</div>
</asp:WizardStep>
</WizardSteps>
<StepNavigationTemplate>
<asp:Button CausesValidation="False" CssClass="button gray" CommandName="MovePrevious" ID="StepPreviousButton"
runat="server" Text="Previous" />
<asp:Button CommandName="MoveNext" CssClass="button blue" ID="StepNextButton" runat="server" Text="Next" />
</StepNavigationTemplate>
<CancelButtonStyle CssClass="button black" />
<SideBarStyle CssClass="wizardSidebar" />
</uc4:CustomWizard>
</div>
<asp:Button ID="btnServiceCustomater" CssClass="invisible" runat="server" Text="Anna" />
<cc1:ModalPopupExtender runat="server" ID="mpeCustomService" TargetControlID="btnServiceCustomater"
PopupControlID="pnlCustomService" BackgroundCssClass="modalBackground" DropShadow="false" />
<asp:Panel ID="pnlCustomService" runat="server" CssClass="modalPopup">
<div class="modalHeader"></div>
<div class="modal">
<!-- Add Custom Service -->
<div runat="server" id="divAddCustomService">
<h3>Add Custom Service Item</h3>
<p>
<span class="formStyle"><asp:TextBox ID="txtNewCustomService" runat="server"></asp:TextBox></span>
</p>
<p align="right">
<asp:Button ID="btnSaveNewCustomService" CssClass="button blue" runat="server" Text="Save" OnClick="btnSaveNewCustomService_Click" />
<asp:Button ID="btnCancelNewCustomService" CssClass="button gray" runat="server" Text="Cancel" OnClick="btnCancelNewCustomService_Click" />
</p>
</div>
<!-- Edit Custom Service -->
<div runat="server" id="divUpdateCustomService">
<h3>Edit Custom Service Item(s)</h3>
<asp:GridView ID="grdUpdateServiceTypes" runat="server" AutoGenerateColumns="False"
DataKeyNames="ServiceTypeUserDefinedID" DataSourceID="sdsSTUD" OnRowDataBound="grdUpdateServiceTypes_RowDataBound"
OnRowCommand="grdUpdateServiceTypes_RowCommand" OnRowUpdated="grdUpdateServiceTypes_RowUpdated">
<Columns>
<asp:BoundField DataField="ServiceTypeUserDefinedID" HeaderText="ServiceTypeUserDefinedID"
InsertVisible="False" ReadOnly="True" SortExpression="ServiceTypeUserDefinedID"
Visible="False" />
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
Visible="False" />
<asp:BoundField DataField="ServiceType" HeaderText="ServiceType" SortExpression="ServiceType" />
<asp:CommandField ShowEditButton="True">
<ControlStyle CssClass=" " />
</asp:CommandField>
<asp:BoundField DataField="EquipmentTypeID" HeaderText="EquipmentTypeID" SortExpression="EquipmentTypeID"
Visible="False" />
<asp:TemplateField HeaderText="" ShowHeader="False" ItemStyle-CssClass="">
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" Font-Size="8pt" runat="server" OnClientClick="return confirm('OK to Delete?');"
CausesValidation="false" CommandName="Remove" CommandArgument='<%# Eval("ServiceTypeUserDefinedID") %>'
Text="Remove"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sdsSTUD" runat="server" ConnectionString="<%$ ConnectionStrings:AmsoilGarageConnectionString %>"
SelectCommand="SELECT * FROM [ServiceTypeUserDefined] WHERE (([EquipmentTypeID] = @EquipmentTypeID) AND ([CustomerID] = @CustomerID)) ORDER BY [ServiceType]"
DeleteCommand="DELETE FROM [ServiceTypeUserDefined] WHERE [ServiceTypeUserDefinedID] = @ServiceTypeUserDefinedID"
InsertCommand="INSERT INTO [ServiceTypeUserDefined] ([CustomerID], [ServiceType], [EquipmentTypeID]) VALUES (@CustomerID, @ServiceType, @EquipmentTypeID)"
UpdateCommand="UPDATE [ServiceTypeUserDefined] SET [ServiceType] = @ServiceType, [EquipmentTypeID] = @EquipmentTypeID WHERE [ServiceTypeUserDefinedID] = @ServiceTypeUserDefinedID">
<SelectParameters>
<asp:ControlParameter ControlID="lblEquipmentTypeID" Name="EquipmentTypeID" PropertyName="Text"
Type="Int32" />
<asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="ServiceTypeUserDefinedID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ServiceType" Type="String" />
<asp:ControlParameter ControlID="lblEquipmentTypeID" Name="EquipmentTypeID" PropertyName="Text"
Type="Int32" />
<asp:Parameter Name="ServiceTypeUserDefinedID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="Int32" />
<asp:Parameter Name="ServiceType" Type="String" />
<asp:ControlParameter ControlID="lblEquipmentTypeID" Name="EquipmentTypeID" PropertyName="Text"
Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<%--<asp:Button ID="btnCancelUpdateCustomServic" runat="server" Text="Cancel" OnClick="btnCancelUpdateCustomService_Click" />--%>
<p align="right">
<asp:Button ID="btnSaveUpdateCustomService" CssClass="button blue" runat="server"
Text="Done" OnClick="btnSaveUpdateCustomService_Click" />
</p>
</div>
</div>
<div class="modalFooter"></div>
</asp:Panel>
WebUserControl Code Behind -
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AMSOILGarage.classes;
using AmsDbVB;
using AmsDbLib;
using GarageLib;
namespace AMSOILGarage.WebControls
{
public partial class wucServiceAdd : cGarageDataControl
{
public enum ProductSourceEnum { Recommended = 1, OtherAmsoil = 2, NonAmsoil = 3 };
#region properties
public int ServiceID
{
get
{
Label lbl = (Label)FindControl("lblServiceID");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblServiceID");
lbl.Text = value.ToString();
}
}
public string NickName
{
get
{
Label lbl = (Label)FindControl("lblNickName");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblNickName");
lbl.Text = value;
}
}
public int UnitInstanceID
{
get
{
Label lbl = (Label)FindControl("lblUnitInstanceID");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblUnitInstanceID");
lbl.Text = value.ToString();
if (value > 0)
{
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
v.UnitInstanceID = value;
bool bSuccess = v.setServiceValues();
if (bSuccess)
{
if (v.CustomerID != CustomerID)
{
Response.Redirect("~/");
}
EquipmentDescriptor = v.EquipmentDescriptor;
EquipmentTypeID = v.EquipmentTypeID;
EquipmentUnitID = v.EquipmentUnitID;
}
NickName = v.getNickname(UnitInstanceID);
}
}
}
public int EquipmentUnitID
{
get
{
Label lbl = (Label)FindControl("lblEquipmentUnitID");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblEquipmentUnitID");
lbl.Text = value.ToString();
}
}
private ProductSourceEnum productSource = ProductSourceEnum.NonAmsoil;
public ProductSourceEnum ProductSource
{
get
{
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
return pSources[ProductIndex-1];
}
set
{
productSource = value;
if (productSource == ProductSourceEnum.Recommended)
{
}
else if (productSource == ProductSourceEnum.OtherAmsoil)
{
wucServiceProductRadioList21.SelectedIndex = (wucServiceProductRadioList21.ProductCount - 2);
wucServiceProductOtherAmsoil1.Visible = true;
this.wucServiceProductNonAmsoil1.Visible = false;
}
else //(productSource == ProductSourceEnum.NonAmsoil)
{
wucServiceProductRadioList21.SelectedIndex = (wucServiceProductRadioList21.ProductCount - 1);
this.wucServiceProductNonAmsoil1.Visible = true;
wucServiceProductOtherAmsoil1.Visible = false;
ProductCode = string.Empty;
}
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
pSources[ProductIndex - 1] = value;
ProductSources = pSources;
ProductNameRecentlySelected = ProductNameRecentlySelected;
hypPurchase.NavigateUrl = wucServiceProductRadioList21.PurchaseLink;
}
}
public int EquipmentTypeID
{
get
{
return Convert.ToInt32(cStatic.ValC(lblEquipmentTypeID.Text));
}
set
{
lblEquipmentTypeID.Text = value.ToString();
}
}
public int CustomerID
{
get
{
int customerID = 0;
if (Session["CustomerID"] != null && int.Parse(Session["CustomerID"].ToString()) != 0)
{
customerID = int.Parse(Session["CustomerID"].ToString());
}
return customerID;
}
}
public string EquipmentDescriptor
{
get
{
Label lbl = (Label)FindControl("lblEquipmentDescriptor");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblEquipmentDescriptor");
lbl.Text = value;
}
}
public int ServiceTypeID
{
get
{
return Convert.ToInt32(ddlServiceType.SelectedValue);
}
set
{
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, value, false, true);
}
}
public string ServiceType
{
get
{
Label lbl = (Label)FindControl("lblServiceType");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblServiceType");
lbl.Text = value;
}
}
public string ProductType
{
get
{
Label lbl = (Label)FindControl("lblProductType");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblProductType");
lbl.Text = value;
}
}
public string ProductTypeDisplay
{
get
{
string s = ProductType;
if (s == "Other")
{
s = "Product";
}
return s;
}
}
public int ProductIndex
{
get
{
Label lbl = (Label)FindControl("lblProductIndex");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblProductIndex");
lbl.Text = value.ToString();
}
}
public string StepDisplay
{
get
{
Label lbl = (Label)FindControl("lblStepDisplay");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblStepDisplay");
lbl.Text = value;
}
}
public string WizardCaption
{
get
{
Label lbl = (Label)FindControl("lblWizardCaption");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblWizardCaption");
lbl.Text = value;
}
}
private bool multiProductServiceSelected;
public bool MultiProductServiceSelected
{
get
{
return multiProductServiceSelected;
}
set
{
multiProductServiceSelected = value;
}
}
public string ServiceDate
{
get
{
return rdpServiceDate.SelectedDate.ToString();
}
set
{
if (value.Length > 0)
{
rdpServiceDate.SelectedDate = Convert.ToDateTime(value);
}
}
}
public string ServiceMiles
{
get
{
return txtVehicleMiles.Text;
}
set
{
if (value == "0")
{
txtVehicleMiles.Text = string.Empty;
}
else
{
txtVehicleMiles.Text = value;
}
}
}
public string ServiceCost
{
get
{
return txtServiceCost.Text;
}
set
{
txtServiceCost.Text = value;
}
}
public string Details
{
get
{
return txtDetails.Text;
}
set
{
txtDetails.Text = value;
}
}
private string productCode = string.Empty;
public string ProductCode
{
get
{
return productCode;
}
set
{
if (value == "OTHERAMSOIL" || value == "NONAMSOIL")
{
productCode = string.Empty;
}
else
{
productCode = value;
}
}
}
public string ProductCodeSelected
{
get
{
ProductSourceEnum ps = ProductSource;
if ((ps == ProductSourceEnum.Recommended) && (wucServiceProductRadioList21.SelectedIndex > -1))
{
return wucServiceProductRadioList21.ProductCode;
}
else if ((ps == ProductSourceEnum.OtherAmsoil) && (wucServiceProductOtherAmsoil1.ProductCode.Length > -1))
{
return wucServiceProductOtherAmsoil1.ProductCode;
}
else
{
return string.Empty;
}
}
}
private List<string> productCodes = new List<string>();
public List<string> ProductCodes
{
get
{
productCodes.Clear();
string s = lblProductCodes.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] codes = new string[commaCount];
codes = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
productCodes.Add(codes[i].Replace("|",string.Empty));
}
return productCodes;
}
set
{
System.Text.StringBuilder sCodes = new System.Text.StringBuilder();
List<string> productCodes = value;
foreach (string s in productCodes)
{
if (s.Trim().Length > 0)
{
sCodes.Append(s + ",");
}
else
{
sCodes.Append("|,");
}
}
if (sCodes.Length > 1)
{
sCodes = sCodes.Remove(sCodes.Length - 1, 1);
}
lblProductCodes.Text = sCodes.ToString();
}
}
private List<string> productNames = new List<string>();
public List<string> ProductNames
{
get
{
productNames.Clear();
string s = lblProductNames.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] Names = new string[commaCount];
Names = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
productNames.Add(Names[i].Replace("|", string.Empty));
}
return productNames;
}
set
{
System.Text.StringBuilder sNames = new System.Text.StringBuilder();
List<string> productNames = value;
foreach (string s in productNames)
{
if (s.Trim().Length > 0)
{
sNames.Append(s + ",");
}
else
{
sNames.Append("|,");
}
}
if (sNames.Length > 1)
{
sNames = sNames.Remove(sNames.Length - 1, 1);
}
lblProductNames.Text = sNames.ToString();
}
}
private List<ProductSourceEnum> productSources = new List<ProductSourceEnum>();
public List<ProductSourceEnum> ProductSources
{
get
{
productSources.Clear();
string s = lblProductSources.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] Sources = new string[commaCount];
Sources = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
ProductSourceEnum pse =
(ProductSourceEnum)Enum.Parse(typeof(ProductSourceEnum), Sources[i]);
productSources.Add(pse);
//.ToString("D")
}
return productSources;
}
set
{
System.Text.StringBuilder sSources = new System.Text.StringBuilder();
productSources = value;
foreach (ProductSourceEnum pse in productSources)
{
sSources.Append(pse.ToString("D") + ",");
}
if (sSources.Length > 1)
{
sSources = sSources.Remove(sSources.Length - 1, 1);
}
lblProductSources.Text = sSources.ToString();
}
}
private List<int> screenCounts = new List<int>();
public List<int> ScreenCounts
{
get
{
screenCounts.Clear();
string s = lblScreenCounts.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] Counts = new string[commaCount];
Counts = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
Int32 pse = 0;
bool b = Int32.TryParse(Counts[i], out pse);
if (b)
{
}
screenCounts.Add(pse);
//.ToString("D")
}
return screenCounts;
}
set
{
System.Text.StringBuilder sCounts = new System.Text.StringBuilder();
screenCounts = value;
foreach (int pse in screenCounts)
{
sCounts.Append(pse.ToString() + ",");
}
if (sCounts.Length > 1)
{
sCounts = sCounts.Remove(sCounts.Length - 1, 1);
}
lblScreenCounts.Text = sCounts.ToString();
}
}
//private string productName = string.Empty;
public string ProductName
{
get
{
return lblProductName.Text;
}
set
{
lblProductName.Text = value;
wucServiceProductNonAmsoil1.ProductName = value;
}
}
public string ProductNameSelected
{
get
{
if (ProductSource == ProductSourceEnum.NonAmsoil)
{
return wucServiceProductNonAmsoil1.ProductName;
}
else
{
return string.Empty;
}
}
}
public string ProductNameRecentlySelected
{
get
{
string s = "No Selection";
if (ProductSource == ProductSourceEnum.NonAmsoil)
{
string sProductName = wucServiceProductNonAmsoil1.ProductName;
s = sProductName.Length > 0 ? sProductName : s;
}
else if ((ProductSource == ProductSourceEnum.Recommended) || (ProductSource == ProductSourceEnum.OtherAmsoil))
{
string sProductCode = ProductCodeSelected;
if (sProductCode.Length > 0)
{
product p = new product();
p.ConnectionString = ConnectionString;
s = p.getNameByCode(sProductCode);
}
}
return s;
}
set
{
lblSelected.Text = value;
}
}
public bool SendEmail
{
get
{
return chkSendEmailNextChange.Checked;
}
set
{
chkSendEmailNextChange.Checked = value;
}
}
public bool ShowOtherAmsoil
{
get
{
return ((ServiceTypeID > 0) && !NoTechContact);
}
}
public string NextEmailDate
{
get
{
return rdpNextEmailDate.SelectedDate.ToString();
}
set
{
if (value.Length > 0)
{
rdpNextEmailDate.SelectedDate = Convert.ToDateTime(value);
}
}
}
public string InfoLink
{
get
{
return hypInfo.NavigateUrl;
}
set
{
hypInfo.NavigateUrl = value;
divInfo.Visible = false;// (value.Length > 0);
divNoInfo.Visible = false;//(value.Length == 0);
}
}
public bool ShowServiceEdit
{
get
{
if (lblShowServiceEdit.Text.Length == 0)
{
lblShowServiceEdit.Text = "false";
}
return Convert.ToBoolean(lblShowServiceEdit.Text);
}
set
{
lblShowServiceEdit.Text = value.ToString();
if (Convert.ToBoolean(lblShowServiceEdit.Text))
{
//pnlCustomService.Style.Value = "display:block;";
mpeCustomService.Show();
}
else
{
pnlCustomService.Style.Value = "display:none;";
mpeCustomService.Hide();
}
}
}
public bool NoTechContact
{
get
{
if (lblNoTechContact.Text.Length == 0)
{
lblNoTechContact.Text = "false";
}
return Convert.ToBoolean(lblNoTechContact.Text);
}
set
{
lblNoTechContact.Text = value.ToString();
if (Convert.ToBoolean(lblNoTechContact.Text))
{
divNoTechContact.Style.Value = "display:none;";
}
else
{
divNoTechContact.Style.Value = "display:block;";
}
}
}
public int PreviousServiceTypeID
{
get
{
return Convert.ToInt32(cStatic.ValC(lblPreviousServiceTypeID.Text));
}
set
{
lblPreviousServiceTypeID.Text = value.ToString();
}
}
public string ButtonUpdatePurchaseLinksID
{
get
{
return btnUpdatePurchaseLinks.ClientID;
}
}
public string HiddenUpdateAnchorsID
{
get
{
return hdnUpdateAnchors.ClientID;
}
}
public string HiddenProductCodeReturnedID
{
get
{
return hdnProductCodeReturned.ClientID;
}
}
private List<ProductType> productTypes = new List<ProductType>();
public List<ProductType> ProductTypes
{
get
{
return productTypes;
}
set
{
productTypes = value;
}
}
public int ProductCount
{
get
{
return Convert.ToInt32(cStatic.ValC(lblProductCount.Text));
}
set
{
lblProductCount.Text = value.ToString();
}
}
public int CurrentProductTypeID
{
get
{
if (ProductTypes.Count > 0)
{
return ProductTypes[ProductIndex - 1].ProductTypeID;
}
else
{
return 0;
}
}
}
public bool ProductSelected
{
get
{
if (!divProductSelection.Visible && wucServiceProductRadioList21.AmsoilProductSelected)
{
return true;
}
else if (divProductSelection.Visible && ProductSource == ProductSourceEnum.OtherAmsoil && wucServiceProductOtherAmsoil1.ProductCode != string.Empty)
{
return true;
}
else if ((ProductSource == ProductSourceEnum.NonAmsoil) && divProductSelection.Visible)
{
return true;
}
else
{
return false;
}
}
}
public RadioButton optRecommended
{
get
{
Panel div = (Panel)pnlProductSourceSelection.FindControl("pnlRecommended");
RadioButton opt = (RadioButton)div.FindControl("optPSRecommended");
return opt;
}
}
public RadioButton optNone
{
get
{
Panel div = (Panel)pnlProductSourceSelection.FindControl("pnlRecommended");
RadioButton opt = (RadioButton)div.FindControl("optPSNone");
return opt;
}
}
public string TechServicesPhone
{
get
{
return AmsWebLibrary.Module1.getWebConfigValue("TechServicesPhone");
}
}
public string TechServicesEmail
{
get
{
return AmsWebLibrary.Module1.getWebConfigValue("TechServicesEmailLink");
}
}
#endregion
#region events
void NextButtonSelected()
{
WizardNavigationEventArgs wa = new WizardNavigationEventArgs(Wizard1.ActiveStepIndex, Wizard1.ActiveStepIndex + 1);
object o = Wizard1;
WizardMoveNext(ref o, ref wa);
if (!wa.Cancel && (ProductIndex >= (ProductCount - 1)))
{
Wizard1.MoveTo(WizardStep3);
}
}
protected void Page_Load(object sender, EventArgs e)
{
wucServiceProductOtherAmsoil1.ProductSelectedEvent += new wucServiceProductOtherAmsoil.ProductSelectedEventHandler(wucServiceProductOtherAmsoil1_ProductSelectedEvent);
if (wucServiceProductOtherAmsoil1.getResetDoLookupValue() == "1")
{
wucServiceProductOtherAmsoil1.doLookup();
}
if (hdnMoveOn.Value == "1")
{
hdnMoveOn.Value = string.Empty;
this.NextButtonSelected();
}
if (AmsWebLibrary.Module1.IsDev())
{
Session["ZO_NUM"] = 600001;
Session["DealerName"] = "Joe Sixpack";
Session["Email"] = "vbswami@gmail.com";
Session["CustomerID"] = 195897;// 851096;
Session["PriceType"] = "PRUSCAT";
}
if (Session["CustomerID"] == null || int.Parse(Session["CustomerID"].ToString()) == 0)
{
Response.Redirect("~/loginweb.aspx?sourceform=/mygarage/garage.aspx");
}
productCodes = new List<string>();
productNames = new List<string>();
productSources = new List<ProductSourceEnum>();
screenCounts = new List<int>();
if (!IsPostBack)
{
btnBackToEquipment.Attributes.Add("onmouseover", "this.src='Theme/images/equip2.gif';");
btnBackToEquipment.Attributes.Add("onmouseout", "this.src='Theme/images/equip1.gif';");
btnAddNewService.Attributes.Add("onmouseover", "this.src='Theme/images/add2.gif';");
btnAddNewService.Attributes.Add("onmouseout", "this.src='Theme/images/add1.gif';");
btnEmail.Attributes.Add("onmouseover", "this.src='Theme/images/email2.gif';");
btnEmail.Attributes.Add("onmouseout", "this.src='Theme/images/email1.gif';");
btnAddNewEquipment.Attributes.Add("onmouseover", "this.src='Theme/images/addEquip2.gif';");
btnAddNewEquipment.Attributes.Add("onmouseout", "this.src='Theme/images/addEquip1.gif';");
SetStepDisplay(0);
rdpServiceDate.SelectedDate = DateTime.Today;
if (Request.QueryString["EquipmentTypeID"] != null)
{
if (Convert.ToInt32(Request.QueryString["EquipmentTypeID"]) > 0)
{
EquipmentTypeID = Convert.ToInt32(Request.QueryString["EquipmentTypeID"]);
}
}
LoadServiceTypes(0);
if (Request.QueryString["ServiceID"] != null)
{
if (Convert.ToInt32(Request.QueryString["ServiceID"]) > 0)
{
ServiceID = Convert.ToInt32(Request.QueryString["ServiceID"]);
PopulateForm();
}
}
else if (Request.QueryString["UnitInstanceID"] != null)
{
WizardCaption = "Add New Service";
if (Convert.ToInt32(Request.QueryString["UnitInstanceID"]) > 0)
{
UnitInstanceID = Convert.ToInt32(Request.QueryString["UnitInstanceID"]);
vehicle v = new vehicle(CustomerID, UnitInstanceID);
EquipmentUnitID = v.GetEquipmentUnitIDByInstanceID(ConnectionString);
EquipmentType et = new EquipmentType(v.EquipmentTypeID);
et.load();
if (et.HoursForMiles)
{
lblVehicleMilesCaption.Text = lblVehicleMilesCaption.Text.Replace("Vehicle Miles", "Equipment Hours");
}
}
}
if (Request.QueryString["servicetypeid"] != null)
{
if (Convert.ToInt32(Request.QueryString["servicetypeid"]) > 0)
{
ServiceTypeID = Convert.ToInt32(Request.QueryString["servicetypeid"]);
}
}
if (ServiceMiles.ToString() == string.Empty)
{
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
ServiceMiles = v.getCurrentMiles(UnitInstanceID).ToString();
}
pnlCustomService.Style.Value = "display:none;";
//EnDisableContinueButton(false);
}
else
{
if (ShowServiceEdit)
{
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, PreviousServiceTypeID, false, false);
}
}
if (ShowServiceEdit)
{
//pnlCustomService.Style.Value = "display:block;";
mpeCustomService.Show();
}
else
{
pnlCustomService.Style.Value = "display:none;";
mpeCustomService.Hide();
}
if (hdnUpdateAnchors.Value == "1")
{
hdnUpdateAnchors.Value = "0";
UpdateAnchors();
}
rdpNextEmailDate.MinDate = DateTime.Today;
if ((Session["KilometersMode"] != null) && (Convert.ToBoolean(Session["KilometersMode"].ToString())))
{
lblVehicleMilesCaption.Text = lblVehicleMilesCaption.Text.Replace("Miles", "Kilometers");
}
}
void wucServiceProductOtherAmsoil1_ProductSelectedEvent(object sender, ProductSelectedEventArgs e)
{
ProductCode = e.ProductCode;
ProductName = e.ProductName;
ProductNameRecentlySelected = ProductName;
hypPurchase.NavigateUrl = e.ProductLink;
}
protected void ddlServiceType_SelectedIndexChanged(object sender, EventArgs e)
{
int serviceTypeID = Convert.ToInt32(ddlServiceType.SelectedValue);
if (serviceTypeID == -2)
{
divAddCustomService.Visible = true;
divUpdateCustomService.Visible = false;
ShowServiceEdit = true;
}
else if (serviceTypeID == -3)
{
divUpdateCustomService.Visible = true;
divAddCustomService.Visible = false;
ShowServiceEdit = true;
}
else
{
PreviousServiceTypeID = Convert.ToInt32(ddlServiceType.SelectedValue);
}
RaiseBubbleEvent(this, new ServiceTypeSelectedEventArgs(serviceTypeID));
}
protected void WizardMoveNext(ref object sender, ref WizardNavigationEventArgs e)
{
bool bValid = false;
bool bRepeatStep = false;
string sAlert = string.Empty;
if (e.CurrentStepIndex == 0)
{
bValid = (ddlServiceType.SelectedIndex > 0) && (ServiceDate.Length > 0);
if (ddlServiceType.SelectedIndex <= 0)
{
bValid = false;
sAlert = "Service type is required";
}
else if (ServiceDate.Trim().Length == 0)
{
bValid = false;
sAlert = "Service date is required";
}
else
{
ServiceTypeID = Convert.ToInt32(ddlServiceType.SelectedItem.Value);
trTech.Visible = ((ServiceTypeID < 4) && (ServiceTypeID > 0));
MultiProductServiceSelected = GetMultiProductServiceSelected();
NoTechContact = GetNoTechContact();
ServiceType = ddlServiceType.SelectedItem.Text;
ProductIndex = 1;
LoadProductTypes();
wucServiceProductRadioList21.EquipmentUnitID = EquipmentUnitID;
SetStepDisplay(1);
SetInputValues();
InitInputs();
InitProducts();
bool bShowTech = ((ServiceTypeID >= 1 && ServiceTypeID <= 3) && EquipmentTypeID == 1);
if (bShowTech)
{
MyGarage.cMaintenanceTechContent mtc = new MyGarage.cMaintenanceTechContent((object)EquipmentUnitID);
lblTech.Text = mtc.TechInfo;
vehicle vv = new vehicle();
lblTechCaption.Text = vv.getCaption(UnitInstanceID);
divTechInfo.Visible = (lblTech.Text.Length > 97);
}
else
{
divTechInfo.Visible = false;
}
}
}
else if (e.CurrentStepIndex == 1)
{
RecordProductSource();
if (ProductSelected || divProductSelection.Visible)
{
sAlert = ValidateProduct();
bValid = (sAlert.Length == 0);
if (sAlert == "Please enter a valid AMSOIL product code")
{
sAlert = "";
wucServiceProductOtherAmsoil1.ShowHideProductSelection(true);
}
if (bValid)
{
SaveProduct();
InitInputs();
if (ProductIndex < ProductCount)
{
SaveScreenCount();
pnlProductSourceSelection.Visible = true;
e.Cancel = true;
ProductIndex += 1;
SetInputValues();
ProductSource = ProductSources[ProductIndex - 1];
LoadProductTypes();
InitProducts();
//setInitialProductSource();
SetStepDisplay(1);
divProductSelection.Visible = false;
bRepeatStep = true;
}
else
{
SaveScreenCount();
SetStepDisplay(2);
}
}
}
else if (!divProductSelection.Visible)
{
if ((ProductSource == ProductSourceEnum.Recommended) && (wucServiceProductRadioList21.ProductCount == 2) &&
(wucServiceProductRadioList21.SelectedIndex == -1))
{
sAlert = "Please select \"I want to select my own AMSOIL product\" or \"I am not using an AMSOIL product\".";
bValid = false;
}
else
{
SaveScreenCount();
SaveProduct();
divProductSelection.Visible = true;
pnlProductSourceSelection.Visible = false;
SetStepDisplay(2);
}
}
else
{
pnlProductSourceSelection.Visible = true;
divProductSelection.Visible = false;
LoadProductTypes();
setInitialProductSource();
bRepeatStep = true;
}
}
else if (e.CurrentStepIndex == 2)
{
SetStepDisplay(3);
bValid = true;
}
e.Cancel = ((!bValid) || bRepeatStep);
if (e.Cancel)
{
ConfigureNextButton();
}
if (sAlert.Length > 0)
{
RaiseBubbleEvent(this, new ErrorNotificationEventArgs(sAlert));
}
}
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
if (!wucServiceProductOtherAmsoil1.Visible) // && (Wizard1.ActiveStepIndex == 1)
{
WizardMoveNext(ref sender, ref e);
}
}
protected void RecordProductSource()
{
bool selectOtherAmsoilProduct = ((ShowOtherAmsoil) && (wucServiceProductRadioList21.SelectedIndex == wucServiceProductRadioList21.ProductCount - 2));
bool selectNonAmsoilProduct = (wucServiceProductRadioList21.SelectedIndex == wucServiceProductRadioList21.ProductCount - 1);
if (selectOtherAmsoilProduct)
{
ProductSource = ProductSourceEnum.OtherAmsoil;
}
else if (selectNonAmsoilProduct)
{
ProductSource = ProductSourceEnum.NonAmsoil;
}
else
{
ProductSource = ProductSourceEnum.Recommended;
}
}
protected void Wizard1_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
{
bool bValid = true;
bool bRepeatStep = false;
string sAlert = string.Empty;
bool reHideProductSelection = false;
bool reShowProductSelection = false;
bool onFirstScreenOfProduct = false;
if (e.CurrentStepIndex == 1)
{
bValid = true;
if (bValid)
{
InitInputs();
List<int> sCounts = ScreenCounts;
if (sCounts.Count < ProductIndex)
{
if (!pnlProductSourceSelection.Visible && !wucServiceProductRadioList21.NonAmsoilOnly)
{
onFirstScreenOfProduct = false;
}
else
{
onFirstScreenOfProduct = true;
}
}
else if (sCounts[ProductIndex - 1] == 1)
{
if (!pnlProductSourceSelection.Visible && !wucServiceProductRadioList21.NonAmsoilOnly)
{
onFirstScreenOfProduct = false;
}
else
{
onFirstScreenOfProduct = true;
}
}
if ((onFirstScreenOfProduct) || (pnlProductSourceSelection.Visible))
{
// going to previous product
ProductIndex -= 1;
if (ProductIndex > 0)
{
bRepeatStep = true;
if (ScreenCounts[ProductIndex - 1] == 1)
{
divProductSelection.Visible = false;
reHideProductSelection = true;
pnlProductSourceSelection.Visible = true;
}
else
{
divProductSelection.Visible = true;
reShowProductSelection = true;
pnlProductSourceSelection.Visible = false;
}
}
}
else if (!ShowOtherAmsoil)
{
bRepeatStep = false;
}
else
{
// staying on this product
bRepeatStep = true;
divProductSelection.Visible = false;
reHideProductSelection = true;
pnlProductSourceSelection.Visible = true;
}
if (bRepeatStep)
{
LoadProductTypes();
ProductSource = ProductSources[ProductIndex - 1];
InitProducts();
////setInitialProductSource();
SetInputValues();
SetStepDisplay(1);
if (reHideProductSelection)
{
divProductSelection.Visible = false;
pnlProductSourceSelection.Visible = true;
}
else if (reShowProductSelection)
{
divProductSelection.Visible = true;
pnlProductSourceSelection.Visible = false;
}
}
else
{
SetStepDisplay(0);
}
ConfigureNextButton();
}
}
else if
((e.CurrentStepIndex == 2)) // || (e.CurrentStepIndex == 3)
{
LoadProductTypes();
ProductIndex = ProductCount;
if (ProductTypes.Count > 0)
{
ProductType = ProductTypes[ProductIndex - 1].ProductTypeName;
}
InitInputs();
InitProducts();
SetInputValues();
SetStepDisplay(1);
if (ScreenCounts[ProductIndex - 1] == 1)
{
divProductSelection.Visible = false;
pnlProductSourceSelection.Visible = true;
}
else
{
divProductSelection.Visible = true;
pnlProductSourceSelection.Visible = false;
}
}
else
{
SetStepDisplay(e.NextStepIndex);
}
e.Cancel = ((!bValid) || bRepeatStep);
if (sAlert.Length > 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alerto", "alert('" + sAlert + "');", true);
}
}
protected void Wizard1_SideBarButtonClick(object sender, WizardNavigationEventArgs e)
{
SetStepDisplay(e.NextStepIndex);
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
bool bValid = true;
string sAlert = string.Empty;
if (chkSendEmailNextChange.Checked && NextEmailDate.Trim().Length == 0)
{
bValid = false;
}
if (!bValid)
{
e.Cancel = true;
sAlert = "Please select or enter an E-Mail reminder date";
}
else
{
SaveForm();
WizardCaption = "Service Recorded";
StepDisplay = string.Empty;
}
if (sAlert.Length > 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alerto", "alert('" + sAlert + "');", true);
}
}
protected void SideBarList_ItemDataBound(object sender, DataListItemEventArgs e)
{
}
protected void btnAddNewEquipment_Click(object sender, EventArgs e)
{
Response.Redirect("EquipmentAdd.aspx");
}
protected void btnAddNewService_Click(object sender, EventArgs e)
{
Response.Redirect("ServiceAdd.aspx?EquipmentTypeID=" + EquipmentTypeID.ToString() + "&UnitInstanceID=" + UnitInstanceID.ToString());
}
protected void btnBackToEquipment_Click(object sender, EventArgs e)
{
Response.Redirect("GarageVehicle.aspx?id=" + UnitInstanceID.ToString());
}
protected void btnEmail_Click(object sender, EventArgs e)
{
Response.Redirect("Reminders.aspx?Tab=Reminders&id=" + UnitInstanceID.ToString());
}
protected void btnSaveNewCustomService_Click(object sender, EventArgs e)
{
if (txtNewCustomService.Text.Length > 0)
{
UserDefinedServiceType uds = new UserDefinedServiceType(CustomerID, EquipmentTypeID, ConnectionString);
uds.ServiceType = txtNewCustomService.Text;
uds.saveToDB();
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
v.CustomerID = CustomerID;
v.UnitInstanceID = UnitInstanceID;
v.synchronizeReminders();
grdUpdateServiceTypes.DataBind();
ddlServiceType.Items.Add(new ListItem(uds.ServiceType, (-1 * uds.ServiceTypeUserDefinedID).ToString()));
ddlServiceType.SelectedIndex = ddlServiceType.Items.Count - 1;
ShowServiceEdit = false;
RaiseBubbleEvent(this, new ServiceTypeSelectedEventArgs(-1 * uds.ServiceTypeUserDefinedID));
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alerto", "alert('Service Type is required');", true);
}
}
protected void btnCancelNewCustomService_Click(object sender, EventArgs e)
{
ShowServiceEdit = false;
RaiseBubbleEvent(this, new ServiceTypeSelectedEventArgs(ServiceTypeID));
}
protected void btnSaveUpdateCustomService_Click(object sender, EventArgs e)
{
ShowServiceEdit = false;
}
protected void grdUpdateServiceTypes_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//// the underlying data item is a DataRowView object.
DataRowView rowView = (DataRowView)e.Row.DataItem;
int id = Convert.ToInt32(rowView["ServiceTypeUserDefinedID"].ToString());
//// Retrieve the state value for the current row.
//String state = rowView["state"].ToString();
UserDefinedServiceType udst = new UserDefinedServiceType(Convert.ToInt32(Session["CustomerID"]), EquipmentTypeID, id, ConnectionString, true);
LinkButton lbt = (LinkButton)e.Row.FindControl("lnkDelete");
lbt.Enabled = (!udst.hasServices());
}
}
protected void grdUpdateServiceTypes_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Remove")
{
UserDefinedServiceType u = new UserDefinedServiceType(CustomerID, EquipmentTypeID, Convert.ToInt32(e.CommandArgument), ConnectionString, true);
u.delete();
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
v.CustomerID = CustomerID;
v.UnitInstanceID = UnitInstanceID;
v.synchronizeReminders();
this.grdUpdateServiceTypes.DataBind();
LoadServiceTypes(PreviousServiceTypeID);
}
}
protected void grdUpdateServiceTypes_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
LoadServiceTypes(PreviousServiceTypeID);
}
protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
ConfigureNextButton();
}
#endregion
#region methods
protected void SaveScreenCount()
{
List<int> scrCounts = ScreenCounts;
int i = 1;
if (divProductSelection.Visible)
{
i = 2;
}
if (scrCounts.Count < ProductIndex)
{
scrCounts.Add(i);
}
else
{
scrCounts[ProductIndex - 1] = i;
}
ScreenCounts = scrCounts;
}
protected void LoadServiceTypes(int _serviceTypeID)
{
string sConn = ConnectionString;
string sSql = "ServiceTypesSelect " + Convert.ToInt32(CustomerID.ToString()) + ", " + Convert.ToInt32(EquipmentTypeID.ToString());
AmsWebLibrary.Module1.PopulateDropdown(ref ddlServiceType, sSql, "1", false, "Select Service Type", sConn, true);
ddlServiceType.Items.Add(new ListItem("Add Custom Service Type", "-2"));
GarageUser g = new GarageUser(CustomerID);
bool gotUserDefinedServiceTypes = g.hasUserDefinedServices();
if (gotUserDefinedServiceTypes)
{
ddlServiceType.Items.Add(new ListItem("Edit Custom Service Type", "-3"));
}
if (_serviceTypeID != 0)
{
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, _serviceTypeID, false, true);
}
}
public void LoadProductTypes()
{
if (ServiceTypeID != 0)
{
service s = new service(ServiceTypeID, EquipmentUnitID, ConnectionString);
ProductTypes = s.ProductTypes;
ProductCount = ProductTypes.Count;
if (ProductTypes.Count > 0)
{
ProductType = ProductTypes[ProductIndex - 1].ProductTypeName;
}
}
}
public void ConfigureNextButton()
{
Button btnNext = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton");
btnNext.Attributes.Remove("onmousedown");
if (wucServiceProductOtherAmsoil1.Visible)
{
btnNext.Attributes.Add("onmousedown", "stepNext('" + Wizard1.ClientID + "');");
btnNext.Attributes.Add("onclick", "return false;");
}
else
{
btnNext.Attributes.Add("onclick", "return true;");
}
}
public void InitProducts()
{
if (ServiceTypeID != 0)
{
List<string> pCodes = ProductCodes;
if ((pCodes.Count > 0) && (pCodes.Count >= ProductIndex))
{
ProductCode = pCodes[ProductIndex - 1];
}
else
{
ProductCode = string.Empty;
}
wucServiceProductRadioList21.EquipmentUnitID = EquipmentUnitID;
wucServiceProductRadioList21.ServiceTypeID = ServiceTypeID;
wucServiceProductRadioList21.ProductTypeID = CurrentProductTypeID;
wucServiceProductOtherAmsoil1.ProductTypeID = CurrentProductTypeID;
wucServiceProductRadioList21.RecentlySelectedLabelID = lblSelected.ClientID;
wucServiceProductRadioList21.PurchaseLinkID = hypPurchase.ClientID;
pnlProductSourceSelection.Visible = true;
wucServiceProductRadioList21.ShowOtherAmsoil = ShowOtherAmsoil;
wucServiceProductRadioList21.LoadProductList();
HtmlGenericControl div = (HtmlGenericControl)pnlProductSourceSelection.FindControl("divGotProducts");
div.Visible = (wucServiceProductRadioList21.ProductCount > (ShowOtherAmsoil ? 2 : 1));
divNoTechContact.Visible = ((wucServiceProductRadioList21.ProductCount == (ShowOtherAmsoil ? 2 : 1)) && (!NoTechContact));
wucServiceProductRadioList21.ProductCode = ProductCode;
if ((ProductCode.Length == 0))
{
List<string> pNames = ProductNames;
if ((pNames.Count > 0) && (pNames.Count >= ProductIndex))
{
ProductName = pNames[ProductIndex - 1];
}
else
{
ProductName = string.Empty;
}
}
if (wucServiceProductRadioList21.NonAmsoilOnly)
{
wucServiceProductRadioList21.SelectedIndex = 0;
pnlProductSourceSelection.Visible = false;
divProductSelection.Visible = true;
wucServiceProductOtherAmsoil1.Visible = false;
}
else
{
divProductSelection.Visible = false;
if (((wucServiceProductRadioList21.SelectedIndex == -1) && (wucServiceProductRadioList21.ProductCount > (ShowOtherAmsoil ? 2 : 1)) &&
(ProductCode.Length == 0) && (ProductName.Length == 0) && (ProductSource != ProductSourceEnum.NonAmsoil) && (ProductSource != ProductSourceEnum.OtherAmsoil)))
{
wucServiceProductRadioList21.SelectedIndex = 0;
ProductSource = ProductSourceEnum.Recommended;
}
else if ((wucServiceProductRadioList21.SelectedIndex != -1) &&
(wucServiceProductRadioList21.SelectedIndex < (wucServiceProductRadioList21.ProductCount - (ShowOtherAmsoil ? 2 : 1))))
{
ProductSource = ProductSourceEnum.Recommended;
}
else if (ProductCode.Length > 0 || ProductSource == ProductSourceEnum.OtherAmsoil)
{
wucServiceProductOtherAmsoil1.ProductCode = ProductCode;
ProductSource = ProductSourceEnum.OtherAmsoil;
}
else if (ProductName.Length > 0 || ProductSource == ProductSourceEnum.NonAmsoil)
{
ProductSource = ProductSourceEnum.NonAmsoil;
}
}
}
else
{
wucServiceProductRadioList21.Visible = false;
}
}
public void UpdateAnchors()
{
if (ServiceTypeID > 0)
{
if (MultiProductServiceSelected)
{
}
else
{
wucServiceProductOtherAmsoil1.SetOtherAmsoilProductNameAndAnchor(hdnProductCodeReturned.Value);
}
}
else
{
wucServiceProductRadioList21.Visible = false;
}
}
public void SaveForm()
{
service s = new service(ServiceID, ConnectionString);
MultiProductServiceSelected = (ProductCount > 0);
s.ProductCodes = ProductCodes;
s.ProductNames = ProductNames;
s.Cost = cStatic.ValC(ServiceCost);
s.ServiceDate = ServiceDate;
s.VehicleUsage = (int)cStatic.ValC(ServiceMiles);
s.ServiceTypeID = ServiceTypeID;
s.EquipmentUnitInstanceID = UnitInstanceID;
s.Details = Details;
s.SendEmail = chkSendEmailNextChange.Checked;
s.NextEmailDate = NextEmailDate;
LoadProductTypes();
s.ProductTypes = ProductTypes;
if (s.saveToDB() && (ServiceID == 0))
{
ServiceID = s.ServiceID;
}
//OnServiceUpdateEvent(System.EventArgs.Empty);
}
public bool GetMultiProductServiceSelected()
{
int lServiceTypeID = ServiceTypeID;
bool IsMultiProduct = false;
if (lServiceTypeID > 0)
{
ServiceType st = new ServiceType(lServiceTypeID, ConnectionString);
IsMultiProduct = st.IsMultiProduct();
return IsMultiProduct;
}
else
{
return false;
}
}
public bool GetNoTechContact()
{
int lServiceTypeID = ServiceTypeID;
if (lServiceTypeID > 0)
{
ServiceType st = new ServiceType(lServiceTypeID, ConnectionString);
bool ntc = st.NoTechContact();
return ntc;
}
else
{
return false;
}
}
private void showProductSelectionHelp(int _nextStepIndex)
{
if (_nextStepIndex == 1)
{
divDefaultInstructions.Visible = true;
divOtherAMSOILInstructions.Visible = false;
divOtherInstructions.Visible = false;
}
else if (wucServiceProductOtherAmsoil1.Visible)
{
divDefaultInstructions.Visible = false;
divOtherAMSOILInstructions.Visible = true;
divOtherInstructions.Visible = false;
}
else
{
divDefaultInstructions.Visible = false;
divOtherAMSOILInstructions.Visible = false;
divOtherInstructions.Visible = true;
}
}
private void SetStepDisplay(int _nextStepIndex)
{
if (_nextStepIndex == 0)
{
StepDisplay = "Step 1";
ddlServiceType.Focus();
}
else if (_nextStepIndex == 1)
{
StepDisplay = "Step " + (1 + ProductIndex).ToString() + " of " + (3 + ProductCount).ToString();
showProductSelectionHelp(_nextStepIndex);
}
else if (_nextStepIndex == 2)
{
StepDisplay = "Step " + (2 + ProductCount).ToString() + " of " + (3 + ProductCount).ToString();
showProductSelectionHelp(_nextStepIndex);
txtDetails.Focus();
//txtServiceCost.Focus();
}
else if (_nextStepIndex == 3)
{
StepDisplay = "Step " + (3 + ProductCount).ToString() + " of " + (3 + ProductCount).ToString();
chkSendEmailNextChange.Focus();
}
else if (_nextStepIndex == 4)
{
StepDisplay = string.Empty;
}
}
private void PopulateForm()
{
service srv = new service(ServiceID, ConnectionString);
EquipmentUnit eu = new EquipmentUnit();
eu.EquipmentUnitID = srv.EquipmentUnitID;
EquipmentTypeID = srv.EquipmentTypeID;
LoadServiceTypes(EquipmentTypeID);
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, srv.ServiceTypeID, false, true);
if (srv.Cost > 0)
{
ServiceCost = srv.Cost.ToString();
}
ServiceDate = srv.ServiceDate;
ServiceMiles = srv.VehicleUsage.ToString();
UnitInstanceID = srv.EquipmentUnitInstanceID;
EquipmentUnitID = srv.EquipmentUnitID;
Details = srv.Details;
chkSendEmailNextChange.Checked = srv.SendEmail;
NextEmailDate = srv.NextEmailDate;
ProductCodes = srv.ProductCodes;
ProductNames = srv.ProductNames;
InfoLink = srv.getInfoLink();
if (ServiceID == 0)
{
WizardCaption = "Add New Service";
}
else
{
WizardCaption = "Edit Service";
}
if (Request.QueryString["Dup"] != null)
{
if (Convert.ToInt32(Request.QueryString["Dup"]) > 0)
{
ServiceID = 0;
WizardCaption = "Repeat Service";
}
}
List<ProductSourceEnum> pSources = new List<ProductSourceEnum>();
List<int> scrCounts = new List<int>();
while (pSources.Count < ProductCodes.Count)
{
pSources.Add(ProductSourceEnum.Recommended);
scrCounts.Add(1);
}
ProductSources = pSources;
ScreenCounts = scrCounts;
EquipmentType et = new EquipmentType(EquipmentTypeID);
et.load();
if (et.HoursForMiles)
{
lblVehicleMilesCaption.Text = lblVehicleMilesCaption.Text.Replace("Vehicle Miles", "Equipment Hours");
}
}
private string ValidateProduct()
{
bool bValid = false;
string sAlert = string.Empty;
LoadProductTypes();
if (ProductSource == ProductSourceEnum.Recommended)
{
bValid = (wucServiceProductRadioList21.SelectedIndex > -1);
if (!bValid)
{
sAlert = "Please select a recommended AMSOIL product";
}
}
else if (ProductSource == ProductSourceEnum.OtherAmsoil)
{
bValid = (wucServiceProductOtherAmsoil1.ProductCode.Length > 2);
if (!bValid)
{
sAlert = "Please select an AMSOIL product. Enter at least 3 characters.";
}
else
{
product p = new product();
p.ConnectionString = ConnectionString;
bValid = p.validCode(wucServiceProductOtherAmsoil1.ProductCode);
if (!bValid)
{
sAlert = "Please enter a valid AMSOIL product code";
}
}
}
else if (ProductSource == ProductSourceEnum.NonAmsoil)
{
bValid = true;
}
return sAlert;
}
private void SaveProduct()
{
List<string> pCodes = ProductCodes;
while (pCodes.Count < ProductIndex)
{
pCodes.Add(string.Empty);
}
pCodes[ProductIndex - 1] = ProductCodeSelected;
if (ProductCodeSelected.Length == 0)
{
// hack to get empty string into list member
pCodes[ProductIndex - 1] = "hello";
pCodes[ProductIndex - 1] = string.Empty;
}
else
if (ProductCodeSelected.Length == 0)
{
// hack
pCodes[ProductIndex - 1] = "hello";
pCodes[ProductIndex - 1] = ProductCodeSelected;
}
ProductCodes = pCodes;
List<string> pNames = ProductNames;
while (pNames.Count < ProductIndex)
{
pNames.Add(string.Empty);
}
pNames[ProductIndex - 1] = ProductNameSelected;
if (ProductNameSelected.Length == 0)
{
// hack to get empty string into list member
pNames[ProductIndex - 1] = "hello";
pNames[ProductIndex - 1] = string.Empty;
}
else
{
// hack
pNames[ProductIndex - 1] = "hello";
pNames[ProductIndex - 1] = ProductNameSelected;
}
ProductNames = pNames;
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
pSources[ProductIndex - 1] = ProductSource;
ProductSources = pSources;
}
private void InitInputs()
{
wucServiceProductRadioList21.ProductCode = string.Empty;
wucServiceProductOtherAmsoil1.ProductCode = string.Empty;
wucServiceProductOtherAmsoil1.ProductName = string.Empty;
wucServiceProductNonAmsoil1.ProductName = string.Empty;
ProductCode = string.Empty;
ProductName = string.Empty;
}
protected void setInitialProductSource()
{
if (wucServiceProductRadioList21.SelectedIndex > -1 ||
((wucServiceProductRadioList21.ProductCount > 0) && ServiceID == 0 && ProductCode.Length == 0 && ProductName.Length == 0))
{
ProductSource = ProductSourceEnum.Recommended;
}
else if ((ProductCode.Length > 0) || (((wucServiceProductRadioList21.ProductCount == 0)) && ServiceID == 0))
{
ProductSource = ProductSourceEnum.OtherAmsoil;
if (productCode.Length > 0)
{
wucServiceProductOtherAmsoil1.ProductCode = ProductCode;
}
}
else if (ProductName.Length > 0)
{
ProductSource = ProductSourceEnum.NonAmsoil;
if (ProductName.Length > 0)
{
wucServiceProductNonAmsoil1.ProductName = ProductName;
}
}
ProductNameRecentlySelected = ProductNameRecentlySelected;
hypPurchase.NavigateUrl = wucServiceProductRadioList21.PurchaseLink;
}
private void SetInputValues()
{
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
ProductSource = pSources[ProductIndex - 1];
ProductSources = pSources;
List<string> pCodes = ProductCodes;
while (pCodes.Count < ProductIndex)
{
pCodes.Add(string.Empty);
}
ProductCode = pCodes[ProductIndex - 1];
ProductCodes = pCodes;
List<string> pNames = ProductNames;
while (pNames.Count < ProductIndex)
{
pNames.Add(string.Empty);
}
ProductName = pNames[ProductIndex - 1];
ProductNames = pNames;
}
#endregion
}
}
Thank you for taking a look at it.
Mark
ASPX -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ServiceAdd.aspx.cs" Inherits="AMSOILGarage.ServiceAdd" %>
<%@ Register src="WebControls/wucServiceAdd.ascx" tagname="wucServiceAdd" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MyAMSOILGarage - Add Service Wizard</title>
<link href="Theme/css/main.css" type="text/css" media="screen" rel="stylesheet" />
<link href="Theme/css/wizard.css" type="text/css" media="screen" rel="stylesheet" />
<link href="Theme/css/serviceWizard.css" type="text/css" media="screen" rel="stylesheet" />
<script type="text/javascript" language="javascript">
function getProduct() {
if (navigator.appName == "Microsoft Internet Explorer") {
var cSearchValue = showModalDialog("/lit/g1490/1490.html", "Select Product", "dialogWidth:600px;dialogHeight:465px;");
SetSearchValue(cSearchValue);
} else {
winModalWindow = window.open("/lit/g1490/1490.html", "Select Product", "dependent=yes,width:600px,height=465px")
winModalWindow.focus()
}
return false;
}
function SetSearchValue(cSearchValue) {
if (cSearchValue != null) {
document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_txtOtherAmsoilProductCode').value = cSearchValue;
lookupOnBlur();
}
}
function toggle(id) {
var styleObj = document.getElementById('instructionSection').style;
if (styleObj.display == 'block') {
document.getElementById(id).innerHTML = "Show Instructions <img src=\"/MyGarage/images/miniHelp.png\" />";
styleObj.display = 'none';
} else {
document.getElementById(id).innerHTML = "Hide Instructions <img src=\"/MyGarage/images/miniHelp.png\" />";
styleObj.display = 'block';
}
}
</script>
<script type="text/javascript" src="fancybox/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.0.pack.js"></script>
<link rel="stylesheet" type="text/css" href="fancybox/fancybox.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$("a.tutorial").fancybox({
'titlePosition' : 'over',
'transitionIn' : 'none',
'transitionOut' : 'none'
});
$("a.whatsThis").fancybox({
'titleShow' : false,
'padding' : 15
});
});
function pageLoad(sender, args) {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function() {
$("a.tutorial").fancybox({
'titlePosition' : 'over',
'transitionIn' : 'none',
'transitionOut' : 'none'
});
$("a.whatsThis").fancybox({
'titleShow' : false,
'padding' : 15
});
});
}
</script>
</head>
<body onkeydown="if (event.keyCode==13) {event.keyCode=9; return event.keyCode }" >
<form id="form1" runat="server">
<telerik:RadScriptManager ID="ScriptManager1" runat="server">
</telerik:RadScriptManager>
<div id="rightHeader">
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server">
<ContentTemplate>
<div id="rightHeaderNav">
<h3 class="left">
Welcome,
<%= Session["FirstLast"]%></h3>
<h3 class="right topFont">
<asp:LinkButton ID="lbtBack" runat="server" OnClick="lbtBack_Click" CssClass="">Back to <%= wucServiceAdd1.NickName%></asp:LinkButton>
</h3>
</div>
<div id="rightDisplayName">
<h1 class="left">
<%= wucServiceAdd1.WizardCaption%></h1>
<div class="right" id="progressBar">
<asp:UpdateProgress ID="progress1" DisplayAfter="1" runat="server">
<ProgressTemplate>
<div>
<img src="/MyGarage/images/ajax-loader.gif" alt="Please wait..." />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="actionBar">
<h3 class="center"><%= wucServiceAdd1.NickName%></h3><!--<a class="tutorial right" style="margin: -29px 8px 0 0;"href="http://www.adobe.com/jp/events/cs3_web_edition_tour/swfs/perform.swf"><img src="/MyGarage/images/help.png" title="Video Tutorial" alt="Video Tutorial" /></a>-->
</div>
<div class="content">
<div>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Always" runat="server">
<ContentTemplate>
<asp:HiddenField ID="hdnErrorNotification" runat="server" />
<uc1:wucServiceAdd ID="wucServiceAdd1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<script type="text/javascript" language="javascript">
Sys.Application.add_load(load);
function load() {
var hdn = document.getElementById('hdnErrorNotification');
if (hdn.value != '') {
alert(hdn.value);
hdn.value = '';
}
}
</script>
</form>
</body>
</html>
ASPX Code Behind -
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AMSOILGarage.classes;
namespace AMSOILGarage
{
public partial class ServiceAdd : cGarageAJAX
{
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager1.AsyncPostBackTimeout = 3600;
}
protected void lbtBack_Click(object sender, EventArgs e)
{
Response.Redirect("GarageVehicle.aspx?id=" + wucServiceAdd1.UnitInstanceID.ToString());
}
protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
AmsWebLibrary.Module1.LogError("ServiceAdd.ScriptManager1_AsyncPostBackError", e.Exception, false, string.Empty, string.Empty);
}
protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is ErrorNotificationEventArgs)
{
ErrorNotificationEventArgs ee = (ErrorNotificationEventArgs)e;
hdnErrorNotification.Value = ee.ErrorNotification;
return true;
}
return false;
}
}
}
WebUserControl -
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="wucServiceAdd.ascx.cs" Inherits="AMSOILGarage.WebControls.wucServiceAdd" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="wucServiceProductRadioList2.ascx" TagName="wucServiceProductRadioList2" TagPrefix="uc1" %>
<%@ Register Src="wucServiceProductOtherAmsoil.ascx" TagName="wucServiceProductOtherAmsoil" TagPrefix="uc2" %>
<%@ Register Src="wucServiceProductNonAmsoil.ascx" TagName="wucServiceProductNonAmsoil" TagPrefix="uc3" %>
<%@ Register TagPrefix="uc4" Namespace="AMSOILGarage.classes" Assembly="AMSOILGarage" %>
<script type="text/javascript">
function checkMeOnly(opt, recentlySelectedLabelID, optionText, productCode, purchaseLinkID, purchaseLinkText, optIDFragment) {
resetRadioButtons(optIDFragment);
opt.checked = true;
var hdn = document.getElementById('wucServiceAdd1_hdnProductSource');
hdn.value = '1';
}
function resetRadioButtons(optIDFragment) {
var allInputs = document.getElementsByTagName("input");
for (i = 0; i < allInputs.length; i++) {
var input = allInputs[i];
if (input.id != null) {
if ((input.type == "radio") && (input.id.indexOf(optIDFragment) > -1)) {
input.checked = false;
}
}
}
}
function lookupOnBlur() {
if (document.getElementById('wucServiceAdd1_hdnMoveOn') != null) {
if (document.getElementById('wucServiceAdd1_hdnMoveOn').value != '1') {
setTimeout("document.forms[0].submit();", 300);
}
document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_hdnDoLookup').value = '1';
}
}
function resetAndSubmitForm() {
}
function stepNext(WizardID) {
if (document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_hdnDoLookup') != null) {
if (document.getElementById('wucServiceAdd1_Wizard1_wucServiceProductOtherAmsoil1_hdnDoLookup').value != '1') {
setTimeout("document.forms[0].submit();", 300);
}
document.getElementById('wucServiceAdd1_hdnMoveOn').value = '1';
}
}
// function doPostBackAsync(eventName, eventArgs) {
// var prm = Sys.WebForms.PageRequestManager.getInstance();
// if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
// prm._asyncPostBackControlIDs.push(eventName);
// }
// if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
// prm._asyncPostBackControlClientIDs.push(eventName);
// }
// __doPostBack(eventName, eventArgs);
// }
</script>
<!--<asp:Label ID="lblWizardCaption" runat="server" Text=""></asp:Label>-->
<input id="hdnCode" type="hidden" />
<input id="hdnName" type="hidden" />
<input id="hdnAnchor" type="hidden" />
<asp:HiddenField ID="hdnMoveOn" runat="server" />
<asp:HiddenField ID="hdnProductCodeReturned" Value="" runat="server" />
<asp:HiddenField ID="hdnUpdateAnchors" Value="0" runat="server" />
<asp:Label ID="lblUnitInstanceID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductCount" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblServiceID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblEquipmentTypeID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblEquipmentUnitID" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblStepDisplay" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblEquipmentDescriptor" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblServiceType" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductType" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductIndex" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductSource" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblShowServiceEdit" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblNoTechContact" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblPreviousServiceTypeID" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductTypeCount" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductCodes" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductNames" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblProductSources" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblScreenCounts" runat="server" Visible="False" Text=""></asp:Label>
<asp:Label ID="lblNickname" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductSourceSelected" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblDivProductSelectionWasShowing" runat="server" Visible="false" Text=""></asp:Label>
<asp:Label ID="lblProductName" runat="server" Visible="false" Text=""></asp:Label>
<asp:HiddenField ID="hdnProductSource" runat="server" />
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
<StyleSheets>
<telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Calendar.css" Assembly="Telerik.Web.UI" />
<telerik:StyleSheetReference Name="Telerik.Web.UI.Skins.Web20.Calendar.Web20.css" Assembly="Telerik.Web.UI" />
</StyleSheets>
</telerik:RadStyleSheetManager>
<div id="wizard">
<uc4:CustomWizard ID="Wizard1" runat="server" OnNextButtonClick="Wizard1_NextButtonClick" OnFinishButtonClick="Wizard1_FinishButtonClick" Width="100%" OnPreviousButtonClick="Wizard1_PreviousButtonClick" OnSideBarButtonClick="Wizard1_SideBarButtonClick" CancelDestinationPageUrl="/amsoilgarage.aspx" DisplayCancelButton="False" onactivestepchanged="Wizard1_ActiveStepChanged">
<SideBarTemplate>
<asp:DataList ID="SideBarList" runat="server" OnItemDataBound="SideBarList_ItemDataBound">
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" runat="server"></asp:LinkButton>
</ItemTemplate>
<SelectedItemStyle Font-Bold="True" />
</asp:DataList>
</SideBarTemplate>
<StartNextButtonStyle CssClass="button blue" />
<FinishCompleteButtonStyle CssClass="button blue" />
<StepNextButtonStyle CssClass="button blue" />
<FinishPreviousButtonStyle CssClass="button gray" />
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Select Service Type">
<h3><span class="wizardStep">Select Service Type</span></h3><br/>
<div class="formStyle">
<table>
<tr>
<td width="120px">
<asp:Button ID="btnUpdatePurchaseLinks" CssClass="invisible" runat="server" Text="You can't see me" />Service: <span class="required">*</span>
</td>
<td>
<asp:DropDownList ID="ddlServiceType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlServiceType_SelectedIndexChanged"></asp:DropDownList>
</td>
</tr>
<tr>
<td>
Date: <span class="required">*</span>
</td>
<td>
<telerik:RadDatePicker ID="rdpServiceDate" runat="server" MinDate="1900-01-01" ToolTip="Open the calendar popup" Skin="Web20" Calendar-ShowRowHeaders="False">
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
<DateInput DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy"></DateInput>
</telerik:RadDatePicker>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblVehicleMilesCaption" runat="server" Text="">Vehicle Miles:</asp:Label>
</td>
<td>
<telerik:RadNumericTextBox ID="txtVehicleMiles" MaxLength="8" Width="100px" runat="server" Skin="Web20">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
</tr>
</table>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both;">
<hr/>
<p>Adding a service to this equipment record means you will be tracking a maintenance action and a possible AMSOIL product (or other non-AMSOIL product) associated with this maintenance.</p>
<span class="left">
<p>1. First, define the <b>Service</b> by choosing a service type. You can pick from any of the types we have provided for you, or choose <b>Custom Service Type</b> from the bottom of the list to add your own.</p>
<p>2. Next, select a <b>Date</b> of service. You can enter it in dd/mm/yyyy format, or use the calendar assistant link to the left to choose a date.</p>
</span>
<span class="left">
<p>3. The <b>Equipment Miles</b> text box will automatically fill in with a number based upon the information you have entered into this equipment record’s <b>Current Mileage</b> field. If you would like to change this, you can type any mileage into the text field.</p>
<p>4. When you are ready to proceed, click the <b>Next</b> button.</p>
</span>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Select Products">
<h3><%= StepDisplay %> - <span class="wizardStep"><b>Select <%= ProductTypeDisplay%></b> for <%= ServiceType%> Service</span></h3><br/>
<p>
<asp:Panel ID="pnlProductSourceSelection" runat="server">
<div style="padding-left: 10px;">
<asp:Panel ID="pnlRecommended" runat="server">
<div runat="server" id="divGotProducts">
<h3>Recommended AMSOIL Products</h3>
</div>
<div runat="server" id="divNoTechContact">
<h3>Recommended AMSOIL Products</h3>
<p class="instructions">
AMSOIL currently does not currently recommend a specific product for this service
on this equipment. You may call <%= TechServicesPhone%> or <%= TechServicesEmail%> for
more help in finding a product recommendation.
</p>
</div>
<div>
<uc1:wucServiceProductRadioList2 ID="wucServiceProductRadioList21" runat="server" />
</div>
</asp:Panel>
</div>
</asp:Panel>
</p>
<div runat="server" id="divProductSelection">
<uc2:wucServiceProductOtherAmsoil ID="wucServiceProductOtherAmsoil1" runat="server" />
<uc3:wucServiceProductNonAmsoil ID="wucServiceProductNonAmsoil1" runat="server" />
</div>
<!--<div runat="server" id="divRecentlySelected">
<%= ProductType%>:<asp:HyperLink ID="hypPurchase" runat="server">Purchase</asp:HyperLink>
<asp:Label ID="lblSelected" runat="server" Text=""></asp:Label>
</div>-->
<div id="divInfo" runat="server" class="invisible">
<p>
<asp:HyperLink ID="hypInfo" runat="server">Click here</asp:HyperLink> for information on selecting the correct AMSOIL product for your vehicle, or call 1-800-399-TECH for a live technical rep.
</p>
</div>
<div id="divNoInfo" runat="server" class="invisible">
<p>For information on selecting the correct AMSOIL product for your vehicle, call 1-800-399-TECH for a live technical rep.</p>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both;">
<hr/>
<div id="divDefaultInstructions" runat="server" class="clear">
<p>Based upon the service type you have chosen for this equipment, this next step will offer you the chance to attach an AMSOIL product or other product to this service record. <b>You can click on the radio buttons just above the bold text to highlight any one of these four options.</b></p>
<span class="left">
<p>
1. If your equipment type and engine are represented in one of the AMSOIL databases of known equipment, we will attempt to match products for you under the <b>AMSOIL Recommended Products</b> section. If products are available, you may use one of the radio selection buttons to choose a product. If you are setting up a record for a multi-step service (such as <b>Change Engine Oil & Filter</b>) you will need to select products several times to complete this step.
<br/><i><b>NOTE:</b> If no products are found or we cannot match this equipment, this area has contact information which you can use to request product selection help from the <b>AMSOIL Technical Services Department.</b></i>
</p>
<p>2. If we did not match specific products to the equipment you are attempting to service, you can also choose to have the website assist you with finding and attaching an AMSOIL product yourself. Choose the <b>AMSOIL Products</b> section to lookup a product.</p>
</span>
<span class="left">
<p>3. If you need to enter a product for a service which AMSOIL does not offer (such as electrical parts or tires), you can select the <b>Other Products</b> section to use a free form textbox to attach a non-AMSOIL part number to this service record.</p>
<p>4. If you do not want to attach any products to this service at this time, select the <b>None</b> option.</p>
<p>5. When you are ready to move on, click the <b>Next</b> button. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
<div id="divOtherAMSOILInstructions" runat="server" class="clear">
<p>In order to help you select an AMSOIL product for this service record, we have included a product lookup feature.</p>
<span class="left">
<p>1. Enter your AMSOIL Product Code (if known). To select from a list of AMSOIL products, enter the first 3 characters of the Product Code then click TAB or NEXT.</p>
<p>2. If you would like more help determining which motor oil you would like to use for an oil change service, click on the <b>Lookup a Motor Oil</b> button to use our Product Recommendation and Drain Interval Guide. It consists of a series of questions which will guide you to your best lubricant options. When finished you will be able to click on a motor oil product and attach it to this service.</p>
</span>
<span class="left">
<p>3. When you have determined the AMSOIL product you wish to use for this service record, click <b>Next</b> to continue. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
<div id="divOtherInstructions" runat="server" class="clear">
<span class="left">
<p>1. Use the text box above to enter descriptive details about the non-AMSOIL product your are attaching to this equipment’s service record.</p>
</span>
<span class="left">
<p>2. Click <b>Next</b> to continue. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3" runat="server" Title="Service Details/Procedures Comments">
<h3><%= StepDisplay %> - <span class="wizardStep"><b>(Optional)</b> - Procedure Details</span></h3><br/>
<div class="formStyle">
<table>
<tr>
<td valign="top">
Details:
</td>
<td>
<telerik:RadTextBox ID="txtDetails" TextMode="MultiLine" Height="80" Width="50%"
MaxLength="1000" runat="server" Skin="Web20">
</telerik:RadTextBox><br/>
</td>
</tr>
<tr>
<td width="120px">
Service Cost:
</td>
<td>
<telerik:RadNumericTextBox ID="txtServiceCost" MaxLength="8" Width="100px" runat="server" Skin="Web20" MaxValue="1000000" Type="Currency">
<NumberFormat DecimalDigits="2" />
</telerik:RadNumericTextBox>
<div runat="server" id="divTechInfo">
<a href="#tech" class="whatsThis">Technical Information</a>
<div class="invisible">
<div id="tech">
<table>
<tr runat="server" id="trTech">
<td>
<h3><asp:Label ID="lblTechCaption" runat="server" Text=""></asp:Label></h3>
<asp:Label ID="lblTech" runat="server" Text=""></asp:Label>
<p align="right"><a href="#" onclick="$.fancybox.close()" class="button gray">Close</a></p>
</td>
</tr>
</table>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="clear instructions" id="instructionSection" style="display: none;">
<hr/>
<p>The step allows you to provide some optional maintenance procedure details for your records.</p>
<span class="left">
<p>1. If you would like to record a <b>Service Cost</b> for this maintenance record, you may do so in the text box available.</p>
<p>2. You can also provide details about the service in the <b>Details</b> text box. This can be useful for reference the next time you look up this service item.</p>
</span>
<span class="left">
<p>3. Click <b>Next</b> to continue. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep4" runat="server" Title="E-Mail Reminders">
<h3> <%= StepDisplay %> - <span class="wizardStep"><b>(Optional)</b> - Set Email Reminder</span></h3> <br/>
<div class="formStyle">
<p><asp:CheckBox ID="chkSendEmailNextChange" runat="server" /> Send me an e-mail reminder to follow up on this procedure</p>
<p>
<div style="display: none; visibility: hidden;">
<table>
<tr>
<td width="150px">
Recommended Oil Change Date: <span class="required">*</span>
</td>
<td>
<asp:Label ID="lblNextOilChangeDate" Font-Bold="true" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
</div>
<table>
<tr>
<td width="220px">
Select Your Email Reminder Date:
</td>
<td>
<telerik:RadDatePicker ID="rdpNextEmailDate" runat="server" MinDate="1900-01-01" ToolTip="Open the calendar popup" CssClass="RadCalendar_Default" Skin="Web20" Calendar-ShowRowHeaders="False">
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Web20"></Calendar>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
<DateInput DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy"></DateInput>
</telerik:RadDatePicker>
</td>
</tr>
</table>
<br/><b>Note:</b> To ensure that your important MyAMSOILGarage™ email messages are not filtered into your Spam, Junk or Bulk Mail folder, select the Add/Save to Address Book function in your email browser and follow the appropriate instructions to add AMSOIL to your safe senders list. See your email providers Safe Senders List instructions for more details on how to accomplish this.
</p>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both;">
<hr/>
<p>The final step allows you to set up an email reminder for this service to the address we have on file for your MyAMSOILGarage™ account. If you do not wish to set up an email reminder right now, you will also be able to do so later from the <b>Email Reminders</b> screen.</p>
<span class="left">
<p>1. Check the box next to “<b>Send me an e-mail reminder to follow up in this procedure</b>” to enable this feature.</p>
<p>2. Set the <b>Email Reminder Date</b>. You can enter it in dd/mm/yyyy format, or use the calendar assistant link to the left to choose a date.</p>
</span>
<span class="left">
<p>3. Click <b>Finish</b> to save this equipment service record. If you would like to go back and make changes to details from the last screen, click the “<b>Previous</b>” button.</p>
</span>
</div>
</div>
<hr class="clear" />
</asp:WizardStep>
<asp:WizardStep ID="WizardStep5" runat="server" Title="Complete" StepType="Complete">
<div id="wizardEnd">
<h3 class="center"><%= ServiceType%> recorded for <%= NickName%></h3><br/><br />
<h4>Please select your next option:</h4><br />
<asp:ImageButton ID="btnBackToEquipment" ImageUrl="~/AmsoilGarage/Theme/images/equip1.gif" OnClick="btnBackToEquipment_Click" runat="server" /> <a href="#details" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/><br />
<asp:ImageButton ID="btnAddNewService" ImageUrl="~/AmsoilGarage/Theme/images/add1.gif" OnClick="btnAddNewService_Click" runat="server" /> <a href="#service" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br /><br />
<asp:ImageButton ID="btnEmail" ImageUrl="~/AmsoilGarage/Theme/images/email1.gif" OnClick="btnEmail_Click" runat="server" /> <a href="#reminders" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br /><br />
<div runat="server" id="productLookup">
<h4>Or...</h4><br />
<asp:ImageButton ID="btnAddNewEquipment" ImageUrl="~/AmsoilGarage/Theme/images/addEquip1.gif" OnClick="btnAddNewEquipment_Click" runat="server" /><a href="#equipment" class="whatsThis" alt="What's This?" title="What's This?"><img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a>
</div>
<!-- Help Information -->
<div style="display: none;">
<div id="details">
<h3>View Equipment Details</h3>
<p>Look at the information you used to create this equipment record.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
<div id="service">
<h3>Add New Service</h3>
<p>Start tracking maintenance actions and products for this equipment record.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
<div id="reminders">
<h3>Set-Up Email Reminders</h3>
<p>Set up a scheduled email to remind you to look at this equipment record.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
<div id="equipment">
<h3>Add New Equipment</h3>
<p>Start the process over and add another piece of equipment to your account.</p>
<p align="right"><br/>
<a href="#" onclick="$.fancybox.close()" class="button gray">Close</a>
</p>
</div>
</div>
<div class="clear instructionLink">
<br/>
<a id="soIll" href="javascript:toggle('soIll');" class="right">Show Instructions <img src="/AmsoilGarage/Theme/images/miniHelp.png" /></a><br/>
<div class="instructions" id="instructionSection" style="display: none; clear: both; text-align: left;">
<hr/>
<p>To get started, you must first choose a type of equipment to add to your MyAMSOILGarage™ account. Follow these steps to add a new piece of equipment:</p>
<span class="left">
<p>1. Choose the <b>Equipment Details</b> button to see a summary screen of everything you just entered for this equipment. From this screen, you can <b>Adjust Equipment Details</b> if something may not be correct or <b>Add a Photo</b> to this equipment record.</p>
<p>2. Choose the <b>Add New Service</b> button if you would like to begin tracking your maintenance of this equipment and start attaching products to the equipment.</p>
</span>
<span class="left">
<p>3. Choose <b>Set Up E-Mail Reminders</b> if you would like to schedule maintenance email reminders for this piece of equipment. This can also be done after you have attached products and maintenance types through the Add New Service option.</p>
<p>4. Or, if you have more equipment records which you would like to enter now, you may choose <b>Add Additional Equipment</b> to start the process over and redefine another equipment record.</p>
</span>
</ol>
</div>
</div>
<hr class="clear" />
</div>
</asp:WizardStep>
</WizardSteps>
<StepNavigationTemplate>
<asp:Button CausesValidation="False" CssClass="button gray" CommandName="MovePrevious" ID="StepPreviousButton"
runat="server" Text="Previous" />
<asp:Button CommandName="MoveNext" CssClass="button blue" ID="StepNextButton" runat="server" Text="Next" />
</StepNavigationTemplate>
<CancelButtonStyle CssClass="button black" />
<SideBarStyle CssClass="wizardSidebar" />
</uc4:CustomWizard>
</div>
<asp:Button ID="btnServiceCustomater" CssClass="invisible" runat="server" Text="Anna" />
<cc1:ModalPopupExtender runat="server" ID="mpeCustomService" TargetControlID="btnServiceCustomater"
PopupControlID="pnlCustomService" BackgroundCssClass="modalBackground" DropShadow="false" />
<asp:Panel ID="pnlCustomService" runat="server" CssClass="modalPopup">
<div class="modalHeader"></div>
<div class="modal">
<!-- Add Custom Service -->
<div runat="server" id="divAddCustomService">
<h3>Add Custom Service Item</h3>
<p>
<span class="formStyle"><asp:TextBox ID="txtNewCustomService" runat="server"></asp:TextBox></span>
</p>
<p align="right">
<asp:Button ID="btnSaveNewCustomService" CssClass="button blue" runat="server" Text="Save" OnClick="btnSaveNewCustomService_Click" />
<asp:Button ID="btnCancelNewCustomService" CssClass="button gray" runat="server" Text="Cancel" OnClick="btnCancelNewCustomService_Click" />
</p>
</div>
<!-- Edit Custom Service -->
<div runat="server" id="divUpdateCustomService">
<h3>Edit Custom Service Item(s)</h3>
<asp:GridView ID="grdUpdateServiceTypes" runat="server" AutoGenerateColumns="False"
DataKeyNames="ServiceTypeUserDefinedID" DataSourceID="sdsSTUD" OnRowDataBound="grdUpdateServiceTypes_RowDataBound"
OnRowCommand="grdUpdateServiceTypes_RowCommand" OnRowUpdated="grdUpdateServiceTypes_RowUpdated">
<Columns>
<asp:BoundField DataField="ServiceTypeUserDefinedID" HeaderText="ServiceTypeUserDefinedID"
InsertVisible="False" ReadOnly="True" SortExpression="ServiceTypeUserDefinedID"
Visible="False" />
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
Visible="False" />
<asp:BoundField DataField="ServiceType" HeaderText="ServiceType" SortExpression="ServiceType" />
<asp:CommandField ShowEditButton="True">
<ControlStyle CssClass=" " />
</asp:CommandField>
<asp:BoundField DataField="EquipmentTypeID" HeaderText="EquipmentTypeID" SortExpression="EquipmentTypeID"
Visible="False" />
<asp:TemplateField HeaderText="" ShowHeader="False" ItemStyle-CssClass="">
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" Font-Size="8pt" runat="server" OnClientClick="return confirm('OK to Delete?');"
CausesValidation="false" CommandName="Remove" CommandArgument='<%# Eval("ServiceTypeUserDefinedID") %>'
Text="Remove"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sdsSTUD" runat="server" ConnectionString="<%$ ConnectionStrings:AmsoilGarageConnectionString %>"
SelectCommand="SELECT * FROM [ServiceTypeUserDefined] WHERE (([EquipmentTypeID] = @EquipmentTypeID) AND ([CustomerID] = @CustomerID)) ORDER BY [ServiceType]"
DeleteCommand="DELETE FROM [ServiceTypeUserDefined] WHERE [ServiceTypeUserDefinedID] = @ServiceTypeUserDefinedID"
InsertCommand="INSERT INTO [ServiceTypeUserDefined] ([CustomerID], [ServiceType], [EquipmentTypeID]) VALUES (@CustomerID, @ServiceType, @EquipmentTypeID)"
UpdateCommand="UPDATE [ServiceTypeUserDefined] SET [ServiceType] = @ServiceType, [EquipmentTypeID] = @EquipmentTypeID WHERE [ServiceTypeUserDefinedID] = @ServiceTypeUserDefinedID">
<SelectParameters>
<asp:ControlParameter ControlID="lblEquipmentTypeID" Name="EquipmentTypeID" PropertyName="Text"
Type="Int32" />
<asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="ServiceTypeUserDefinedID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ServiceType" Type="String" />
<asp:ControlParameter ControlID="lblEquipmentTypeID" Name="EquipmentTypeID" PropertyName="Text"
Type="Int32" />
<asp:Parameter Name="ServiceTypeUserDefinedID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="Int32" />
<asp:Parameter Name="ServiceType" Type="String" />
<asp:ControlParameter ControlID="lblEquipmentTypeID" Name="EquipmentTypeID" PropertyName="Text"
Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<%--<asp:Button ID="btnCancelUpdateCustomServic" runat="server" Text="Cancel" OnClick="btnCancelUpdateCustomService_Click" />--%>
<p align="right">
<asp:Button ID="btnSaveUpdateCustomService" CssClass="button blue" runat="server"
Text="Done" OnClick="btnSaveUpdateCustomService_Click" />
</p>
</div>
</div>
<div class="modalFooter"></div>
</asp:Panel>
WebUserControl Code Behind -
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AMSOILGarage.classes;
using AmsDbVB;
using AmsDbLib;
using GarageLib;
namespace AMSOILGarage.WebControls
{
public partial class wucServiceAdd : cGarageDataControl
{
public enum ProductSourceEnum { Recommended = 1, OtherAmsoil = 2, NonAmsoil = 3 };
#region properties
public int ServiceID
{
get
{
Label lbl = (Label)FindControl("lblServiceID");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblServiceID");
lbl.Text = value.ToString();
}
}
public string NickName
{
get
{
Label lbl = (Label)FindControl("lblNickName");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblNickName");
lbl.Text = value;
}
}
public int UnitInstanceID
{
get
{
Label lbl = (Label)FindControl("lblUnitInstanceID");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblUnitInstanceID");
lbl.Text = value.ToString();
if (value > 0)
{
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
v.UnitInstanceID = value;
bool bSuccess = v.setServiceValues();
if (bSuccess)
{
if (v.CustomerID != CustomerID)
{
Response.Redirect("~/");
}
EquipmentDescriptor = v.EquipmentDescriptor;
EquipmentTypeID = v.EquipmentTypeID;
EquipmentUnitID = v.EquipmentUnitID;
}
NickName = v.getNickname(UnitInstanceID);
}
}
}
public int EquipmentUnitID
{
get
{
Label lbl = (Label)FindControl("lblEquipmentUnitID");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblEquipmentUnitID");
lbl.Text = value.ToString();
}
}
private ProductSourceEnum productSource = ProductSourceEnum.NonAmsoil;
public ProductSourceEnum ProductSource
{
get
{
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
return pSources[ProductIndex-1];
}
set
{
productSource = value;
if (productSource == ProductSourceEnum.Recommended)
{
}
else if (productSource == ProductSourceEnum.OtherAmsoil)
{
wucServiceProductRadioList21.SelectedIndex = (wucServiceProductRadioList21.ProductCount - 2);
wucServiceProductOtherAmsoil1.Visible = true;
this.wucServiceProductNonAmsoil1.Visible = false;
}
else //(productSource == ProductSourceEnum.NonAmsoil)
{
wucServiceProductRadioList21.SelectedIndex = (wucServiceProductRadioList21.ProductCount - 1);
this.wucServiceProductNonAmsoil1.Visible = true;
wucServiceProductOtherAmsoil1.Visible = false;
ProductCode = string.Empty;
}
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
pSources[ProductIndex - 1] = value;
ProductSources = pSources;
ProductNameRecentlySelected = ProductNameRecentlySelected;
hypPurchase.NavigateUrl = wucServiceProductRadioList21.PurchaseLink;
}
}
public int EquipmentTypeID
{
get
{
return Convert.ToInt32(cStatic.ValC(lblEquipmentTypeID.Text));
}
set
{
lblEquipmentTypeID.Text = value.ToString();
}
}
public int CustomerID
{
get
{
int customerID = 0;
if (Session["CustomerID"] != null && int.Parse(Session["CustomerID"].ToString()) != 0)
{
customerID = int.Parse(Session["CustomerID"].ToString());
}
return customerID;
}
}
public string EquipmentDescriptor
{
get
{
Label lbl = (Label)FindControl("lblEquipmentDescriptor");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblEquipmentDescriptor");
lbl.Text = value;
}
}
public int ServiceTypeID
{
get
{
return Convert.ToInt32(ddlServiceType.SelectedValue);
}
set
{
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, value, false, true);
}
}
public string ServiceType
{
get
{
Label lbl = (Label)FindControl("lblServiceType");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblServiceType");
lbl.Text = value;
}
}
public string ProductType
{
get
{
Label lbl = (Label)FindControl("lblProductType");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblProductType");
lbl.Text = value;
}
}
public string ProductTypeDisplay
{
get
{
string s = ProductType;
if (s == "Other")
{
s = "Product";
}
return s;
}
}
public int ProductIndex
{
get
{
Label lbl = (Label)FindControl("lblProductIndex");
return Convert.ToInt32(cStatic.ValC(lbl.Text));
}
set
{
Label lbl = (Label)FindControl("lblProductIndex");
lbl.Text = value.ToString();
}
}
public string StepDisplay
{
get
{
Label lbl = (Label)FindControl("lblStepDisplay");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblStepDisplay");
lbl.Text = value;
}
}
public string WizardCaption
{
get
{
Label lbl = (Label)FindControl("lblWizardCaption");
return lbl.Text;
}
set
{
Label lbl = (Label)FindControl("lblWizardCaption");
lbl.Text = value;
}
}
private bool multiProductServiceSelected;
public bool MultiProductServiceSelected
{
get
{
return multiProductServiceSelected;
}
set
{
multiProductServiceSelected = value;
}
}
public string ServiceDate
{
get
{
return rdpServiceDate.SelectedDate.ToString();
}
set
{
if (value.Length > 0)
{
rdpServiceDate.SelectedDate = Convert.ToDateTime(value);
}
}
}
public string ServiceMiles
{
get
{
return txtVehicleMiles.Text;
}
set
{
if (value == "0")
{
txtVehicleMiles.Text = string.Empty;
}
else
{
txtVehicleMiles.Text = value;
}
}
}
public string ServiceCost
{
get
{
return txtServiceCost.Text;
}
set
{
txtServiceCost.Text = value;
}
}
public string Details
{
get
{
return txtDetails.Text;
}
set
{
txtDetails.Text = value;
}
}
private string productCode = string.Empty;
public string ProductCode
{
get
{
return productCode;
}
set
{
if (value == "OTHERAMSOIL" || value == "NONAMSOIL")
{
productCode = string.Empty;
}
else
{
productCode = value;
}
}
}
public string ProductCodeSelected
{
get
{
ProductSourceEnum ps = ProductSource;
if ((ps == ProductSourceEnum.Recommended) && (wucServiceProductRadioList21.SelectedIndex > -1))
{
return wucServiceProductRadioList21.ProductCode;
}
else if ((ps == ProductSourceEnum.OtherAmsoil) && (wucServiceProductOtherAmsoil1.ProductCode.Length > -1))
{
return wucServiceProductOtherAmsoil1.ProductCode;
}
else
{
return string.Empty;
}
}
}
private List<string> productCodes = new List<string>();
public List<string> ProductCodes
{
get
{
productCodes.Clear();
string s = lblProductCodes.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] codes = new string[commaCount];
codes = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
productCodes.Add(codes[i].Replace("|",string.Empty));
}
return productCodes;
}
set
{
System.Text.StringBuilder sCodes = new System.Text.StringBuilder();
List<string> productCodes = value;
foreach (string s in productCodes)
{
if (s.Trim().Length > 0)
{
sCodes.Append(s + ",");
}
else
{
sCodes.Append("|,");
}
}
if (sCodes.Length > 1)
{
sCodes = sCodes.Remove(sCodes.Length - 1, 1);
}
lblProductCodes.Text = sCodes.ToString();
}
}
private List<string> productNames = new List<string>();
public List<string> ProductNames
{
get
{
productNames.Clear();
string s = lblProductNames.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] Names = new string[commaCount];
Names = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
productNames.Add(Names[i].Replace("|", string.Empty));
}
return productNames;
}
set
{
System.Text.StringBuilder sNames = new System.Text.StringBuilder();
List<string> productNames = value;
foreach (string s in productNames)
{
if (s.Trim().Length > 0)
{
sNames.Append(s + ",");
}
else
{
sNames.Append("|,");
}
}
if (sNames.Length > 1)
{
sNames = sNames.Remove(sNames.Length - 1, 1);
}
lblProductNames.Text = sNames.ToString();
}
}
private List<ProductSourceEnum> productSources = new List<ProductSourceEnum>();
public List<ProductSourceEnum> ProductSources
{
get
{
productSources.Clear();
string s = lblProductSources.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] Sources = new string[commaCount];
Sources = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
ProductSourceEnum pse =
(ProductSourceEnum)Enum.Parse(typeof(ProductSourceEnum), Sources[i]);
productSources.Add(pse);
//.ToString("D")
}
return productSources;
}
set
{
System.Text.StringBuilder sSources = new System.Text.StringBuilder();
productSources = value;
foreach (ProductSourceEnum pse in productSources)
{
sSources.Append(pse.ToString("D") + ",");
}
if (sSources.Length > 1)
{
sSources = sSources.Remove(sSources.Length - 1, 1);
}
lblProductSources.Text = sSources.ToString();
}
}
private List<int> screenCounts = new List<int>();
public List<int> ScreenCounts
{
get
{
screenCounts.Clear();
string s = lblScreenCounts.Text;
string _pattern = @"\,";
int commaCount = cGeneral.CountOccurrences(s, _pattern);
if (s.Trim().Length > 0)
{
commaCount += 1;
}
string[] Counts = new string[commaCount];
Counts = s.Split(new char[] { ',' });
for (int i = 0; i <= commaCount - 1; i += 1)
{
Int32 pse = 0;
bool b = Int32.TryParse(Counts[i], out pse);
if (b)
{
}
screenCounts.Add(pse);
//.ToString("D")
}
return screenCounts;
}
set
{
System.Text.StringBuilder sCounts = new System.Text.StringBuilder();
screenCounts = value;
foreach (int pse in screenCounts)
{
sCounts.Append(pse.ToString() + ",");
}
if (sCounts.Length > 1)
{
sCounts = sCounts.Remove(sCounts.Length - 1, 1);
}
lblScreenCounts.Text = sCounts.ToString();
}
}
//private string productName = string.Empty;
public string ProductName
{
get
{
return lblProductName.Text;
}
set
{
lblProductName.Text = value;
wucServiceProductNonAmsoil1.ProductName = value;
}
}
public string ProductNameSelected
{
get
{
if (ProductSource == ProductSourceEnum.NonAmsoil)
{
return wucServiceProductNonAmsoil1.ProductName;
}
else
{
return string.Empty;
}
}
}
public string ProductNameRecentlySelected
{
get
{
string s = "No Selection";
if (ProductSource == ProductSourceEnum.NonAmsoil)
{
string sProductName = wucServiceProductNonAmsoil1.ProductName;
s = sProductName.Length > 0 ? sProductName : s;
}
else if ((ProductSource == ProductSourceEnum.Recommended) || (ProductSource == ProductSourceEnum.OtherAmsoil))
{
string sProductCode = ProductCodeSelected;
if (sProductCode.Length > 0)
{
product p = new product();
p.ConnectionString = ConnectionString;
s = p.getNameByCode(sProductCode);
}
}
return s;
}
set
{
lblSelected.Text = value;
}
}
public bool SendEmail
{
get
{
return chkSendEmailNextChange.Checked;
}
set
{
chkSendEmailNextChange.Checked = value;
}
}
public bool ShowOtherAmsoil
{
get
{
return ((ServiceTypeID > 0) && !NoTechContact);
}
}
public string NextEmailDate
{
get
{
return rdpNextEmailDate.SelectedDate.ToString();
}
set
{
if (value.Length > 0)
{
rdpNextEmailDate.SelectedDate = Convert.ToDateTime(value);
}
}
}
public string InfoLink
{
get
{
return hypInfo.NavigateUrl;
}
set
{
hypInfo.NavigateUrl = value;
divInfo.Visible = false;// (value.Length > 0);
divNoInfo.Visible = false;//(value.Length == 0);
}
}
public bool ShowServiceEdit
{
get
{
if (lblShowServiceEdit.Text.Length == 0)
{
lblShowServiceEdit.Text = "false";
}
return Convert.ToBoolean(lblShowServiceEdit.Text);
}
set
{
lblShowServiceEdit.Text = value.ToString();
if (Convert.ToBoolean(lblShowServiceEdit.Text))
{
//pnlCustomService.Style.Value = "display:block;";
mpeCustomService.Show();
}
else
{
pnlCustomService.Style.Value = "display:none;";
mpeCustomService.Hide();
}
}
}
public bool NoTechContact
{
get
{
if (lblNoTechContact.Text.Length == 0)
{
lblNoTechContact.Text = "false";
}
return Convert.ToBoolean(lblNoTechContact.Text);
}
set
{
lblNoTechContact.Text = value.ToString();
if (Convert.ToBoolean(lblNoTechContact.Text))
{
divNoTechContact.Style.Value = "display:none;";
}
else
{
divNoTechContact.Style.Value = "display:block;";
}
}
}
public int PreviousServiceTypeID
{
get
{
return Convert.ToInt32(cStatic.ValC(lblPreviousServiceTypeID.Text));
}
set
{
lblPreviousServiceTypeID.Text = value.ToString();
}
}
public string ButtonUpdatePurchaseLinksID
{
get
{
return btnUpdatePurchaseLinks.ClientID;
}
}
public string HiddenUpdateAnchorsID
{
get
{
return hdnUpdateAnchors.ClientID;
}
}
public string HiddenProductCodeReturnedID
{
get
{
return hdnProductCodeReturned.ClientID;
}
}
private List<ProductType> productTypes = new List<ProductType>();
public List<ProductType> ProductTypes
{
get
{
return productTypes;
}
set
{
productTypes = value;
}
}
public int ProductCount
{
get
{
return Convert.ToInt32(cStatic.ValC(lblProductCount.Text));
}
set
{
lblProductCount.Text = value.ToString();
}
}
public int CurrentProductTypeID
{
get
{
if (ProductTypes.Count > 0)
{
return ProductTypes[ProductIndex - 1].ProductTypeID;
}
else
{
return 0;
}
}
}
public bool ProductSelected
{
get
{
if (!divProductSelection.Visible && wucServiceProductRadioList21.AmsoilProductSelected)
{
return true;
}
else if (divProductSelection.Visible && ProductSource == ProductSourceEnum.OtherAmsoil && wucServiceProductOtherAmsoil1.ProductCode != string.Empty)
{
return true;
}
else if ((ProductSource == ProductSourceEnum.NonAmsoil) && divProductSelection.Visible)
{
return true;
}
else
{
return false;
}
}
}
public RadioButton optRecommended
{
get
{
Panel div = (Panel)pnlProductSourceSelection.FindControl("pnlRecommended");
RadioButton opt = (RadioButton)div.FindControl("optPSRecommended");
return opt;
}
}
public RadioButton optNone
{
get
{
Panel div = (Panel)pnlProductSourceSelection.FindControl("pnlRecommended");
RadioButton opt = (RadioButton)div.FindControl("optPSNone");
return opt;
}
}
public string TechServicesPhone
{
get
{
return AmsWebLibrary.Module1.getWebConfigValue("TechServicesPhone");
}
}
public string TechServicesEmail
{
get
{
return AmsWebLibrary.Module1.getWebConfigValue("TechServicesEmailLink");
}
}
#endregion
#region events
void NextButtonSelected()
{
WizardNavigationEventArgs wa = new WizardNavigationEventArgs(Wizard1.ActiveStepIndex, Wizard1.ActiveStepIndex + 1);
object o = Wizard1;
WizardMoveNext(ref o, ref wa);
if (!wa.Cancel && (ProductIndex >= (ProductCount - 1)))
{
Wizard1.MoveTo(WizardStep3);
}
}
protected void Page_Load(object sender, EventArgs e)
{
wucServiceProductOtherAmsoil1.ProductSelectedEvent += new wucServiceProductOtherAmsoil.ProductSelectedEventHandler(wucServiceProductOtherAmsoil1_ProductSelectedEvent);
if (wucServiceProductOtherAmsoil1.getResetDoLookupValue() == "1")
{
wucServiceProductOtherAmsoil1.doLookup();
}
if (hdnMoveOn.Value == "1")
{
hdnMoveOn.Value = string.Empty;
this.NextButtonSelected();
}
if (AmsWebLibrary.Module1.IsDev())
{
Session["ZO_NUM"] = 600001;
Session["DealerName"] = "Joe Sixpack";
Session["Email"] = "vbswami@gmail.com";
Session["CustomerID"] = 195897;// 851096;
Session["PriceType"] = "PRUSCAT";
}
if (Session["CustomerID"] == null || int.Parse(Session["CustomerID"].ToString()) == 0)
{
Response.Redirect("~/loginweb.aspx?sourceform=/mygarage/garage.aspx");
}
productCodes = new List<string>();
productNames = new List<string>();
productSources = new List<ProductSourceEnum>();
screenCounts = new List<int>();
if (!IsPostBack)
{
btnBackToEquipment.Attributes.Add("onmouseover", "this.src='Theme/images/equip2.gif';");
btnBackToEquipment.Attributes.Add("onmouseout", "this.src='Theme/images/equip1.gif';");
btnAddNewService.Attributes.Add("onmouseover", "this.src='Theme/images/add2.gif';");
btnAddNewService.Attributes.Add("onmouseout", "this.src='Theme/images/add1.gif';");
btnEmail.Attributes.Add("onmouseover", "this.src='Theme/images/email2.gif';");
btnEmail.Attributes.Add("onmouseout", "this.src='Theme/images/email1.gif';");
btnAddNewEquipment.Attributes.Add("onmouseover", "this.src='Theme/images/addEquip2.gif';");
btnAddNewEquipment.Attributes.Add("onmouseout", "this.src='Theme/images/addEquip1.gif';");
SetStepDisplay(0);
rdpServiceDate.SelectedDate = DateTime.Today;
if (Request.QueryString["EquipmentTypeID"] != null)
{
if (Convert.ToInt32(Request.QueryString["EquipmentTypeID"]) > 0)
{
EquipmentTypeID = Convert.ToInt32(Request.QueryString["EquipmentTypeID"]);
}
}
LoadServiceTypes(0);
if (Request.QueryString["ServiceID"] != null)
{
if (Convert.ToInt32(Request.QueryString["ServiceID"]) > 0)
{
ServiceID = Convert.ToInt32(Request.QueryString["ServiceID"]);
PopulateForm();
}
}
else if (Request.QueryString["UnitInstanceID"] != null)
{
WizardCaption = "Add New Service";
if (Convert.ToInt32(Request.QueryString["UnitInstanceID"]) > 0)
{
UnitInstanceID = Convert.ToInt32(Request.QueryString["UnitInstanceID"]);
vehicle v = new vehicle(CustomerID, UnitInstanceID);
EquipmentUnitID = v.GetEquipmentUnitIDByInstanceID(ConnectionString);
EquipmentType et = new EquipmentType(v.EquipmentTypeID);
et.load();
if (et.HoursForMiles)
{
lblVehicleMilesCaption.Text = lblVehicleMilesCaption.Text.Replace("Vehicle Miles", "Equipment Hours");
}
}
}
if (Request.QueryString["servicetypeid"] != null)
{
if (Convert.ToInt32(Request.QueryString["servicetypeid"]) > 0)
{
ServiceTypeID = Convert.ToInt32(Request.QueryString["servicetypeid"]);
}
}
if (ServiceMiles.ToString() == string.Empty)
{
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
ServiceMiles = v.getCurrentMiles(UnitInstanceID).ToString();
}
pnlCustomService.Style.Value = "display:none;";
//EnDisableContinueButton(false);
}
else
{
if (ShowServiceEdit)
{
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, PreviousServiceTypeID, false, false);
}
}
if (ShowServiceEdit)
{
//pnlCustomService.Style.Value = "display:block;";
mpeCustomService.Show();
}
else
{
pnlCustomService.Style.Value = "display:none;";
mpeCustomService.Hide();
}
if (hdnUpdateAnchors.Value == "1")
{
hdnUpdateAnchors.Value = "0";
UpdateAnchors();
}
rdpNextEmailDate.MinDate = DateTime.Today;
if ((Session["KilometersMode"] != null) && (Convert.ToBoolean(Session["KilometersMode"].ToString())))
{
lblVehicleMilesCaption.Text = lblVehicleMilesCaption.Text.Replace("Miles", "Kilometers");
}
}
void wucServiceProductOtherAmsoil1_ProductSelectedEvent(object sender, ProductSelectedEventArgs e)
{
ProductCode = e.ProductCode;
ProductName = e.ProductName;
ProductNameRecentlySelected = ProductName;
hypPurchase.NavigateUrl = e.ProductLink;
}
protected void ddlServiceType_SelectedIndexChanged(object sender, EventArgs e)
{
int serviceTypeID = Convert.ToInt32(ddlServiceType.SelectedValue);
if (serviceTypeID == -2)
{
divAddCustomService.Visible = true;
divUpdateCustomService.Visible = false;
ShowServiceEdit = true;
}
else if (serviceTypeID == -3)
{
divUpdateCustomService.Visible = true;
divAddCustomService.Visible = false;
ShowServiceEdit = true;
}
else
{
PreviousServiceTypeID = Convert.ToInt32(ddlServiceType.SelectedValue);
}
RaiseBubbleEvent(this, new ServiceTypeSelectedEventArgs(serviceTypeID));
}
protected void WizardMoveNext(ref object sender, ref WizardNavigationEventArgs e)
{
bool bValid = false;
bool bRepeatStep = false;
string sAlert = string.Empty;
if (e.CurrentStepIndex == 0)
{
bValid = (ddlServiceType.SelectedIndex > 0) && (ServiceDate.Length > 0);
if (ddlServiceType.SelectedIndex <= 0)
{
bValid = false;
sAlert = "Service type is required";
}
else if (ServiceDate.Trim().Length == 0)
{
bValid = false;
sAlert = "Service date is required";
}
else
{
ServiceTypeID = Convert.ToInt32(ddlServiceType.SelectedItem.Value);
trTech.Visible = ((ServiceTypeID < 4) && (ServiceTypeID > 0));
MultiProductServiceSelected = GetMultiProductServiceSelected();
NoTechContact = GetNoTechContact();
ServiceType = ddlServiceType.SelectedItem.Text;
ProductIndex = 1;
LoadProductTypes();
wucServiceProductRadioList21.EquipmentUnitID = EquipmentUnitID;
SetStepDisplay(1);
SetInputValues();
InitInputs();
InitProducts();
bool bShowTech = ((ServiceTypeID >= 1 && ServiceTypeID <= 3) && EquipmentTypeID == 1);
if (bShowTech)
{
MyGarage.cMaintenanceTechContent mtc = new MyGarage.cMaintenanceTechContent((object)EquipmentUnitID);
lblTech.Text = mtc.TechInfo;
vehicle vv = new vehicle();
lblTechCaption.Text = vv.getCaption(UnitInstanceID);
divTechInfo.Visible = (lblTech.Text.Length > 97);
}
else
{
divTechInfo.Visible = false;
}
}
}
else if (e.CurrentStepIndex == 1)
{
RecordProductSource();
if (ProductSelected || divProductSelection.Visible)
{
sAlert = ValidateProduct();
bValid = (sAlert.Length == 0);
if (sAlert == "Please enter a valid AMSOIL product code")
{
sAlert = "";
wucServiceProductOtherAmsoil1.ShowHideProductSelection(true);
}
if (bValid)
{
SaveProduct();
InitInputs();
if (ProductIndex < ProductCount)
{
SaveScreenCount();
pnlProductSourceSelection.Visible = true;
e.Cancel = true;
ProductIndex += 1;
SetInputValues();
ProductSource = ProductSources[ProductIndex - 1];
LoadProductTypes();
InitProducts();
//setInitialProductSource();
SetStepDisplay(1);
divProductSelection.Visible = false;
bRepeatStep = true;
}
else
{
SaveScreenCount();
SetStepDisplay(2);
}
}
}
else if (!divProductSelection.Visible)
{
if ((ProductSource == ProductSourceEnum.Recommended) && (wucServiceProductRadioList21.ProductCount == 2) &&
(wucServiceProductRadioList21.SelectedIndex == -1))
{
sAlert = "Please select \"I want to select my own AMSOIL product\" or \"I am not using an AMSOIL product\".";
bValid = false;
}
else
{
SaveScreenCount();
SaveProduct();
divProductSelection.Visible = true;
pnlProductSourceSelection.Visible = false;
SetStepDisplay(2);
}
}
else
{
pnlProductSourceSelection.Visible = true;
divProductSelection.Visible = false;
LoadProductTypes();
setInitialProductSource();
bRepeatStep = true;
}
}
else if (e.CurrentStepIndex == 2)
{
SetStepDisplay(3);
bValid = true;
}
e.Cancel = ((!bValid) || bRepeatStep);
if (e.Cancel)
{
ConfigureNextButton();
}
if (sAlert.Length > 0)
{
RaiseBubbleEvent(this, new ErrorNotificationEventArgs(sAlert));
}
}
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
if (!wucServiceProductOtherAmsoil1.Visible) // && (Wizard1.ActiveStepIndex == 1)
{
WizardMoveNext(ref sender, ref e);
}
}
protected void RecordProductSource()
{
bool selectOtherAmsoilProduct = ((ShowOtherAmsoil) && (wucServiceProductRadioList21.SelectedIndex == wucServiceProductRadioList21.ProductCount - 2));
bool selectNonAmsoilProduct = (wucServiceProductRadioList21.SelectedIndex == wucServiceProductRadioList21.ProductCount - 1);
if (selectOtherAmsoilProduct)
{
ProductSource = ProductSourceEnum.OtherAmsoil;
}
else if (selectNonAmsoilProduct)
{
ProductSource = ProductSourceEnum.NonAmsoil;
}
else
{
ProductSource = ProductSourceEnum.Recommended;
}
}
protected void Wizard1_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
{
bool bValid = true;
bool bRepeatStep = false;
string sAlert = string.Empty;
bool reHideProductSelection = false;
bool reShowProductSelection = false;
bool onFirstScreenOfProduct = false;
if (e.CurrentStepIndex == 1)
{
bValid = true;
if (bValid)
{
InitInputs();
List<int> sCounts = ScreenCounts;
if (sCounts.Count < ProductIndex)
{
if (!pnlProductSourceSelection.Visible && !wucServiceProductRadioList21.NonAmsoilOnly)
{
onFirstScreenOfProduct = false;
}
else
{
onFirstScreenOfProduct = true;
}
}
else if (sCounts[ProductIndex - 1] == 1)
{
if (!pnlProductSourceSelection.Visible && !wucServiceProductRadioList21.NonAmsoilOnly)
{
onFirstScreenOfProduct = false;
}
else
{
onFirstScreenOfProduct = true;
}
}
if ((onFirstScreenOfProduct) || (pnlProductSourceSelection.Visible))
{
// going to previous product
ProductIndex -= 1;
if (ProductIndex > 0)
{
bRepeatStep = true;
if (ScreenCounts[ProductIndex - 1] == 1)
{
divProductSelection.Visible = false;
reHideProductSelection = true;
pnlProductSourceSelection.Visible = true;
}
else
{
divProductSelection.Visible = true;
reShowProductSelection = true;
pnlProductSourceSelection.Visible = false;
}
}
}
else if (!ShowOtherAmsoil)
{
bRepeatStep = false;
}
else
{
// staying on this product
bRepeatStep = true;
divProductSelection.Visible = false;
reHideProductSelection = true;
pnlProductSourceSelection.Visible = true;
}
if (bRepeatStep)
{
LoadProductTypes();
ProductSource = ProductSources[ProductIndex - 1];
InitProducts();
////setInitialProductSource();
SetInputValues();
SetStepDisplay(1);
if (reHideProductSelection)
{
divProductSelection.Visible = false;
pnlProductSourceSelection.Visible = true;
}
else if (reShowProductSelection)
{
divProductSelection.Visible = true;
pnlProductSourceSelection.Visible = false;
}
}
else
{
SetStepDisplay(0);
}
ConfigureNextButton();
}
}
else if
((e.CurrentStepIndex == 2)) // || (e.CurrentStepIndex == 3)
{
LoadProductTypes();
ProductIndex = ProductCount;
if (ProductTypes.Count > 0)
{
ProductType = ProductTypes[ProductIndex - 1].ProductTypeName;
}
InitInputs();
InitProducts();
SetInputValues();
SetStepDisplay(1);
if (ScreenCounts[ProductIndex - 1] == 1)
{
divProductSelection.Visible = false;
pnlProductSourceSelection.Visible = true;
}
else
{
divProductSelection.Visible = true;
pnlProductSourceSelection.Visible = false;
}
}
else
{
SetStepDisplay(e.NextStepIndex);
}
e.Cancel = ((!bValid) || bRepeatStep);
if (sAlert.Length > 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alerto", "alert('" + sAlert + "');", true);
}
}
protected void Wizard1_SideBarButtonClick(object sender, WizardNavigationEventArgs e)
{
SetStepDisplay(e.NextStepIndex);
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
bool bValid = true;
string sAlert = string.Empty;
if (chkSendEmailNextChange.Checked && NextEmailDate.Trim().Length == 0)
{
bValid = false;
}
if (!bValid)
{
e.Cancel = true;
sAlert = "Please select or enter an E-Mail reminder date";
}
else
{
SaveForm();
WizardCaption = "Service Recorded";
StepDisplay = string.Empty;
}
if (sAlert.Length > 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alerto", "alert('" + sAlert + "');", true);
}
}
protected void SideBarList_ItemDataBound(object sender, DataListItemEventArgs e)
{
}
protected void btnAddNewEquipment_Click(object sender, EventArgs e)
{
Response.Redirect("EquipmentAdd.aspx");
}
protected void btnAddNewService_Click(object sender, EventArgs e)
{
Response.Redirect("ServiceAdd.aspx?EquipmentTypeID=" + EquipmentTypeID.ToString() + "&UnitInstanceID=" + UnitInstanceID.ToString());
}
protected void btnBackToEquipment_Click(object sender, EventArgs e)
{
Response.Redirect("GarageVehicle.aspx?id=" + UnitInstanceID.ToString());
}
protected void btnEmail_Click(object sender, EventArgs e)
{
Response.Redirect("Reminders.aspx?Tab=Reminders&id=" + UnitInstanceID.ToString());
}
protected void btnSaveNewCustomService_Click(object sender, EventArgs e)
{
if (txtNewCustomService.Text.Length > 0)
{
UserDefinedServiceType uds = new UserDefinedServiceType(CustomerID, EquipmentTypeID, ConnectionString);
uds.ServiceType = txtNewCustomService.Text;
uds.saveToDB();
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
v.CustomerID = CustomerID;
v.UnitInstanceID = UnitInstanceID;
v.synchronizeReminders();
grdUpdateServiceTypes.DataBind();
ddlServiceType.Items.Add(new ListItem(uds.ServiceType, (-1 * uds.ServiceTypeUserDefinedID).ToString()));
ddlServiceType.SelectedIndex = ddlServiceType.Items.Count - 1;
ShowServiceEdit = false;
RaiseBubbleEvent(this, new ServiceTypeSelectedEventArgs(-1 * uds.ServiceTypeUserDefinedID));
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alerto", "alert('Service Type is required');", true);
}
}
protected void btnCancelNewCustomService_Click(object sender, EventArgs e)
{
ShowServiceEdit = false;
RaiseBubbleEvent(this, new ServiceTypeSelectedEventArgs(ServiceTypeID));
}
protected void btnSaveUpdateCustomService_Click(object sender, EventArgs e)
{
ShowServiceEdit = false;
}
protected void grdUpdateServiceTypes_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//// the underlying data item is a DataRowView object.
DataRowView rowView = (DataRowView)e.Row.DataItem;
int id = Convert.ToInt32(rowView["ServiceTypeUserDefinedID"].ToString());
//// Retrieve the state value for the current row.
//String state = rowView["state"].ToString();
UserDefinedServiceType udst = new UserDefinedServiceType(Convert.ToInt32(Session["CustomerID"]), EquipmentTypeID, id, ConnectionString, true);
LinkButton lbt = (LinkButton)e.Row.FindControl("lnkDelete");
lbt.Enabled = (!udst.hasServices());
}
}
protected void grdUpdateServiceTypes_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Remove")
{
UserDefinedServiceType u = new UserDefinedServiceType(CustomerID, EquipmentTypeID, Convert.ToInt32(e.CommandArgument), ConnectionString, true);
u.delete();
vehicle v = new vehicle();
v.ConnectionString = ConnectionString;
v.CustomerID = CustomerID;
v.UnitInstanceID = UnitInstanceID;
v.synchronizeReminders();
this.grdUpdateServiceTypes.DataBind();
LoadServiceTypes(PreviousServiceTypeID);
}
}
protected void grdUpdateServiceTypes_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
LoadServiceTypes(PreviousServiceTypeID);
}
protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
ConfigureNextButton();
}
#endregion
#region methods
protected void SaveScreenCount()
{
List<int> scrCounts = ScreenCounts;
int i = 1;
if (divProductSelection.Visible)
{
i = 2;
}
if (scrCounts.Count < ProductIndex)
{
scrCounts.Add(i);
}
else
{
scrCounts[ProductIndex - 1] = i;
}
ScreenCounts = scrCounts;
}
protected void LoadServiceTypes(int _serviceTypeID)
{
string sConn = ConnectionString;
string sSql = "ServiceTypesSelect " + Convert.ToInt32(CustomerID.ToString()) + ", " + Convert.ToInt32(EquipmentTypeID.ToString());
AmsWebLibrary.Module1.PopulateDropdown(ref ddlServiceType, sSql, "1", false, "Select Service Type", sConn, true);
ddlServiceType.Items.Add(new ListItem("Add Custom Service Type", "-2"));
GarageUser g = new GarageUser(CustomerID);
bool gotUserDefinedServiceTypes = g.hasUserDefinedServices();
if (gotUserDefinedServiceTypes)
{
ddlServiceType.Items.Add(new ListItem("Edit Custom Service Type", "-3"));
}
if (_serviceTypeID != 0)
{
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, _serviceTypeID, false, true);
}
}
public void LoadProductTypes()
{
if (ServiceTypeID != 0)
{
service s = new service(ServiceTypeID, EquipmentUnitID, ConnectionString);
ProductTypes = s.ProductTypes;
ProductCount = ProductTypes.Count;
if (ProductTypes.Count > 0)
{
ProductType = ProductTypes[ProductIndex - 1].ProductTypeName;
}
}
}
public void ConfigureNextButton()
{
Button btnNext = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton");
btnNext.Attributes.Remove("onmousedown");
if (wucServiceProductOtherAmsoil1.Visible)
{
btnNext.Attributes.Add("onmousedown", "stepNext('" + Wizard1.ClientID + "');");
btnNext.Attributes.Add("onclick", "return false;");
}
else
{
btnNext.Attributes.Add("onclick", "return true;");
}
}
public void InitProducts()
{
if (ServiceTypeID != 0)
{
List<string> pCodes = ProductCodes;
if ((pCodes.Count > 0) && (pCodes.Count >= ProductIndex))
{
ProductCode = pCodes[ProductIndex - 1];
}
else
{
ProductCode = string.Empty;
}
wucServiceProductRadioList21.EquipmentUnitID = EquipmentUnitID;
wucServiceProductRadioList21.ServiceTypeID = ServiceTypeID;
wucServiceProductRadioList21.ProductTypeID = CurrentProductTypeID;
wucServiceProductOtherAmsoil1.ProductTypeID = CurrentProductTypeID;
wucServiceProductRadioList21.RecentlySelectedLabelID = lblSelected.ClientID;
wucServiceProductRadioList21.PurchaseLinkID = hypPurchase.ClientID;
pnlProductSourceSelection.Visible = true;
wucServiceProductRadioList21.ShowOtherAmsoil = ShowOtherAmsoil;
wucServiceProductRadioList21.LoadProductList();
HtmlGenericControl div = (HtmlGenericControl)pnlProductSourceSelection.FindControl("divGotProducts");
div.Visible = (wucServiceProductRadioList21.ProductCount > (ShowOtherAmsoil ? 2 : 1));
divNoTechContact.Visible = ((wucServiceProductRadioList21.ProductCount == (ShowOtherAmsoil ? 2 : 1)) && (!NoTechContact));
wucServiceProductRadioList21.ProductCode = ProductCode;
if ((ProductCode.Length == 0))
{
List<string> pNames = ProductNames;
if ((pNames.Count > 0) && (pNames.Count >= ProductIndex))
{
ProductName = pNames[ProductIndex - 1];
}
else
{
ProductName = string.Empty;
}
}
if (wucServiceProductRadioList21.NonAmsoilOnly)
{
wucServiceProductRadioList21.SelectedIndex = 0;
pnlProductSourceSelection.Visible = false;
divProductSelection.Visible = true;
wucServiceProductOtherAmsoil1.Visible = false;
}
else
{
divProductSelection.Visible = false;
if (((wucServiceProductRadioList21.SelectedIndex == -1) && (wucServiceProductRadioList21.ProductCount > (ShowOtherAmsoil ? 2 : 1)) &&
(ProductCode.Length == 0) && (ProductName.Length == 0) && (ProductSource != ProductSourceEnum.NonAmsoil) && (ProductSource != ProductSourceEnum.OtherAmsoil)))
{
wucServiceProductRadioList21.SelectedIndex = 0;
ProductSource = ProductSourceEnum.Recommended;
}
else if ((wucServiceProductRadioList21.SelectedIndex != -1) &&
(wucServiceProductRadioList21.SelectedIndex < (wucServiceProductRadioList21.ProductCount - (ShowOtherAmsoil ? 2 : 1))))
{
ProductSource = ProductSourceEnum.Recommended;
}
else if (ProductCode.Length > 0 || ProductSource == ProductSourceEnum.OtherAmsoil)
{
wucServiceProductOtherAmsoil1.ProductCode = ProductCode;
ProductSource = ProductSourceEnum.OtherAmsoil;
}
else if (ProductName.Length > 0 || ProductSource == ProductSourceEnum.NonAmsoil)
{
ProductSource = ProductSourceEnum.NonAmsoil;
}
}
}
else
{
wucServiceProductRadioList21.Visible = false;
}
}
public void UpdateAnchors()
{
if (ServiceTypeID > 0)
{
if (MultiProductServiceSelected)
{
}
else
{
wucServiceProductOtherAmsoil1.SetOtherAmsoilProductNameAndAnchor(hdnProductCodeReturned.Value);
}
}
else
{
wucServiceProductRadioList21.Visible = false;
}
}
public void SaveForm()
{
service s = new service(ServiceID, ConnectionString);
MultiProductServiceSelected = (ProductCount > 0);
s.ProductCodes = ProductCodes;
s.ProductNames = ProductNames;
s.Cost = cStatic.ValC(ServiceCost);
s.ServiceDate = ServiceDate;
s.VehicleUsage = (int)cStatic.ValC(ServiceMiles);
s.ServiceTypeID = ServiceTypeID;
s.EquipmentUnitInstanceID = UnitInstanceID;
s.Details = Details;
s.SendEmail = chkSendEmailNextChange.Checked;
s.NextEmailDate = NextEmailDate;
LoadProductTypes();
s.ProductTypes = ProductTypes;
if (s.saveToDB() && (ServiceID == 0))
{
ServiceID = s.ServiceID;
}
//OnServiceUpdateEvent(System.EventArgs.Empty);
}
public bool GetMultiProductServiceSelected()
{
int lServiceTypeID = ServiceTypeID;
bool IsMultiProduct = false;
if (lServiceTypeID > 0)
{
ServiceType st = new ServiceType(lServiceTypeID, ConnectionString);
IsMultiProduct = st.IsMultiProduct();
return IsMultiProduct;
}
else
{
return false;
}
}
public bool GetNoTechContact()
{
int lServiceTypeID = ServiceTypeID;
if (lServiceTypeID > 0)
{
ServiceType st = new ServiceType(lServiceTypeID, ConnectionString);
bool ntc = st.NoTechContact();
return ntc;
}
else
{
return false;
}
}
private void showProductSelectionHelp(int _nextStepIndex)
{
if (_nextStepIndex == 1)
{
divDefaultInstructions.Visible = true;
divOtherAMSOILInstructions.Visible = false;
divOtherInstructions.Visible = false;
}
else if (wucServiceProductOtherAmsoil1.Visible)
{
divDefaultInstructions.Visible = false;
divOtherAMSOILInstructions.Visible = true;
divOtherInstructions.Visible = false;
}
else
{
divDefaultInstructions.Visible = false;
divOtherAMSOILInstructions.Visible = false;
divOtherInstructions.Visible = true;
}
}
private void SetStepDisplay(int _nextStepIndex)
{
if (_nextStepIndex == 0)
{
StepDisplay = "Step 1";
ddlServiceType.Focus();
}
else if (_nextStepIndex == 1)
{
StepDisplay = "Step " + (1 + ProductIndex).ToString() + " of " + (3 + ProductCount).ToString();
showProductSelectionHelp(_nextStepIndex);
}
else if (_nextStepIndex == 2)
{
StepDisplay = "Step " + (2 + ProductCount).ToString() + " of " + (3 + ProductCount).ToString();
showProductSelectionHelp(_nextStepIndex);
txtDetails.Focus();
//txtServiceCost.Focus();
}
else if (_nextStepIndex == 3)
{
StepDisplay = "Step " + (3 + ProductCount).ToString() + " of " + (3 + ProductCount).ToString();
chkSendEmailNextChange.Focus();
}
else if (_nextStepIndex == 4)
{
StepDisplay = string.Empty;
}
}
private void PopulateForm()
{
service srv = new service(ServiceID, ConnectionString);
EquipmentUnit eu = new EquipmentUnit();
eu.EquipmentUnitID = srv.EquipmentUnitID;
EquipmentTypeID = srv.EquipmentTypeID;
LoadServiceTypes(EquipmentTypeID);
AmsWebLibrary.Module1.SelectDDLItem(ref ddlServiceType, srv.ServiceTypeID, false, true);
if (srv.Cost > 0)
{
ServiceCost = srv.Cost.ToString();
}
ServiceDate = srv.ServiceDate;
ServiceMiles = srv.VehicleUsage.ToString();
UnitInstanceID = srv.EquipmentUnitInstanceID;
EquipmentUnitID = srv.EquipmentUnitID;
Details = srv.Details;
chkSendEmailNextChange.Checked = srv.SendEmail;
NextEmailDate = srv.NextEmailDate;
ProductCodes = srv.ProductCodes;
ProductNames = srv.ProductNames;
InfoLink = srv.getInfoLink();
if (ServiceID == 0)
{
WizardCaption = "Add New Service";
}
else
{
WizardCaption = "Edit Service";
}
if (Request.QueryString["Dup"] != null)
{
if (Convert.ToInt32(Request.QueryString["Dup"]) > 0)
{
ServiceID = 0;
WizardCaption = "Repeat Service";
}
}
List<ProductSourceEnum> pSources = new List<ProductSourceEnum>();
List<int> scrCounts = new List<int>();
while (pSources.Count < ProductCodes.Count)
{
pSources.Add(ProductSourceEnum.Recommended);
scrCounts.Add(1);
}
ProductSources = pSources;
ScreenCounts = scrCounts;
EquipmentType et = new EquipmentType(EquipmentTypeID);
et.load();
if (et.HoursForMiles)
{
lblVehicleMilesCaption.Text = lblVehicleMilesCaption.Text.Replace("Vehicle Miles", "Equipment Hours");
}
}
private string ValidateProduct()
{
bool bValid = false;
string sAlert = string.Empty;
LoadProductTypes();
if (ProductSource == ProductSourceEnum.Recommended)
{
bValid = (wucServiceProductRadioList21.SelectedIndex > -1);
if (!bValid)
{
sAlert = "Please select a recommended AMSOIL product";
}
}
else if (ProductSource == ProductSourceEnum.OtherAmsoil)
{
bValid = (wucServiceProductOtherAmsoil1.ProductCode.Length > 2);
if (!bValid)
{
sAlert = "Please select an AMSOIL product. Enter at least 3 characters.";
}
else
{
product p = new product();
p.ConnectionString = ConnectionString;
bValid = p.validCode(wucServiceProductOtherAmsoil1.ProductCode);
if (!bValid)
{
sAlert = "Please enter a valid AMSOIL product code";
}
}
}
else if (ProductSource == ProductSourceEnum.NonAmsoil)
{
bValid = true;
}
return sAlert;
}
private void SaveProduct()
{
List<string> pCodes = ProductCodes;
while (pCodes.Count < ProductIndex)
{
pCodes.Add(string.Empty);
}
pCodes[ProductIndex - 1] = ProductCodeSelected;
if (ProductCodeSelected.Length == 0)
{
// hack to get empty string into list member
pCodes[ProductIndex - 1] = "hello";
pCodes[ProductIndex - 1] = string.Empty;
}
else
if (ProductCodeSelected.Length == 0)
{
// hack
pCodes[ProductIndex - 1] = "hello";
pCodes[ProductIndex - 1] = ProductCodeSelected;
}
ProductCodes = pCodes;
List<string> pNames = ProductNames;
while (pNames.Count < ProductIndex)
{
pNames.Add(string.Empty);
}
pNames[ProductIndex - 1] = ProductNameSelected;
if (ProductNameSelected.Length == 0)
{
// hack to get empty string into list member
pNames[ProductIndex - 1] = "hello";
pNames[ProductIndex - 1] = string.Empty;
}
else
{
// hack
pNames[ProductIndex - 1] = "hello";
pNames[ProductIndex - 1] = ProductNameSelected;
}
ProductNames = pNames;
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
pSources[ProductIndex - 1] = ProductSource;
ProductSources = pSources;
}
private void InitInputs()
{
wucServiceProductRadioList21.ProductCode = string.Empty;
wucServiceProductOtherAmsoil1.ProductCode = string.Empty;
wucServiceProductOtherAmsoil1.ProductName = string.Empty;
wucServiceProductNonAmsoil1.ProductName = string.Empty;
ProductCode = string.Empty;
ProductName = string.Empty;
}
protected void setInitialProductSource()
{
if (wucServiceProductRadioList21.SelectedIndex > -1 ||
((wucServiceProductRadioList21.ProductCount > 0) && ServiceID == 0 && ProductCode.Length == 0 && ProductName.Length == 0))
{
ProductSource = ProductSourceEnum.Recommended;
}
else if ((ProductCode.Length > 0) || (((wucServiceProductRadioList21.ProductCount == 0)) && ServiceID == 0))
{
ProductSource = ProductSourceEnum.OtherAmsoil;
if (productCode.Length > 0)
{
wucServiceProductOtherAmsoil1.ProductCode = ProductCode;
}
}
else if (ProductName.Length > 0)
{
ProductSource = ProductSourceEnum.NonAmsoil;
if (ProductName.Length > 0)
{
wucServiceProductNonAmsoil1.ProductName = ProductName;
}
}
ProductNameRecentlySelected = ProductNameRecentlySelected;
hypPurchase.NavigateUrl = wucServiceProductRadioList21.PurchaseLink;
}
private void SetInputValues()
{
List<ProductSourceEnum> pSources = ProductSources;
while (pSources.Count < ProductIndex)
{
pSources.Add(ProductSourceEnum.Recommended);
}
ProductSource = pSources[ProductIndex - 1];
ProductSources = pSources;
List<string> pCodes = ProductCodes;
while (pCodes.Count < ProductIndex)
{
pCodes.Add(string.Empty);
}
ProductCode = pCodes[ProductIndex - 1];
ProductCodes = pCodes;
List<string> pNames = ProductNames;
while (pNames.Count < ProductIndex)
{
pNames.Add(string.Empty);
}
ProductName = pNames[ProductIndex - 1];
ProductNames = pNames;
}
#endregion
}
}
Thank you for taking a look at it.
Mark