using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLayer;
using Telerik.Web.UI;

namespace NikaiDSR.Controls
{
    public partial class ViewContacts : Page
    {
        #region declarartion
        ContactManager ContM = new ContactManager();
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                Page.Title = "NIKAI - VIEW CONTACTS";
            }

        }

        protected void Grid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            Grid.DataSource = null;
            Grid.DataSource = ContM.GetCustomerContacts(Convert.ToInt32(Request.QueryString["CustId"].ToString()));
        }

        protected void Grid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;

                if (item["Status"].Text == "True")
                {
                    item["Status"].Text = "Active";
                }
                else
                {
                    item["Status"].Text = "Inactive";
                }
            }
        }
    }
}