Exemple #1
0
    /// <summary>
    /// Return DataSet for a given Input
    /// </summary>
    /// <returns></returns>
    private DataSet BindSearchCustomer()
    {
        // Create Instance for Customer HElper class
        CustomerHelper HelperAccess = new CustomerHelper();
        DataSet Dataset = HelperAccess.SearchCustomer(txtFName.Text.Trim(), txtLName.Text.Trim(), txtComapnyNM.Text.Trim(), txtLoginName.Text.Trim(), txtExternalaccountno.Text.Trim(), txtContactID.Text.Trim(), txtStartDate.Text.Trim(), txtEndDate.Text.Trim(), txtPhoneNumber.Text.Trim(), txtEmailID.Text.Trim(), lstProfile.SelectedValue, lstReferralStatus.SelectedValue);

        Session["ContactList"] = Dataset;

        //Return DataSet
        return Dataset;
    }
Exemple #2
0
    protected void download_Click(object sender, EventArgs e)
    {
        DataDownloadAdmin _DataDownloadAdmin = new DataDownloadAdmin();
        CustomerHelper HelperAccess = new CustomerHelper();
        DataSet _dataset = new DataSet();

        //Check for Search enabled
        if(CheckSearch)
        {
            if(Session["ContactList"]!=null)
                _dataset = Session["ContactList"] as DataSet;
        }
        else
        {
            _dataset = HelperAccess.SearchCustomer(String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, "0",String.Empty);
        }

        string StrData = _DataDownloadAdmin.Export(_dataset, true);

        byte[] data = ASCIIEncoding.ASCII.GetBytes(StrData);

        //Release Resources
        _dataset.Dispose();

        Response.Clear();

        // Set as Excel as the primary format
        Response.AddHeader("Content-Type", "application/Excel");

        Response.AddHeader("Content-Disposition", "attachment;filename=Customer.csv");
        Response.ContentType = "application/vnd.xls";

        Response.BinaryWrite(data);

        Response.End();
    }