protected void BtnAddInterest_Click(object sender, EventArgs e) { try { if (this.subscription_error.Visible) { this.subscription_error.Visible = false; } if (string.IsNullOrEmpty(ddlAreaInterest.SelectedValue) || string.IsNullOrEmpty(ddlSectorInterest.SelectedValue)) { if (this.global_success.Visible) { this.global_success.Visible = false; } this.global_error.Visible = true; this.global_error_msg.Text = "Please select a Sector and an Area"; } else { DataTable dtSubscriber = objSubscriber.GetSubscriber(" where SubscriberEmail='" + txtSubEmail.Text + "' and InterestSector=" + ddlSectorInterest.SelectedValue + " and InterestArea=" + ddlAreaInterest.SelectedValue); if (dtSubscriber.Rows.Count > 0) { if (this.global_success.Visible) { this.global_success.Visible = false; } this.global_error.Visible = true; this.global_error_msg.Text = dtSubscriber.Rows[0]["SectorInterestName"].ToString() + " - " + dtSubscriber.Rows[0]["AreaInterestName"].ToString() + " already exist in your interest list"; UpdAdd.Update(); upEdit.Update(); } else { string strmsg = string.Empty; objInterest.InterestID = 0; objInterest.InterestSector = int.Parse(ddlSectorInterest.SelectedValue); objInterest.InterestArea = int.Parse(ddlAreaInterest.SelectedValue); objInterest.InterestSubscriber = int.Parse(Session[RunningCache.SubscriberID].ToString()); objInterest.InterestStatus = true; objInterest.InterestCode = GetUniqueKey(6); objInterest.LastModifiedBy = int.Parse(Session[RunningCache.UserID].ToString()); objInterest.LastModifiedDate = DateTime.Now; Session[RunningCache.InterestID] = objInterest.SaveInterest(objInterest, out strmsg); DataTable dt = objInterest.GetInterest(" where InterestID=" + int.Parse(Session[RunningCache.InterestID].ToString())); if (dt.Rows.Count > 0) { if (this.global_error.Visible) { this.global_error.Visible = false; } this.global_success.Visible = true; this.global_success_msg.Text = dt.Rows[0]["SectorInterestName"].ToString() + " - " + dt.Rows[0]["AreaInterestName"].ToString() + " has been added to your interest list"; } UpdAdd.Update(); upEdit.Update(); upCrudGrid.Update(); bindgrid(); filldataSubscriber(dtSubscriber.Rows[0]["SubscriberEmail"].ToString(), dtSubscriber.Rows[0]["SubscriberCode"].ToString()); } } } catch (Exception ex) { } }