/// ----------------------------------------------------------------------------- /// <summary> /// BindData gets the affiliates from the Database and binds them to the DataGrid /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/17/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- private void BindData() { var objAffiliates = new AffiliateController(); //Localize the Grid Localization.LocalizeDataGrid(ref grdAffiliates, LocalResourceFile); grdAffiliates.DataSource = objAffiliates.GetAffiliates(VendorID); grdAffiliates.DataBind(); cmdAdd.NavigateUrl = FormatURL("AffilId", "-1"); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void OnUpdateClick(object sender, EventArgs e) { if (Page.IsValid) { var objAffiliate = new AffiliateInfo { AffiliateId = AffiliateId, VendorId = VendorId, StartDate = StartDatePicker.SelectedDate.HasValue ? StartDatePicker.SelectedDate.Value : Null.NullDate, EndDate = EndDatePicker.SelectedDate.HasValue ? EndDatePicker.SelectedDate.Value : Null.NullDate, CPC = double.Parse(txtCPC.Text), CPA = double.Parse(txtCPA.Text) }; var objAffiliates = new AffiliateController(); if (AffiliateId == -1) { objAffiliates.AddAffiliate(objAffiliate); } else { objAffiliates.UpdateAffiliate(objAffiliate); } //Redirect back to the portal home page Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } }
/// ----------------------------------------------------------------------------- /// <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; } } }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdDelete_Click runs when the Delete Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void OnDeleteClick(object sender, EventArgs e) { if (AffiliateId != -1) { var objAffiliates = new AffiliateController(); objAffiliates.DeleteAffiliate(AffiliateId); //Redirect back to the portal home page Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } }