Пример #1
0
        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();
            }
        }
Пример #2
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            AlertsBo alertBo = new AlertsBo();

            alertBo.ExecuteReminderAlert();

            alertBo.ExecuteConfirmationAlert();

            //alertBo.ExecuteOccurrenceAlert();

            //alertBo.ExecuteProcessAlertstoEmailQueue();

            ErrorMsg = "";
            return(JobStatus.SuccessFull);
        }
Пример #3
0
        protected void btnUpdateMobileNo_Click(object sender, EventArgs e)
        {
            //List<TextBox> txtMobileNoList=(TextBox)gvCustomerSMSAlerts.FindControl("txtMobileNo");
            hdnCustomerIdWithoutMobileNumber.Value = "";
            AlertsBo alertsBo   = new AlertsBo();
            string   customerId = "";

            foreach (GridViewRow gvr in gvCustomerSMSAlerts.Rows)
            {
                TextBox txtMobileNo = (TextBox)gvr.FindControl("txtMobileNo");
                if (txtMobileNo.Text != "0" && txtMobileNo.Text != null)
                {
                    customerId = gvCustomerSMSAlerts.DataKeys[gvr.RowIndex].Value.ToString();
                    alertsBo.UpdateCustomerMobileNumber(int.Parse(customerId), Int64.Parse(txtMobileNo.Text));
                    hdnCustomerIdWithoutMobileNumber.Value += "1,";
                }
            }
        }
Пример #4
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            //System.Threading.Thread.Sleep(2000);
            int          smsCount    = 0;
            int          smsLicence  = 0;
            SMSVo        smsVo       = new SMSVo();
            List <int>   alertIdList = new List <int>();
            EmailSMSBo   emailSMSBo  = new EmailSMSBo();
            List <SMSVo> smsVoList   = new List <SMSVo>();
            AdvisorBo    advisorBo   = new AdvisorBo();
            AlertsBo     alertsBo    = new AlertsBo();
            string       mobileNo;
            int          adviserId = 0;

            dsAdviserCustomerAlerts = (DataSet)ViewState["vsDsAdviserCustomerAlert"];
            if (Session["advisorVo"] != null)
            {
                adviserId = ((AdvisorVo)Session["advisorVo"]).advisorId;
            }
            if (lblLincenceValue.Text != "No SMS Licence Left!!")
            {
                smsLicence = int.Parse(lblLincenceValue.Text.ToString());
            }
            int i = 0;

            if (dsAdviserCustomerAlerts != null)
            {
                foreach (GridViewRow gvRow in gvCustomerSMSAlerts.Rows)
                {
                    if (gvRow.RowType == DataControlRowType.DataRow)
                    {
                        if (((CheckBox)gvRow.FindControl("chkCustomerSMSAlert")).Checked)
                        {
                            smsVo = new SMSVo();
                            if (dsAdviserCustomerAlerts != null)
                            {
                                mobileNo = dsAdviserCustomerAlerts.Tables[0].Rows[i]["Mobile"].ToString();
                                if (mobileNo != "0")
                                {
                                    if (mobileNo.Length <= 10)
                                    {
                                        smsVo.Mobile = Int64.Parse("91" + dsAdviserCustomerAlerts.Tables[0].Rows[i]["Mobile"].ToString());
                                    }
                                    else
                                    {
                                        smsVo.Mobile = Int64.Parse(mobileNo);
                                    }
                                }
                            }

                            smsVo.Message = CreateSMSMessage(dsAdviserCustomerAlerts.Tables[0].Rows[i]["CustomerName"].ToString(), dsAdviserCustomerAlerts.Tables[0].Rows[i]["Name"].ToString(),
                                                             dsAdviserCustomerAlerts.Tables[0].Rows[i]["AEL_EventCode"].ToString(), dsAdviserCustomerAlerts.Tables[0].Rows[i]["AEN_EventMessage"].ToString(),
                                                             advisorVo.OrganizationName);
                            smsVo.CustomerId = int.Parse(gvCustomerSMSAlerts.DataKeys[gvRow.RowIndex].Values["CustomerId"].ToString());
                            smsVo.IsSent     = 0;
                            if (dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertId"].ToString() != null)
                            {
                                smsVo.AlertId = int.Parse(dsAdviserCustomerAlerts.Tables[0].Rows[i]["AlertId"].ToString());
                            }
                            else
                            {
                                smsVo.AlertId = 0;
                            }
                            smsVoList.Add(smsVo);
                            alertIdList.Add(int.Parse(gvCustomerSMSAlerts.DataKeys[gvRow.RowIndex].Values["AlertId"].ToString()));
                            smsCount++;
                        }
                    }
                    i++;
                }
                if (smsCount <= smsLicence && smsCount != 0)
                {
                    smsVoList = emailSMSBo.AddToSMSQueue(smsVoList);

                    smsLicence = smsLicence - smsCount;
                    advisorBo.UpdateAdviserSMSLicence(adviserId, smsLicence);
                    advisorBo.AddToAdviserSMSLog(smsVoList, adviserId, "Alert");
                    alertsBo.UpdateAlertStatus(alertIdList, 1);
                    if (smsLicence == 0)
                    {
                        lblLincenceValue.Text = "No SMS Licence Left!!";
                    }
                    else
                    {
                        lblLincenceValue.Text = smsLicence.ToString();
                        GetAdviserCustomerAlerts(out dsAdviserCustomerAlerts);
                        SuccessMessage.Visible = true;
                    }
                }
                else if (smsCount == 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Please select an Alert!!');", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('You dont have enough SMS Credits to process this request');", true);
                }
            }
        }
Пример #5
0
        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;
            }
        }