/// <summary> /// Function that binds the customer subscribed events to the grid view /// </summary> /// <param name="customerId"></param> /// <param name="EventID"></param> private void BindSubscribedEventsGridView(int customerId, int EventID) { try { userVo = (UserVo)Session[SessionContents.UserVo]; customerVo = (CustomerVo)Session[SessionContents.CustomerVo]; userId = userVo.UserId; customerId = customerVo.CustomerId; gvTransactionalAlerts.DataSource = null; gvTransactionalAlerts.DataBind(); //function that retrieves the customer subscribed alerts from the DB AlertSetupList = alertsBo.GetCustomerSubscribedConfirmationAlerts(customerId, EventID, "Transactional", mypager.CurrentPage, out count); if (count > 0) { lblTotalRows.Text = hdnRecordCount.Value = count.ToString(); tblPager.Visible = true; } //if alerts are subscribed runs the piece of code below else displays that events dont exist if (AlertSetupList != null) { DataTable dtAlertSetup = new DataTable(); // creating a datatable with all the necessary details to bind to the gridview dtAlertSetup.Columns.Add("EventSetupID"); dtAlertSetup.Columns.Add("Details"); dtAlertSetup.Columns.Add("Message"); DataRow drAlertSetup; for (int i = 0; i < AlertSetupList.Count; i++) { drAlertSetup = dtAlertSetup.NewRow(); alertVo = new AlertsSetupVo(); alertVo = AlertSetupList[i]; //assigns the setupid to each row as a Datakey drAlertSetup[0] = alertVo.EventSetupID.ToString().Trim(); //Details is a combination of the event name and scheme name drAlertSetup[1] = alertVo.EventName.ToString().Trim() + " : " + alertVo.SchemeName.ToString(); if (alertVo.EventMessage.ToString().Trim() != "" || alertVo.EventMessage.ToString().Trim() != null) { //Message that gets displayed when the alert is triggered drAlertSetup[2] = alertVo.EventMessage.ToString().Trim(); } else { drAlertSetup[2] = ""; } dtAlertSetup.Rows.Add(drAlertSetup); } // binding the datatable to the gridview and making the grid visible gvTransactionalAlerts.DataSource = dtAlertSetup; gvTransactionalAlerts.DataBind(); gvTransactionalAlerts.Visible = true; lblMessage.Visible = false; this.GetPageCount(); } else { lblMessage.Visible = true; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerTransactionalAlertManagement.ascx:BindSubscribedEventsGridView()"); object[] objects = new object[0]; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }