public override void PopulateData()
        {
            try
            {
                string   Message         = string.Empty;
                DateTime?dtFrom          = dtpFromDate.Value.ToDateorNull();
                DateTime?dtTill          = dtpToDate.Value.ToDateorNull();
                int      BookingStatusId = 0;
                string   MonthCommencing = string.Empty;
                if (dtFrom.Value == null)
                {
                    Message = "Required : From Date";
                }
                if (dtTill.Value == null)
                {
                    if (!string.IsNullOrEmpty(Message))
                    {
                        Message = "Required : To Date";
                    }
                    else
                    {
                        Message += Environment.NewLine;// "Required : To Date";
                        Message += "Required : To Date";
                    }
                }
                if (!string.IsNullOrEmpty(Message))
                {
                    ENUtils.ShowMessage(Message);
                    return;
                }
                MonthCommencing = string.Format("{0:dd/MM/yyyy}", dtFrom.Value) + "-" + string.Format("{0:dd/MM/yyyy}", dtTill.Value);
                if (opAll.IsChecked)
                {
                    BookingStatusId = 0;
                }
                if (opCompleted.IsChecked)
                {
                    BookingStatusId = Enums.BOOKINGSTATUS.DISPATCHED.ToInt();
                }
                if (opCancelled.IsChecked)
                {
                    BookingStatusId = Enums.BOOKINGSTATUS.CANCELLED.ToInt();
                }
                using (TaxiDataContext db = new TaxiDataContext())
                {
                    var list = db.stp_OperatorPrivateHireDriverRecord(ddlSubCompany.SelectedValue.ToInt(), dtFrom.Value, dtTill.Value + TimeSpan.Parse("23:59:59"), BookingStatusId, MonthCommencing).ToList();
                    grdLister.DataSource = list;
                }
                grdLister.Columns["Id"].IsVisible = false;

                grdLister.Columns["BookingNo"].IsVisible                 = false;
                grdLister.Columns["DriverId"].IsVisible                  = false;
                grdLister.Columns["MonthCommencing"].HeaderText          = "Month Commencing";
                grdLister.Columns["OperatorLicenceNumber"].HeaderText    = "Operator Licence Number";
                grdLister.Columns["OperatorLicenceNumber"].Width         = 200;
                grdLister.Columns["MonthCommencing"].Width               = 160;
                grdLister.Columns["OperatorName"].HeaderText             = "Operator Name";
                grdLister.Columns["PrivateHireLicenceNumber"].HeaderText = "Private Hire Licence Number";
                grdLister.Columns["FirstName"].HeaderText                = "First Name";
                grdLister.Columns["OperatorName"].Width                  = 170;
                grdLister.Columns["FirstName"].Width = 150;
                grdLister.Columns["PrivateHireLicenceNumber"].Width = 210;
                //grdLister.Columns["Surname"].HeaderText = "First Name";
                grdLister.Columns["Surname"].Width = 120;
                //grdLister.Columns["Total"].Width = 130;
                //grdLister.Columns["DriverNo"].Width = 120;
                //Active
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
        void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (DialogResult.OK == saveFileDialog1.ShowDialog())
                {
                    if (radGridView1 == null)
                    {
                        InitializeExportGrid();
                    }


                    radGridView1.Columns.Clear();
                    radGridView1.Columns.Add(new GridViewTextBoxColumn("MonthCommencing", "MonthCommencing"));
                    radGridView1.Columns.Add(new GridViewTextBoxColumn("OperatorLicenceNumber", "OperatorLicenceNumber"));
                    radGridView1.Columns.Add(new GridViewTextBoxColumn("OperatorName", "OperatorName"));
                    radGridView1.Columns.Add(new GridViewTextBoxColumn("PrivateHireLicenceNumber", "PrivateHireLicenceNumber"));
                    radGridView1.Columns.Add(new GridViewTextBoxColumn("FirstName", "FirstName"));
                    radGridView1.Columns.Add(new GridViewTextBoxColumn("Surname", "Surname"));
                    //
                    string   Message         = string.Empty;
                    DateTime?dtFrom          = dtpFromDate.Value.ToDateorNull();
                    DateTime?dtTill          = dtpToDate.Value.ToDateorNull();
                    int      BookingStatusId = 0;
                    string   MonthCommencing = string.Empty;
                    if (dtFrom.Value == null)
                    {
                        Message = "Required : From Date";
                    }
                    if (dtTill.Value == null)
                    {
                        if (!string.IsNullOrEmpty(Message))
                        {
                            Message = "Required : To Date";
                        }
                        else
                        {
                            Message += Environment.NewLine;// "Required : To Date";
                            Message += "Required : To Date";
                        }
                    }
                    if (!string.IsNullOrEmpty(Message))
                    {
                        ENUtils.ShowMessage(Message);
                        return;
                    }
                    MonthCommencing = string.Format("{0:dd/MM/yyyy}", dtFrom.Value) + "-" + string.Format("{0:dd/MM/yyyy}", dtTill.Value);
                    if (opAll.IsChecked)
                    {
                        BookingStatusId = 0;
                    }
                    if (opCompleted.IsChecked)
                    {
                        BookingStatusId = Enums.BOOKINGSTATUS.DISPATCHED.ToInt();
                    }
                    if (opCancelled.IsChecked)
                    {
                        BookingStatusId = Enums.BOOKINGSTATUS.CANCELLED.ToInt();
                    }
                    //

                    using (TaxiDataContext db = new TaxiDataContext())
                    {
                        var list = db.stp_OperatorPrivateHireDriverRecord(ddlSubCompany.SelectedValue.ToInt(), dtFrom.Value, dtTill.Value + TimeSpan.Parse("23:59:59"), BookingStatusId, MonthCommencing).ToList();  // grdLister.DataSource = list;



                        radGridView1.RowCount = list.Count;
                        for (int i = 0; i < list.Count; i++)
                        {
                            radGridView1.Rows[i].Cells["MonthCommencing"].Value          = list[i].MonthCommencing;
                            radGridView1.Rows[i].Cells["OperatorLicenceNumber"].Value    = list[i].OperatorLicenceNumber;
                            radGridView1.Rows[i].Cells["OperatorName"].Value             = list[i].OperatorName;
                            radGridView1.Rows[i].Cells["PrivateHireLicenceNumber"].Value = list[i].PrivateHireLicenceNumber;
                            radGridView1.Rows[i].Cells["FirstName"].Value = list[i].FirstName;
                            radGridView1.Rows[i].Cells["Surname"].Value   = list[i].Surname;
                        }
                    }

                    ExportToExcelML export = new ExportToExcelML(this.radGridView1);
                    export.ExportVisualSettings = true;
                    export.HiddenColumnOption   = HiddenOption.ExportAsHidden;
                    export.HiddenColumnOption   = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport;
                    export.ExcelCellFormatting += new Telerik.WinControls.UI.Export.ExcelML.ExcelCellFormattingEventHandler(export_ExcelCellFormatting);
                    //

                    //
                    //radGridView1.Columns["PickupDate"].HeaderText = "Pickup Date-Time";

                    //radGridView1.Columns["From"].HeaderText = "Pick-up Address";
                    //radGridView1.Columns["To"].HeaderText = "Drop-off Address";
                    radGridView1.Columns["MonthCommencing"].HeaderText          = "Month Commencing";
                    radGridView1.Columns["OperatorLicenceNumber"].HeaderText    = "Operator Licence Number";
                    radGridView1.Columns["OperatorName"].HeaderText             = "Operator Name";
                    radGridView1.Columns["PrivateHireLicenceNumber"].HeaderText = "Private Hire Licence Number";
                    radGridView1.Columns["FirstName"].HeaderText = "First Name";

                    //CompanyName
                    exporter = new RadGridViewExcelExporter();

                    BackgroundWorker worker = new BackgroundWorker();
                    worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
                    worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted);
                    worker.RunWorkerAsync(saveFileDialog1.FileName);
                    exporter.Progress += new ProgressHandler(exportProgress);

                    this.btnExport.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
        private void LoadOperatorPrivateHireDriverRecord()
        {
            try
            {
                string   Message         = string.Empty;
                DateTime?dtFrom          = dtpFromDate.Value.ToDateorNull();
                DateTime?dtTill          = dtpToDate.Value.ToDateorNull();
                int      BookingStatusId = 0;
                string   MonthCommencing = string.Empty;
                if (dtFrom.Value == null)
                {
                    Message = "Required : From Date";
                }
                if (dtTill.Value == null)
                {
                    if (!string.IsNullOrEmpty(Message))
                    {
                        Message = "Required : To Date";
                    }
                    else
                    {
                        Message += Environment.NewLine;// "Required : To Date";
                        Message += "Required : To Date";
                    }
                }
                if (!string.IsNullOrEmpty(Message))
                {
                    RadMessageBox.Show(Message);
                    return;
                }
                MonthCommencing = string.Format("{0:dd/MM/yyyy}", dtFrom.Value) + "-" + string.Format("{0:dd/MM/yyyy}", dtTill.Value);
                if (rdoAll.IsChecked)
                {
                    BookingStatusId = 0;
                }
                if (rdoCompleted.IsChecked)
                {
                    BookingStatusId = 2;
                }
                if (rdoCanceled.IsChecked)
                {
                    BookingStatusId = 3;
                }
                using (TaxiDataContext db = new TaxiDataContext())
                {
                    var list = db.stp_OperatorPrivateHireDriverRecord(ddlSubCompany.SelectedValue.ToInt(), dtFrom.Value, dtTill.Value + TimeSpan.Parse("23:59:59"), BookingStatusId, MonthCommencing).ToList();
                    grdOperatorPrivateHireDriverRecord.DataSource = list;
                }

                grdOperatorPrivateHireDriverRecord.Columns["Id"].IsVisible        = false;
                grdOperatorPrivateHireDriverRecord.Columns["BookingNo"].IsVisible = false;
                grdOperatorPrivateHireDriverRecord.Columns["DriverId"].IsVisible  = false;

                grdOperatorPrivateHireDriverRecord.Columns["DriverNo"].IsVisible                  = false;
                grdOperatorPrivateHireDriverRecord.Columns["MonthCommencing"].HeaderText          = "Month Commencing";
                grdOperatorPrivateHireDriverRecord.Columns["OperatorLicenceNumber"].HeaderText    = "Operator Licence Number";
                grdOperatorPrivateHireDriverRecord.Columns["OperatorLicenceNumber"].Width         = 160;
                grdOperatorPrivateHireDriverRecord.Columns["MonthCommencing"].Width               = 160;
                grdOperatorPrivateHireDriverRecord.Columns["OperatorName"].HeaderText             = "Operator Name";
                grdOperatorPrivateHireDriverRecord.Columns["PrivateHireLicenceNumber"].HeaderText = "Private Hire Licence Number";
                grdOperatorPrivateHireDriverRecord.Columns["FirstName"].HeaderText                = "First Name";
                grdOperatorPrivateHireDriverRecord.Columns["Surname2"].HeaderText                 = "NI";

                grdOperatorPrivateHireDriverRecord.Columns["OperatorName"].Width             = 170;
                grdOperatorPrivateHireDriverRecord.Columns["FirstName"].Width                = 150;
                grdOperatorPrivateHireDriverRecord.Columns["PrivateHireLicenceNumber"].Width = 180;
                grdOperatorPrivateHireDriverRecord.Columns["Surname"].Width  = 110;
                grdOperatorPrivateHireDriverRecord.Columns["Surname2"].Width = 80;
            }
            catch (Exception ex)
            {
                RadMessageBox.Show(ex.Message);
            }
        }