Example #1
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        DataTable dtSource = this.vsDataSource;

        DataTable dt = new DataTable();

        dt.Columns.Add("UyeID");
        dt.Columns.Add("Servis");
        dt.Columns.Add("BasvuruTarihi");
        dt.Columns.Add("Adi");
        dt.Columns.Add("Soyadi");
        dt.Columns.Add("FacebookKullanicisi");
        dt.Columns.Add("Cinsiyet");
        dt.Columns.Add("Email");
        dt.Columns.Add("Gsm");
        dt.Columns.Add("Sehir");
        dt.Columns.Add("EgitimDurumu");
        dt.Columns.Add("MezuniyetDurumu");
        dt.Columns.Add("Universite");
        dt.Columns.Add("EkKriter1");
        dt.Columns.Add("EkKriter2");
        dt.Columns.Add("EkKriter3");
        dt.Columns.Add("EkKriter4");
        dt.Columns.Add("EkKriter5");
        dt.Columns.Add("EkKriter6");

        DataRow dr;

        for (int i = 0; i < dtSource.Rows.Count; i++)
        {
            dr                        = dt.NewRow();
            dr["UyeID"]               = dtSource.Rows[i]["UserID"].ToString();
            dr["Servis"]              = (dtSource.Rows[i]["HasService"] == DBNull.Value) ? "" : (Convert.ToBoolean(dtSource.Rows[i]["HasService"]) ? "Var" : "Yok");
            dr["BasvuruTarihi"]       = dtSource.Rows[i]["JoinDate"].ToString();
            dr["Adi"]                 = dtSource.Rows[i]["FirstName"].ToString();
            dr["Soyadi"]              = dtSource.Rows[i]["Surname"].ToString();
            dr["FacebookKullanicisi"] = (dtSource.Rows[i]["IsFacebookUser"] == DBNull.Value) ? "" : (Convert.ToBoolean(dtSource.Rows[i]["IsFacebookUser"]) ? "Evet" : "Hayır");
            dr["Cinsiyet"]            = (dtSource.Rows[i]["IsFemale"] == DBNull.Value) ? "" : (Convert.ToBoolean(dtSource.Rows[i]["IsFemale"]) ? "Bayan" : "Bay");
            dr["Email"]               = dtSource.Rows[i]["Email"].ToString();
            dr["Gsm"]                 = dtSource.Rows[i]["Gsm"].ToString();
            dr["Sehir"]               = dtSource.Rows[i]["LocationName"].ToString();
            dr["EgitimDurumu"]        = dtSource.Rows[i]["EducationLevel"].ToString();
            dr["MezuniyetDurumu"]     = dtSource.Rows[i]["EducationStatus"].ToString();
            dr["Universite"]          = dtSource.Rows[i]["UniversityName"].ToString();
            dr["EkKriter1"]           = dtSource.Rows[i]["Label1"].ToString() + " <b>" + dtSource.Rows[i]["Value1"].ToString() + "</b> ";
            dr["EkKriter2"]           = dtSource.Rows[i]["Label2"].ToString() + " <b>" + dtSource.Rows[i]["Value2"].ToString() + "</b> ";
            dr["EkKriter3"]           = dtSource.Rows[i]["Label3"].ToString() + " <b>" + dtSource.Rows[i]["Value3"].ToString() + "</b> ";
            dr["EkKriter4"]           = dtSource.Rows[i]["Label4"].ToString() + " <b>" + dtSource.Rows[i]["Value4"].ToString() + "</b> ";
            dr["EkKriter5"]           = dtSource.Rows[i]["Label5"].ToString() + " <b>" + dtSource.Rows[i]["Value5"].ToString() + "</b> ";
            dr["EkKriter6"]           = dtSource.Rows[i]["Label6"].ToString() + " <b>" + dtSource.Rows[i]["Value6"].ToString() + "</b> ";
            dt.Rows.Add(dr);
        }

        LIB.ExportFile Export = new LIB.ExportFile();
        Export.Export(LIB.ExportFile.ExportTypes.Excel, "EtkinligeKatilanlar", dt);
    }
 protected void btnExport_Click(object sender, EventArgs e)
 {
     LIB.ExportFile Export = new LIB.ExportFile();
     Export.Export(LIB.ExportFile.ExportTypes.Excel, "Uyeler", this.vsDataSource);
 }