using framework_business; using framework_library; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class controls_module_unsubscribe : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } /// /// Unsubscribe from emails /// /// /// protected void btnUnsubscribe_Click(object sender, EventArgs e) { try { if (txbEmail.Text != String.Empty) { //handle email unsubscribe foreach (oSubscriber sub in xData.GetTypedByCriteriaSpecific("recId", typeof(oSubscriber), "email", txbEmail.Text)) { sub.isActive = false; if (xData.UpdateTyped("recId", sub.recId.ToString(), typeof(oSubscriber), sub)) { pnlResult.Visible = true; lblResult.Text = "You have been unsubscribed successfully."; } break; } } } catch (Exception ex) { exception.HandleException("Unsubscribe:", MethodBase.GetCurrentMethod().Name, ex, 0); Response.Redirect("/error", false); } } /// /// Unsubscribe from SMS /// /// /// protected void btnunsubscribeSMS_Click(object sender, EventArgs e) { try { if (txbMobile.Text != String.Empty) { //handle sms unsubscribe foreach (oSubscriberSMS sub in xData.GetTypedByCriteriaSpecific("recId", typeof(oSubscriberSMS), "mobile", txbMobile.Text)) { sub.isActive = false; if (xData.UpdateTyped("recId", sub.recId.ToString(), typeof(oSubscriberSMS), sub)) { pnlResultSMS.Visible = true; lblResultSMS.Text = "You have been unsubscribed successfully."; } break; } } } catch (Exception ex) { exception.HandleException("Unsubscribe:", MethodBase.GetCurrentMethod().Name, ex, 0); Response.Redirect("/error", false); } } }