/// ----------------------------------------------------------------------------- /// <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> /// 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); } }