/// -----------------------------------------------------------------------------
/// <summary>
/// Page_Load runs when the control is loaded
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
/// -----------------------------------------------------------------------------
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
cmdCancel.Click += OnCancelClick;
cmdDelete.Click += OnDeleteClick;
cmdSend.Click += OnSendClick;
cmdUpdate.Click += OnUpdateClick;
if ((Request.QueryString["VendorId"] != null))
{
VendorId = Int32.Parse(Request.QueryString["VendorId"]);
}
if ((Request.QueryString["AffilId"] != null))
{
AffiliateId = Int32.Parse(Request.QueryString["AffilId"]);
}
if (Page.IsPostBack == false)
{
var affiliateController = new AffiliateController();
if (AffiliateId != Null.NullInteger)
{
//Obtain a single row of banner information
var affiliate = affiliateController.GetAffiliate(AffiliateId);
if (affiliate != null)
{
StartDatePicker.SelectedDate = Null.IsNull(affiliate.StartDate) ? (DateTime?) null : affiliate.StartDate;
EndDatePicker.SelectedDate = Null.IsNull(affiliate.EndDate) ? (DateTime?)null : affiliate.EndDate;
txtCPC.Text = affiliate.CPC.ToString("#0.0####");
txtCPA.Text = affiliate.CPA.ToString("#0.0####");
}
else //security violation attempt to access item not related to this Module
{
Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true);
}
}
else
{
txtCPC.Text = 0.ToString("#0.0####");
txtCPA.Text = 0.ToString("#0.0####");
cmdDelete.Visible = false;
}
}
}