protected void Page_Load(object sender, EventArgs e) { DataSet ds1 = DataMapping.ExecSql("SELECT count(*) as nb from ais_members where cric in (select cric from ais_clubs where type_club = 'rotary')"); LBL_Nombre_Rotariens.Text = "" + ds1.Tables[0].Rows[0][0]; ds1 = DataMapping.ExecSql("SELECT count(*) as nb from ais_members where cric in (select cric from ais_clubs where type_club = 'rotaract')"); LBL_Nombre_Rotaractiens.Text = "" + ds1.Tables[0].Rows[0][0]; }
/// <summary> /// Exporte les inscrits vers un fichier Excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Exporter_Inscrits_Click(object sender, EventArgs e) { DataSet ds = DataMapping.ExecSql("SELECT C.club as 'Nom club',D.wording as 'Nom participant',C.dt as 'Inscrit le',C.[rule] as 'Payé' FROM [ais_orders_details] D,[ais_orders] C where D.id_order = C.id and C.id_payment='" + HF_id.Value + "' order by C.club,D.wording"); List <DataTable> liste = new List <DataTable>(); liste.Add(ds.Tables[0]); Media media = DataMapping.ExportDataTablesToXLS(liste, "List des inscrits au " + DateTime.Now.ToShortDateString().Replace("/", "-") + ".xls", Aspose.Cells.SaveFormat.Excel97To2003); string guid = Guid.NewGuid().ToString(); Session[guid] = media; Response.Redirect(Const.MEDIA_DOWNLOAD_URL + "?id=" + guid); }
/// <summary> /// Exporte les transactions vers un fichier Excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Exporter_Transactions_CB_Click(object sender, EventArgs e) { DataSet ds = DataMapping.ExecSql("SELECT [dt],[data] FROM [ais_mercanet_resp]"); List <DataTable> liste = new List <DataTable>(); liste.Add(ds.Tables[0]); Media media = DataMapping.ExportDataTablesToXLS(liste, "List des transactions au " + DateTime.Now.ToShortDateString().Replace("/", "-") + ".xls", Aspose.Cells.SaveFormat.Excel97To2003); string guid = Guid.NewGuid().ToString(); Session[guid] = media; Response.Redirect(Const.MEDIA_DOWNLOAD_URL + "?id=" + guid); }
/// <summary> /// Exporte les commandes vers un fichier excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Export_Orders_Click(object sender, EventArgs e) { DataSet ds = DataMapping.ExecSql("SELECT club,amount,[rule],info_rule,type_rule,par_rule,dt_rule,dt,transaction_id FROM [ais_orders] where id_payment='" + HF_id.Value + "' order by club"); List <DataTable> liste = new List <DataTable>(); liste.Add(ds.Tables[0]); Media media = DataMapping.ExportDataTablesToXLS(liste, "List des commandes au " + DateTime.Now.ToShortDateString().Replace("/", "-") + ".xls", Aspose.Cells.SaveFormat.Excel97To2003); string guid = Guid.NewGuid().ToString(); Session[guid] = media; Response.Redirect(Const.MEDIA_DOWNLOAD_URL + "?id=" + guid); }
/// <summary> /// Permet d'exporter le GridView en CSV /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Export_CSV_Click(object sender, EventArgs e) { List <DataTable> liste = new List <DataTable>(); DataSet ds = DataMapping.ExecSql("SELECT nim as NIM, section as Section, surname as Nom, name as Prenom, job as Poste, cric as Cric, club as 'Nom du club', [description] as 'Description' FROM " + Const.TABLE_PREFIX + "drya WHERE rotary_year = '" + rbl_rotaryYear.SelectedValue + "' order by section, rank"); liste.Add(ds.Tables[0]); Media media = DataMapping.ExportDataTablesToXLS(liste, "Organigramme District " + rbl_rotaryYear.SelectedValue + "-" + (1 + int.Parse(rbl_rotaryYear.SelectedValue)) + ".csv", Aspose.Cells.SaveFormat.CSV); List <DataTable> liste2 = new List <DataTable>(); DataSet dsCom = DataMapping.ExecSql("SELECT name as 'Nom de la commission', memberName as Membre, job as 'Poste' FROM " + Const.TABLE_PREFIX + "commission where rotary_year ='" + rbl_rotaryYear.SelectedValue + "' order by name"); dsCom.Tables[0].TableName = "Commissions"; liste2.Add(dsCom.Tables[0]); Media media2 = DataMapping.ExportDataTablesToXLS(liste2, "Commission " + rbl_rotaryYear.SelectedValue + "-" + (1 + int.Parse(rbl_rotaryYear.SelectedValue)) + ".csv", Aspose.Cells.SaveFormat.CSV); Media media3 = new Media(); media3.content_size = media.content_size + media2.content_size; media3.content = new byte[media3.content_size]; for (int i = 0; i < media3.content_size; i++) { if (i < media.content_size) { media3.content[i] = media.content[i]; } else { media3.content[i] = media2.content[i - media.content_size]; } } media3.dt = media.dt; media3.name = media.name; string guid = Guid.NewGuid().ToString(); Session[guid] = media3; Response.Redirect(Const.MEDIA_DOWNLOAD_URL + "?id=" + guid); }
/// <summary> /// Permet d'exporter le GridView en fichier Excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Export_XLS_Click(object sender, EventArgs e) { List <DataTable> liste = new List <DataTable>(); foreach (ListItem laSection in ddl_section.Items) { DataSet ds_ = DataMapping.ExecSql("SELECT nim as NIM, surname as Nom, name as Prénom, job as Poste, cric as Cric, club as 'Nom du club', [description] as 'Description' FROM " + Const.TABLE_PREFIX + "drya WHERE rotary_year = '" + rbl_rotaryYear.SelectedValue + "' AND section = '" + laSection.Value + "' order by rank"); ds_.Tables[0].TableName = laSection.Text; liste.Add(ds_.Tables[0]); } DataSet ds = DataMapping.ExecSql("SELECT name as 'Nom de la commission', memberName as Membre, job as 'Poste' FROM " + Const.TABLE_PREFIX + "commission where rotary_year ='" + rbl_rotaryYear.SelectedValue + "' order by name"); ds.Tables[0].TableName = "Commissions"; liste.Add(ds.Tables[0]); Media media = DataMapping.ExportDataTablesToXLS(liste, "Organigramme District " + rbl_rotaryYear.SelectedValue + "-" + (1 + int.Parse(rbl_rotaryYear.SelectedValue)) + ".xls", Aspose.Cells.SaveFormat.Excel97To2003); string guid = Guid.NewGuid().ToString(); Session[guid] = media; Response.Redirect(Const.MEDIA_DOWNLOAD_URL + "?id=" + guid); }