protected void BindCustomerNotification() { int adviserId = 0; int id = 0; int Count = 0; string usertype = null; hdnCustomerIdWithoutMobileNumber.Value = ""; hdnCustomerNameWithoutMobileNumber.Value = ""; if (hdnCurrentPage.Value.ToString() != "") { // mypager.CurrentPage = Int32.Parse(hdnCurrentPage.Value.ToString()); hdnCurrentPage.Value = ""; } // DataRow drAdviserCustomerAlert = null; if (Session["UserType"] == "rm") { if (Session["rmVo"] != null) { id = ((RMVo)Session["rmVo"]).RMId; usertype = "rm"; //Session["UserType"] = null; } } else { if (Session["advisorVo"] != null) { id = ((AdvisorVo)Session["advisorVo"]).advisorId; usertype = "adviser"; } } AlertsBo alertsBo = new AlertsBo(); DataTable dtAdviserCustomerAlerts; dsAdviserCustomerAlerts = alertsBo.GetAdviserCustomerSMSAlerts(id, usertype); dtAdviserCustomerAlerts = dsAdviserCustomerAlerts.Tables[0]; if (dtAdviserCustomerAlerts.Rows.Count > 0) { if (Cache["CustomerSIPAlert" + advisorVo.advisorId] == null) { Cache.Insert("CustomerSIPAlert" + advisorVo.advisorId, dtAdviserCustomerAlerts); } else { Cache.Remove("CustomerSIPAlert" + advisorVo.advisorId); Cache.Insert("CustomerSIPAlert" + advisorVo.advisorId, dtAdviserCustomerAlerts); } gvAlertNotification.DataSource = dtAdviserCustomerAlerts; gvAlertNotification.DataBind(); } else { gvAlertNotification.DataSource = dtAdviserCustomerAlerts; gvAlertNotification.DataBind(); } }
public void GetAdviserCustomerAlerts(out DataSet dsAdviserCustomerAlerts) { int adviserId = 0; int id = 0; int Count = 0; string usertype = null; hdnCustomerIdWithoutMobileNumber.Value = ""; hdnCustomerNameWithoutMobileNumber.Value = ""; if (hdnCurrentPage.Value.ToString() != "") { mypager.CurrentPage = Int32.Parse(hdnCurrentPage.Value.ToString()); hdnCurrentPage.Value = ""; } DataRow drAdviserCustomerAlert = null; if (Session["UserType"] == "rm") { if (Session["rmVo"] != null) { id = ((RMVo)Session["rmVo"]).RMId; usertype = "rm"; //Session["UserType"] = null; } } else { if (Session["advisorVo"] != null) { id = ((AdvisorVo)Session["advisorVo"]).advisorId; usertype = "adviser"; } } AlertsBo alertsBo = new AlertsBo(); dsAdviserCustomerAlerts = alertsBo.GetAdviserCustomerSMSAlerts(id, usertype, mypager.CurrentPage, hdnNameFilter.Value.Trim(), out Count); ViewState["vsDsAdviserCustomerAlert"] = dsAdviserCustomerAlerts; lblTotalRows.Text = hdnCount.Value = Count.ToString(); if (dsAdviserCustomerAlerts.Tables[0].Rows.Count > 0) { DataTable dtAdviserCustomerAlerts = new DataTable(); dtAdviserCustomerAlerts.Columns.Add("CustomerId"); dtAdviserCustomerAlerts.Columns.Add("AlertId"); dtAdviserCustomerAlerts.Columns.Add("CustomerName"); dtAdviserCustomerAlerts.Columns.Add("Name"); dtAdviserCustomerAlerts.Columns.Add("AlertMessage"); dtAdviserCustomerAlerts.Columns.Add("TimesSMSSent"); dtAdviserCustomerAlerts.Columns.Add("LastSMSDate"); dtAdviserCustomerAlerts.Columns.Add("AlertDate"); dtAdviserCustomerAlerts.Columns.Add("Mobile"); for (int i = 0; i < dsAdviserCustomerAlerts.Tables[0].Rows.Count; i++) { drAdviserCustomerAlert = dtAdviserCustomerAlerts.NewRow(); if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["CustomerId"] != null && dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertId"] != null) { drAdviserCustomerAlert["CustomerId"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["CustomerId"].ToString(); drAdviserCustomerAlert["AlertId"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertId"].ToString(); if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["CustomerName"] != null) { drAdviserCustomerAlert["CustomerName"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["CustomerName"].ToString(); } else { drAdviserCustomerAlert["CustomerName"] = ""; } if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["Name"].ToString() != null) { drAdviserCustomerAlert["Name"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["Name"].ToString(); } else { drAdviserCustomerAlert["Name"] = ""; } if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertMessage"].ToString() != null) { drAdviserCustomerAlert["AlertMessage"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertMessage"].ToString(); } else { drAdviserCustomerAlert["AlertMessage"] = ""; } if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["TimesSMSSent"].ToString() != null && dsAdviserCustomerAlerts.Tables[0].Rows[i]["TimesSMSSent"].ToString() != "") { drAdviserCustomerAlert["TimesSMSSent"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["TimesSMSSent"].ToString(); } else { drAdviserCustomerAlert["TimesSMSSent"] = ""; } if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["LastSMSDate"].ToString() != null && dsAdviserCustomerAlerts.Tables[0].Rows[i]["LastSMSDate"].ToString() != "") { DateTime lastSMSDate = DateTime.Parse(dsAdviserCustomerAlerts.Tables[0].Rows[i]["LastSMSDate"].ToString()); drAdviserCustomerAlert["LastSMSDate"] = lastSMSDate.ToShortDateString(); } else { drAdviserCustomerAlert["LastSMSDate"] = ""; } if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertDate"].ToString() != null && dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertDate"].ToString() != "") { DateTime alertDate = DateTime.Parse(dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertDate"].ToString()); drAdviserCustomerAlert["AlertDate"] = alertDate.ToShortDateString(); } else { drAdviserCustomerAlert["AlertDate"] = ""; } drAdviserCustomerAlert["Mobile"] = dsAdviserCustomerAlerts.Tables[0].Rows[i]["Mobile"].ToString(); if (Int64.Parse(dsAdviserCustomerAlerts.Tables[0].Rows[i]["Mobile"].ToString()) != 0) { hdnCustomerIdWithoutMobileNumber.Value += dsAdviserCustomerAlerts.Tables[0].Rows[i]["CustomerId"].ToString() + ","; } if (drAdviserCustomerAlert != null) { dtAdviserCustomerAlerts.Rows.Add(drAdviserCustomerAlert); } } } gvCustomerSMSAlerts.DataSource = dtAdviserCustomerAlerts; gvCustomerSMSAlerts.DataBind(); gvCustomerSMSAlerts.Visible = true; pnlCustomerSMSAlerts.Visible = true; //lblNoRecords.Visible = false; divNoRecords.Visible = false; btnSend.Visible = true; this.GetPageCount(); TextBox txtName = GetCustNameTextBox(); if (txtName != null) { if (hdnNameFilter.Value != "") { txtName.Text = hdnNameFilter.Value.ToString(); } } } else { //lblNoRecords.Visible = true; divNoRecords.Visible = true; lblDisclaimer.Visible = false; gvCustomerSMSAlerts.Visible = false; pnlCustomerSMSAlerts.Visible = false; btnSend.Visible = false; DivPager.Visible = false; trPageCount.Visible = false; } }