/// ----------------------------------------------------------------------------- /// <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 void Page_Load(Object sender, EventArgs e) { if ((Request.QueryString["VendorId"] != null)) { VendorId = int.Parse(Request.QueryString["VendorId"]); } if ((Request.QueryString["AffilId"] != null)) { AffiliateId = int.Parse(Request.QueryString["AffilId"]); } //this needs to execute always to the client script code is registred in InvokePopupCal cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate); cmdEndCalendar.NavigateUrl = Calendar.InvokePopupCal(txtEndDate); if (Page.IsPostBack == false) { ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); AffiliateController objAffiliates = new AffiliateController(); if (AffiliateId != Null.NullInteger) { // Obtain a single row of banner information AffiliateInfo objAffiliate = objAffiliates.GetAffiliate(AffiliateId, VendorId, PortalId); if (objAffiliate != null) { if (!Null.IsNull(objAffiliate.StartDate)) { txtStartDate.Text = objAffiliate.StartDate.ToShortDateString(); } if (!Null.IsNull(objAffiliate.EndDate)) { txtEndDate.Text = objAffiliate.EndDate.ToShortDateString(); } txtCPC.Text = objAffiliate.CPC.ToString("#0.#####"); txtCPA.Text = objAffiliate.CPA.ToString("#0.#####"); } else // security violation attempt to access item not related to this Module { Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } } else { txtCPC.Text = "0.00"; txtCPA.Text = "0.00"; cmdDelete.Visible = false; } } }
/// <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 cmdUpdate_Click(object sender, EventArgs e) { if (Page.IsValid) { AffiliateInfo objAffiliate = new AffiliateInfo(); objAffiliate.AffiliateId = AffiliateId; objAffiliate.VendorId = VendorId; if (!String.IsNullOrEmpty(txtStartDate.Text)) { objAffiliate.StartDate = DateTime.Parse(txtStartDate.Text); } else { objAffiliate.StartDate = Null.NullDate; } if (!String.IsNullOrEmpty(txtEndDate.Text)) { objAffiliate.EndDate = DateTime.Parse(txtEndDate.Text); } else { objAffiliate.EndDate = Null.NullDate; } objAffiliate.CPC = double.Parse(txtCPC.Text); objAffiliate.CPA = double.Parse(txtCPA.Text); AffiliateController 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); } }