Пример #1
0
        //protected void btnDeleteSelected_Click(object sender, EventArgs e)
        //{
        //    userVo = (UserVo)Session[SessionContents.UserVo];
        //    customerVo = (CustomerVo)Session[SessionContents.CustomerVo];
        //    userId = userVo.UserId;
        //    customerId = customerVo.CustomerId;

        //    foreach (GridViewRow dr in gvNotification.Rows)
        //    {
        //        CheckBox checkBox = (CheckBox)dr.FindControl("chkBx");
        //        if (checkBox.Checked)
        //        {
        //            long NotificationID = Convert.ToInt64(gvNotification.DataKeys[dr.RowIndex].Value);

        //             //Need an Extra Column in the Notification Table to mark a row as deleted

        //            if (alertsBo.DeleteAlertNotification(NotificationID))
        //            {

        //            }
        //        }
        //    }
        //    BindCustomerSpecificNotifications(customerVo);

        //    // Success Message
        //    BindNotificationsGridView(customerVo);
        //}

        private void BindNotificationsGridView(CustomerVo CustVO)
        {
            lblCustomerName.Text = CustVO.FirstName + " " + CustVO.LastName;

            userVo     = (UserVo)Session[SessionContents.UserVo];
            customerVo = (CustomerVo)Session[SessionContents.CustomerVo];
            userId     = userVo.UserId;
            customerId = customerVo.CustomerId;

            gvNotification.DataSource = null;
            gvNotification.DataBind();

            AlertNotificationList = alertsBo.GetCustomerNotifications(customerId, mypager.CurrentPage, hdnSort.Value, out count);
            if (count > 0)
            {
                lblTotalRows.Text = hdnRecordCount.Value = count.ToString();
                tblPager.Visible  = true;
            }
            if (AlertNotificationList != null)
            {
                DataTable dtAlertNotifications = new DataTable();

                dtAlertNotifications.Columns.Add("EventQueueID");
                dtAlertNotifications.Columns.Add("Category");
                dtAlertNotifications.Columns.Add("Alert");
                dtAlertNotifications.Columns.Add("Scheme");
                dtAlertNotifications.Columns.Add("Message");
                dtAlertNotifications.Columns.Add("NotifiedDate");

                DataRow drAlertNotifications;
                for (int i = 0; i < AlertNotificationList.Count; i++)
                {
                    drAlertNotifications = dtAlertNotifications.NewRow();
                    alertNotificationVo  = new AlertsNotificationVo();
                    alertNotificationVo  = AlertNotificationList[i];

                    drAlertNotifications[0] = alertNotificationVo.NotificationID.ToString().Trim();
                    if (alertNotificationVo.Category.ToString().Trim() == "Transactional")
                    {
                        drAlertNotifications[1] = "Confirmation";
                    }
                    else if (alertNotificationVo.Category.ToString().Trim() == "Date")
                    {
                        drAlertNotifications[1] = "Reminder";
                    }
                    else if (alertNotificationVo.Category.ToString().Trim() == "Data")
                    {
                        drAlertNotifications[1] = "Occurence";
                    }
                    drAlertNotifications[2] = alertNotificationVo.EventCode.ToString().Trim();
                    if (alertNotificationVo.SchemeID.ToString() == "" || alertNotificationVo.SchemeID.ToString() == "0")
                    {
                        drAlertNotifications[3] = alertNotificationVo.SchemeID.ToString().Trim();
                    }
                    else
                    {
                        drAlertNotifications[3] = alertNotificationVo.Name.ToString().Trim();
                    }
                    //if (alertNotificationVo.Reminder.ToString().ToLower() == "false")
                    //    drAlertNotifications[3] = "No";
                    //else
                    //    drAlertNotifications[3] = "Yes";

                    drAlertNotifications[4] = alertNotificationVo.EventMessage.ToString();
                    drAlertNotifications[5] = alertNotificationVo.PopulatedDate.ToShortDateString();

                    dtAlertNotifications.Rows.Add(drAlertNotifications);
                }

                gvNotification.DataSource = dtAlertNotifications;
                gvNotification.DataBind();
                gvNotification.Visible = true;
                this.GetPageCount();
            }
            else
            {
                pnlNoEntries.Visible         = true;
                pnlCustomerSelection.Visible = false;
            }
        }