TFW Online Company Binding - ITC TurboRater



TFW Online Company BindingContents TOC \o "1-3" \h \z \u TFW Online Company Binding PAGEREF _Toc398567207 \h 1TFW/Binding Structure PAGEREF _Toc398567208 \h 3Binding Flow PAGEREF _Toc398567209 \h 4Creating a New Binding Project PAGEREF _Toc398567210 \h 4Step 1: Create an Entry in the Database PAGEREF _Toc398567211 \h 4Record ID PAGEREF _Toc398567212 \h 5MasterCompanyId PAGEREF _Toc398567213 \h 5CompanyId PAGEREF _Toc398567214 \h 5CompanyName PAGEREF _Toc398567215 \h 5CompanyState PAGEREF _Toc398567216 \h 5RedirectUrl PAGEREF _Toc398567217 \h 5Enabled PAGEREF _Toc398567218 \h 5RedirectToBridgeUrl PAGEREF _Toc398567219 \h 5UserName, Password, ProducerCode and SubProducerCode PAGEREF _Toc398567220 \h 6ExportPolicyIdToDb PAGEREF _Toc398567221 \h 6PolicyIdRealtimeParamName PAGEREF _Toc398567222 \h 6CanVerifyBindingCredentials PAGEREF _Toc398567223 \h 6RedirectToNewBlankPage PAGEREF _Toc398567224 \h 6Step 2: Create your Binding Dll PAGEREF _Toc398567225 \h 6Step 3: Create Your Binding Pages PAGEREF _Toc398567226 \h 7Creating New Pages PAGEREF _Toc398567227 \h 8Custom css and JavaScript References PAGEREF _Toc398567228 \h 8Css and JavaScript Filenames PAGEREF _Toc398567229 \h 9Designing Your Binding Pages PAGEREF _Toc398567230 \h 9The BindingSession Object PAGEREF _Toc398567231 \h 9Custom Binding User Controls PAGEREF _Toc398567232 \h 9ApplicationEntryControl PAGEREF _Toc398567233 \h 9Properties PAGEREF _Toc398567234 \h 10Methods PAGEREF _Toc398567235 \h 10CoverageDisplay PAGEREF _Toc398567236 \h 11PageHeaderControl PAGEREF _Toc398567237 \h 11Properties PAGEREF _Toc398567238 \h 11AddressEntryControl PAGEREF _Toc398567239 \h 11Properties PAGEREF _Toc398567240 \h 12Methods PAGEREF _Toc398567241 \h 12PriorInsuranceControl PAGEREF _Toc398567242 \h 12Properties PAGEREF _Toc398567243 \h 12Methods: PAGEREF _Toc398567244 \h 13SectionHeaderControl PAGEREF _Toc398567245 \h 13Properties PAGEREF _Toc398567246 \h 13TermsAgreementControl PAGEREF _Toc398567247 \h 13Properties PAGEREF _Toc398567248 \h 13WebDialog PAGEREF _Toc398567249 \h 14Properties PAGEREF _Toc398567250 \h 14Methods PAGEREF _Toc398567251 \h 15Events PAGEREF _Toc398567252 \h 15Date Entries PAGEREF _Toc398567253 \h 15Help Messages PAGEREF _Toc398567254 \h 15Multi-Lingual Support PAGEREF _Toc398567255 \h 16Language Identifiers PAGEREF _Toc398567256 \h 17Validation PAGEREF _Toc398567257 \h 17Step 1: Add a BuildValidationList Method to the Page PAGEREF _Toc398567258 \h 17Step 2: Call Your Validation Method PAGEREF _Toc398567259 \h 17Step 3: Add Validation to Your Controls PAGEREF _Toc398567260 \h 18Verify Binding Credentials PAGEREF _Toc398567261 \h 20Advanced Concepts PAGEREF _Toc398567262 \h 21jQuery and Custom JavaScript PAGEREF _Toc398567263 \h 21Debugging Tools PAGEREF _Toc398567264 \h 22Debug Mode PAGEREF _Toc398567265 \h 22Local Binding Mode PAGEREF _Toc398567266 \h 22Debug Binding Mode PAGEREF _Toc398567267 \h 22Using the Debug Binding Id PAGEREF _Toc398567268 \h 22Save as Debug Policy PAGEREF _Toc398567269 \h 23Load Debug Policy PAGEREF _Toc398567270 \h 23Staging/Posting to the Test Server PAGEREF _Toc398567271 \h 23Step 1: Publish CompanyBinding to your Local Machine PAGEREF _Toc398567272 \h 23Step 2: Copy the Support Files PAGEREF _Toc398567273 \h 23Step 3: Locate and Copy Your Website Dlls PAGEREF _Toc398567274 \h 24Step 4: Copy Your Binding dlls PAGEREF _Toc398567275 \h 25Use this document when setting up a new online binding project, or modifying an existing project. It contains tools and tips needed to help make them fast and easy.TFW/Binding StructureThe main TFW website and the Binding Website are now separate projects, with a third project containing code shared between the two. Additionally, there are tables in tcrsu1.RSAdmin that control binding projects (their name, company ID, enabled/disabled, and other information similar to WebForms).In Team Foundation Server, you’ll find the three projects under panyBinding is the site containing the special online binding pages, such as additional information pages, application pages, ID card printing, etc. There will be various branches of the TFW project under the various ConsumerRater folders. Unless your project requires some special customization, you usually won’t be modifying these projects. The third is the ITC.TFW project, which contains the dlls and custom code needed to power the TFW project, the CompanyBinding site, and your own personal backend binding code.Binding FlowWhen a user clicks “Bind Now” in TFW, several things happen. The policy and the rated policy are both serialized to TT2 and saved to a database along with information about the agency, the agency’s settings within TFW, TFW’s css file and other information needed to bind. TFW then redirects to the CompanyBinding site, which is designed to use the css file from TFW to mimic its look and feel. The CompanyBinding then loads all the information, rebuilds the policies, looks up the correct page and redirects the user to the binding page specific to your company.There are other methods that can be used. Some binding companies are a simple redirect directly from TFW to the company’s own binding site. In some cases, you will need to make a page within our binding site to perform tasks like uploading to the company, creating XML files, etc. Some companies can bridge directly after the real-time rate, and can bypass the binding site completely. The binding process currently supports any of these methods (see below for information on how to set up these kinds of companies).Creating a New Binding ProjectStep 1: Create an Entry in the DatabaseEdit the table below, in the tcrsu1.RSAdmin database. Its concept and structure is similar to tblECMPAvailableApplications used for WebForms. Enter the information about your company into tblConsumerBindingApplications on the test server. An explanation of the fields is below:Record IDAuto-generated. Ignore.MasterCompanyIdIf you have more than one product or state for a particular company, the MasterCompanyId is used to redirect to a single company’s binding pages. If MasterCompanyId is -1, the site will redirect to the company pages for the CompanyId field. The folder structure in the site is such that it is named after each company id, and this is how the site determines which page to panyIdThis is the Company ID from CRM. This number is used to redirect to the correct page. If there is no MasterCompanyId, the CompanyID field is used. Otherwise, the MasterCompanyID field is panyNameThis is the name of the company (usually a name plus a state). It is not used by the site itself, it exists to make identifying the company easier when looking at the panyStateThe state for this company.RedirectUrlThis is the name of the page the site will redirect to (for example Additional.aspx). If your page is named something different, enter it here. Do not include the folder name; this will be auto-calculated by the site.EnabledIf true, the binding is enabled for this company, and “Buy Now” will appear on the comparison. If false, the button will be hidden.RedirectToBridgeUrlThis field is usually false, but if enabled, the site will bridge directly to the company’s Bridge URL as returned by the real-time system. This type of bridge only works if the company has some way of distinguishing between a normal rate request and a company binding request (usually an alternative set of credentials supplied during rating). See also the UserName and Password fields below.UserName, Password, ProducerCode and SubProducerCodeThis is the alternate set of credentials that can be used during the binding request, for companies that bridge directly to the company for binding. They get added as company data in the Policy, as RTROverrideUserName, RTROverridePassword, RTROverrideProducerCode, RTROverrideSubProducerCode. If your company uses direct bridging, enter these credentials, otherwise leave them blank. Note: by default these fields do nothing, the real-time module must have support to pass these credentials instead of the normal credentials if they exist.ExportPolicyIdToDbUsually false, if true TFW will export a link to the policy in the quote storage system to a database table in RSAdmin. This can be used to later mark the policy as bound using our BindPolicy Web API service (this is documented in a different document).PolicyIdRealtimeParamNameUsually blank, if the field exists, during binding requests, this is the name of the parameter appended to the bridge URL to identify the quote to be marked bound using the BindPolicy service (returned by the ExportPolicyToDb function).CanVerifyBindingCredentialsIf true, this company supports a function to verify username, password, producer code, etc. as valid for binding. Companies that support this function will have an additional button enabled in the Company List’s Additional Information section to verify credentials. If clicked, the TFW website will contact the CompanyBinding site for your company, and look for a specific VerifyBindingCredentials.ashx service. It will expect this service to return a serialized VerifyBindingCredentialsResponse object. Your service will be responsible for contacting the company to ensure the credentials are valid.RedirectToNewBlankPageIf true, clicking “Buy Now” will open the binding in a new page. This can be useful for sites that are embedded in an iFrame and otherwise would look terrible as part of another site. If your company does not look useable or otherwise looks really bad when TFW is run in an iFrame, set this to true.Step 2: Create your Binding DllThis is sometimes optional, but usually your company will require various functions (XML bridging, screen scraping, additional real-time requests, etc.). Any code you need that is not directly related to the interface should go here. Unlike WebForms, DO NOT ADD ANYTHING TO APP_CODE. All code, classes, constants, etc. should be located in the binding dll.If you have multiple states, create one project per state (you can have a base module that other states use as a parent as well, similar to real-time).You create these projects in the ITC.TFW project. Name the files in the format ITC.panyName.State. The namespaces in each should be the same as the name. See Dairyland below as an example:If you use screen scraping, the xml site references should also be included in your dll, as embedded resources. Use ITC core functions to read the xml (for example IOLib.ReadResourceFile("ITC.Binding.Dairyland.TX.SiteReference.test.xml")).Once you have created your dlls, add post-build events to copy these dlls to the c:\dotnetcore05 folder:Step 3: Create Your Binding PagesIn the CompanyBinding project, create a new folder for your project. It must be named with the company ID, in the specific format “Company_companyID”, for example “Company_105189511”. If you have a master company ID you may have only one folder, but you can have one for each state or company if necessary.Create your binding application pages here. You can have extra css files, JavaScript, anything you need beyond the standard empty page.Creating New PagesEach page you create should use the master page FormEntry.Master at the base level of the project. Pages are normally descended from the .NET “Page” class. Change yours to descend from BasePage (defined in the binding site). This will ensure any additional custom functionality (like multi-language support) works in your page.To access special properties and functions of the master page, add a reference to the FormEntry.Master class to your aspx. Adding this line will make it so referring to the Master variable in the code will include customizations added to the FormEntry page, rather than only the properties available to a base Page object.For example, you can always refer to “Master.FindControl” because all pages have that function. However, if you try to access the custom “Master.AddHelp” function, you won’t be able to access that without type-casting the master page, or adding the special line to your aspx as above.Custom css and JavaScript ReferencesIf you want to include custom JavaScript or css files, just add them to the folder with your other pages. To add a reference to them, add them using the code below (with your company name and file names):If you have additional style sheets, you can also add them by adding links to the header place holder on your page:Do NOT add JavaScript files this way. Always add using the c# code, by adding script references to the ScriptManager as above.Css and JavaScript FilenamesYou’ll notice that many files have “-1.0” or some other version number at the end. If you make changes to your css or JavaScript files AFTER the project has been released, please change this number and the reference to those files. This will ensure a new copy is downloaded each time and not cached in the user’s browser.Designing Your Binding PagesThe BindingSession ObjectWhen the site redirects to binding, The policy, rated policy, TFW settings, current agency information, etc., are all stored in an object of type BindingSessionInfo (defined in the ITC.TFW.Binding.dll from the ITC.TFW project). The object will be a subclass of this type, usually AUBindingSessionInfo or HOBindingSessionInfo.To access this information, use Binding.BindingSession. This will be of the base type, meaning it is not auto or homeowner, and so the only references will be to things like “BasePolicy” (which is type InsPolicy). If you know what type your company is (for example, you’ll always have an Auto policy for your company), you can use Binding.AUBindingSession. This will automatically type-cast your object.For example, to access the auto policy, use Binding.AUBindingSession.Policy. For the rated version, use Binding.AUBindingSession.RatedPolicy.Custom Binding User ControlsThe CompanyBinding site has sever controls to make things easier to create quickly. These are located in the BindingUserControls page. To use one, simply change to the “Design View” of your page, and drag it on the page (it will most likely put it in a weird spot, just change back to the html view and move it to where you want it.ApplicationEntryControlThe ApplicationEntryControl is the basic empty template used by the others, and can be used to render simple questions. The control includes everything needed to display the control, with all the correct css classes, images, mobile and multi-lingual support, etc. It contains a ContentTemplate where you insert your entry control (text box, combo box, date entry, etc). Below is a simple example of how to use one:The text box in the above example is your new entry. It will be rendered on the page with a caption and positioned so that it lines up with other entries:Note that text boxes, dropdown lists and other controls should have the “Entry” css class. This will style them to look like the rest of the TFW project.PropertiesCaption: This is the caption shown for the control (in this example “Test Entry”).Required: If true, the word “Required” shows below the caption. Use the validation library to enforce this (see Validation below).RequiredText: The text of the “required” label.PageName: This is the name that is attached to css classes within the entry. All controls on your page should have the same page name. This allows all the controls to be moved or shifted (or customized) all at once via css.EntryCaptionLabel: A reference to the caption label, in case extra customization is needed. Normally, just use the “Caption” property to set the text.EntryOuterPanel: A reference to the outer panel containing the other controls. This is used for special customization only.EntryHelpPanel: A reference to the panel containing the help box. . This is used for special customization only.HelpIconVisible: If true, the Help icon is visible when tabbing into the control. Note that it is enabled automatically by the AddHelp method of the control (see below).MethodsAddHelp(string helpText, string controlId): This adds a help icon that appears when tabbing into the control. Hovering over the help icon displays the helpText. The controlId is the name of the control to add help to (the entry you added to the ContentTemplate).For example, TestEntry.AddHelp(“This is fun help!”, “SomeEntry”); GetControl<TControl>(string id) where TControl : Control:Normally, to access a control within the ContentTemplate, you would have to use FindControl and type-cast the result as the correct type of control. GetControl is a slightly easier and more readable way to retrieve a control, for example:TestEntry.GetControl<TextBox>(“SomeEntry”).Text = “blah”;CoverageDisplayThis adds a section that displays liability coverages that were selected:You must call the function to fill this information yourself, and you can specify which policy to use:Coverages that were rated and have greater than zero premium are displayed. There is an optional parameter “ignorePrems”. If true, the coverages are displayed even if the premium is 0.PageHeaderControlThis is simply the header that appears at the top of the page. Include one per page.PropertiesHeaderText: The main header text at the top.SubHeaderText: The smaller text that appears below the header.PageName: This is the name that is attached to css classes within the entry. All controls on your page should have the same page name. This allows all the controls to be moved or shifted (or customized) all at once via css.AddressEntryControlThis is a simple address with 2 address lines, and City, State and Zip Code entries.PropertiesShowLabelOnly: If true, the City/State/Zip fields only show text labels, not editable fields.Address1EntryControl: A reference to the address line 1 control.Address2EntryControl: A reference to the address line 2 control.CityStateZipEntryControl: A reference to the city/state/zip entry control.Address: An object of type Address. Set the properties of this object to set the values of the various entry controls.MethodsSetupValidation(IList<ValidationListItem> validationList): This sets up validation for all entries. The only parameter is the validation list to use (should usually be Master.ValidationList). See Validation for more information.PriorInsuranceControlThis control contains a fully function set of prior insurance entries, including validation:PropertiesSetupHelp: If true, automatic standard help text is added to each entry. Defaults to true.Policy: The policy used to bind the entries. Defaults to BindingLib.BindingSession.Policy.PageName: This is the name that is attached to css classes within the entry. All controls on your page should have the same page name. This allows all the controls to be moved or shifted (or customized) all at once via css.PriorInsuranceEntryControl: A reference to the Prior Insurance yes/no. Used for special customization only.PriorMonthsEntryControl: A reference to the Prior Months entry. Used for special customization only.PriorExpDateEntryControl: A reference to the Prior Exp date. Used for special customization only.PriorLimitsEntryControl: A reference to the Prior Limits entry. Used for special customization only.PriorInsuranceEntriesContainerPanel: A reference to the panel containing the entries. Used for special customization only.Methods:SetupValidation(IList<ValidationListItem> validationList): This sets up validation for all entries. The only parameter is the validation list to use (should usually be Master.ValidationList). See Validation for more information.SectionHeaderControlThis is a header between sections on the page.PropertiesCaption: The text of the section.PageName: This is the name that is attached to css classes within the entry. All controls on your page should have the same page name. This allows all the controls to be moved or shifted (or customized) all at once via css.SectionCaptionLabel: A reference to the caption label. Used for special customization only.TermsAgreementControlThis is a generic question control with a paragraph of text and a yes/no entry:PropertiesRequired: If true, the word “Required” shows below the caption. Use the validation library to enforce this (see Validation below).CaptionText: The text of the control.PageName: This is the name that is attached to css classes within the entry. All controls on your page should have the same page name. This allows all the controls to be moved or shifted (or customized) all at once via css.TermsAcceptEntry: A reference to the yes/no entry box. Used for special customization only.TermsAccepted: A Boolean property that is “true” if the user answered “yes”. Easier than checking the value of TermsAcceptEntry.Note that by default, the entry is populated with “yes/no”. Using TermsAcceptEntry, other custom options can be used, but the value will have to be checked directly using TermsAcceptEntry rather than the TermsAccepted property.WebDialogThis is a generic web-popup dialog box:The dialog has a ContentTemplate much like other user controls in this section. Any content can be added to the interior of the dialog.PropertiesClientCancel: if true, clicking “cancel” will not post back to the server, it will automatically close using client script (defaults to true).AutoHideOnClose: If true, the dialog will automatically hide itself on clicking “ok” or “cancel” (but after any OnOkClick or OnCancelClick events are resolved).DialogExtender: A reference to the modal dialog extender controlling the popup. Used for special customization only.TextLabel: A reference to the internal Text Label. Used for special customization only.OkButton: A reference to the Ok Button. Used for special customization only.CancelButton: A reference to the Cancel Button. Used for special customization only.CaptionLabel: A reference to the Caption Label. Used for special customization only.Caption: The title bar of text of the dialog.DialogText: If only text is needed, set this property. There is no need for a content template if only text is shown.MaxWidth: A limit on the width of the dialog. Defaults to -1 (no limit). This is a .NET unit, meaning it can be a pixel size, em size, percentage, etc.MethodsShow: Shows the dialog.Hide: Hides the dialog. Note, that when pressing Ok or Cancel, if AutoHideOnClose is true, the dialog will hide itself without calling Hide explicitly.EventsOnOkClick: The event that is fired when the Ok button is clicked. OnCancelClick: The event that is fired when the Cancel button is clicked.Date EntriesFor date entries, the only thing that needs to be done is to add the css class “DateEntry” to a text box:The master page turns these entries into date entries automatically using a custom jQuery plugin:Validation must be done on the server.Help MessagesTo add help messages to an entry in a standard ApplicationEntryControl, just use the ApplicationEntryControl’s “AddHelp” method.If you have a custom control that does not use the standard controls, you will have to add the help definition manually to the Master Page’s help list:The IconContainerId is the client id of the container holding the image of the help icon. The InfoContainerId is a reference to the panel holding the help text (there is a help panel on the master page used in the example above, which should be used in most cases). The Text property is the text of the help box. Mobile determines the behavior of the help button – on mobile devices, the button must be clicked (rather than hovered). Set the Mobile flag based on the binding session’s style version (this is inherited from TFW).The EntryId is the entry the help button is attached to.If Top is true, the box is opened above the entry, otherwise it opens below. Usually default this to “true” unless the entry is far up on the page and would go off the top if rendered normally.Multi-Lingual SupportThe site supports multi-lingual text boxes and entries. The validation and help systems can also support multiple languages. If your application pages will support multiple languages (this is up to the company and/or ITC management), be sure to define all labels, help, and visible text using language identifiers rather than plain text. In fact, it’s a good idea to do this anyway, in case the company ever changes its mind. For each reference to a language identifier, there MUST be an entry in the Lang.resx file located in the App_GlobalResources folder. This is simply a dictionary of identifiers and their English translations. Spanish translations are located in Lang.es.resx. The identifiers are the same, just with different text. For company-specific translations, be sure to add your company’s name as part of the identifier to help distinguish between different companies (for example “DaiylandCreditDisclaimer”). If there is no translation for an identifier in the English lang.resx file, the compiler will generate an error. For references in C# code, it will result in a run-time error. There must always be an English translation. If there is no Spanish translation, no error will occur, the label will simply fall-back to English.To disable all translations on your page, you can force it to English:Language IdentifiersTo put a language identifier into aspx source code, use the following syntax in the Text property of the label or other control:Text="<%$Resources:Lang,Identifier%>"Lang is the name of the language resource file to use. It should always be the same.Identifier is the identifier of the entry you added to Lang.resx (and optionally other language files).To add text at run-time using C# code, use the functions of GlobalizationLib (located in the Core Library ITC.Globalization):GlobalizationLib.Translate(“Identifier”), or GlobalizationLib.TranslateList(listOfIdentifiers), or other functions within the library. It should identify the language file for you.ValidationValidation is handled completely by the server, using an extensive library located in ITC.TFW.dll.To add validation to your page, refer to the following steps:Step 1: Add a BuildValidationList Method to the PageAdd a method to your page to build the validation list. The name of the Method isn’t important, but the final line of the Method must be the initialization line as shown below:Step 2: Call Your Validation MethodWhenever validation should be performed, call this method to build the validation list, and check to see if the page is valid (usually on the “Next” button, but not other buttons such as “Previous”):Only continue on to the next step or perform actions if the page is actually valid.Step 3: Add Validation to Your ControlsOnce you have a method to build the validation, add validation to those controls that need it. You do this by adding ValidationListItems to the master page’s ValidationList. There are several overloads for different types of validation methods, and the Validation class contains some pre-made validation types (for example, to validate a standard TermsAcceptValidator). Validation items can refer either to a control (like a text-box) directly, or to one of the standard Binding User Controls (and any entry contained within it).For example, the following is a simple test to make sure that a text box has information entered:The first parameter is the User Control that contains the text box, which is named “SomeEntry” (passed as the id of the control in the second parameter), and the third parameter is the name of the control. This name is used to construct the error message (for example “Some Entry is required.”).If nothing is entered, an error appears on screen:Hovering over the error icon shows the reason for the invalid entry:The default constructor for ValidationListItem assumes you are only checking to see if information exists. You may also include many other parameters, for customized validation methods, checks for list boxes, etc.For example, this function has a custom validation method called ValidateLicenseNumber. You pass this method into the validation constructor. Note that we pass “false” for the “required” parameter, because custom validation methods handle their own checks for the validity of the data; the required parameter is ignored:After adding this, create your custom validation function. In this case, it’s a simple check to see if the license number is 8 characters:Additionally, there is an optional Parameter that can be passed into the Validation function. In this case, pretend we have a variable from another entry, called “isLicensed”. The value of this parameter is passed into the validation method at the time the validation happens:This allows us to perform different validation depending on whether the user is licensed or not:To validate a DropDownList, tell the constructor which value constitutes “not selected”:If the dropdown has this value, it will be considered “not entered”.If using the “PriorInsuranceEntryControl” or “AddressEntryControl”, inside this method, call the SetupValidation method:There are a lot of other functions and advanced features that the validation can perform, so be sure to ask if there is some scenario you can’t figure out.Verify Binding CredentialsIf your site contains a Verify Binding Credentials function, you will need to add support for it within the site, in the form of a VerifyBindingCredentials.ashx file. Create a new Generic Handler (from the Add New Item option in Visual Studio), and name it VerifyBindingCredentials.ashx. TFW will look for this page when verifying credentials.This handler will need to contact the company, verify the credentials, return a JSON response to TFW, and log any errors. The TFW site will post JSON data containing a RateCompany object to your handler. This will be information about the company making the request. The code for contacting the company should be located in your binding dll in the ITC.TFW project. An example of MILE Auto’s “verify” function looks like this:Advanced ConceptsjQuery and Custom JavaScriptWhen using jQuery, you can hook up events on the client to various controls. When .NET does partial AJAX postbacks (such as when clicking the “Next” button), these controls are re-drawn when the request is complete. This will destroy any events you have added via jQuery. To make sure these events are added each time a postback is complete, there is a plugin provided by the master page that allows you to detect which controls need to have events updated.The master page will check to see if your page contains either of the two JavaScript functions “postBackInit” and “oneTimeInit”. If the oneTimeInit function in your custom JavaScript, it only gets called one time, the very first time a page loads.If postBackInit exists, it will be called any time an AJAX postback completes, with a single parameter containing a list of all Update Panels on the page that were updated as a result of this postback. You should add any extra events you need inside this function (for example, code to hide or show a section based on a yes/no dropdown box). To prevent controls from having these events hooked up more than once, we only want to hook up events when a control has actually been updated. Normally postBackInit is called on every postback by the master page, so the jQuery plugin “whenUpdated” is provided to detect which controls need updates. The whenUpdated plugin acts like a filter on any jQuery result. When combined with another jQuery selector, this plugin will filter out any matching results that were not actually updated.For example:This snippet tells jQuery to bind a “click” event to any control with a class of “somebutton”. The “whenUpdated” filter will remove any matching buttons that were not updated during this last postback. This ensures that events are not hooked up that don’t need to be.In the CompanyBinding project, always use postBackInit and whenUpdated when binding events. Also note that whenUpdated will always return ALL results on the initial page load, so all events will be bound the first time.Debugging ToolsWhen using TFW on a local or test machine, at the top of each page will be a set of links to aid in debugging.Debug ModeIf Debug Mode is on, all validation is disabled (in TFW only, NOT the CompanyBinding site). This allows you to go to page quickly without entering much information. Note that you can get some strange results if you attempt to rate without filling much in.Local Binding ModeWhen Local Binding is on, clicking “Buy Now” will redirect to your localhost CompanyBinding project rather than the test server. Note that the development server for your CompanyBinding site must be running for this to work. The easiest way is just to set “Default.aspx” in the CompanyBinding site as your start page, and run the project. Leave it running while you redirect from the TFW project. You can the set breakpoints in your code if needed.Debug Binding ModeIf DebugBinding is on, clicking “Buy Now” redirects to an empty page with nothing but the link to the local binding site. This allows you to extract the ID of the binding information object stored in the database. You can use this to debug your binding policy over and over in the CompanyBinding site without going through all the entry within the TFW site.Using the Debug Binding IdTo debug using the binding id, first click “Debug Binding” in TFW as described above. Copy the GUID from the end of the URL after you’ve clicked “Buy Now”.In the CompanyBinding project, select “Dispatcher.aspx” as your start page. Right-Click the website at the top and select “Start Options”.Add “?id=<your GUID>&deleteentry=false” to the end of “dispatcher.aspx”:The “deleteentry=false” ensures that the dispatcher page does not delete your binding information from the database. You should now be able to simply run the project, and it will load the binding page with the information you previously entered into TFW.Save as Debug PolicyEach TFW account can save a single policy as the debug policy. Just click this from anywhere within TFW to save the current policy as the debug policy. You can then load that policy again by clicking “Load Debug Policy”. Note: there is only 1 debug policy per account, so if you save over the existing one, you may affect others using the same account.Load Debug PolicyLoads a debug policy previous stored with “Save as Debug Policy”.Staging/Posting to the Test ServerThe staging area for the CompanyBinding site is \\wsc4\staging\CompanyBinding.Unlike WebForms, the CompanyBinding site is a compiled site, so you’ll only be copying dlls and support files (aspx, js, css, etc) – never c# source code. The process is a little more complex.Step 1: Publish CompanyBinding to your Local MachineFirst, publish the site to any folder on your local machine. You will copy files to the staging area from this local folder. Right-Click on the website (right below the solution) and select “Publish”. The Publish settings MUST MATCH the screenshot below (with the exception of the location):Step 2: Copy the Support FilesIn the local folder, you should see the folder for your company (for example Dairyland below):Copy this entire folder to the root of the staging area (\\wsc4\staging\CompanyBinding). Step 3: Locate and Copy Your Website DllsOpen up your folder and locate any of the aspx files you created, and open it in a text editor (note: this MUST be done in the location you published the site; this will not work if you use the original source in your “projects” folder):At the end of the first line, you will find the name that .NET used to compile your assembly:Look in the “bin” folder of your published site. Locate the dll and pdb files named with this number, and copy them to the “bin” folder of the staging area:Note: if you have sub-folders containing aspx files in your company folder, each folder will have a distinct dll with it. Open an aspx file in those sub-folders to find the name of any additional dlls that need to be copied.Step 4: Copy Your Binding dllsFinally, find any dlls (along with pdb and xml files) that were compiled as part of your company in the ITC.TFW project and copy those to the “bin” folder in the staging area as well:NOTE: DO NOT UPDATE ANY OTHER FILES without first getting permission from Alan or Pete’s team. If you need to make changes to the master page or any other support pages within CompanyBinding, get permission first. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download