public void Esport() { Hashtable _HS = (Hashtable)Session["ParametriSelectSchema"]; string VISTA = Convert.ToString(_HS["NomeVista"]); int IdVista = Convert.ToInt32(_HS["IdVista"]); VISTA = " " + VISTA + " "; TheSite.GIC.App_Code.Consultazioni.interogazioni DQ = new TheSite.GIC.App_Code.Consultazioni.interogazioni(); DQ.VISTA = VISTA; DQ.IdVista = IdVista; DataSet Dt = DQ.GetData(IdQ); Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); _dt = Dt.Tables[0].Copy(); if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } }
private void btnEsporta_Click(object sender, System.EventArgs e) { DataSet ds = GetDataBuilding(); Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); _dt = ds.Tables[0].Copy(); if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } }
private void cmdExcel_Click(object sender, System.EventArgs e) { Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); if (TabStrip1.SelectedIndex == 0) { _dt = GetWordExcel(0).Tables[0].Copy(); } if (TabStrip1.SelectedIndex == 1) { _dt = GetWordExcel(Classi.TipoManutenzioneType.ManutenzionesuRichiesta).Tables[0].Copy(); } if (TabStrip1.SelectedIndex == 2) { _dt = GetWordExcel(Classi.TipoManutenzioneType.ManutenzioneProgrammata).Tables[0].Copy(); } if (TabStrip1.SelectedIndex == 3) { _dt = GetWordExcel(Classi.TipoManutenzioneType.ManutenzioneStraordinaria).Tables[0].Copy(); } if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } }
private void BtExport_Click(object sender, System.EventArgs e) { Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); Classi.AnagrafeImpianti.Apparecchiature _Apparecchiature = new TheSite.Classi.AnagrafeImpianti.Apparecchiature(Context.User.Identity.Name); int bl_id = 0; if (RicercaModulo1._txthidbl.Value != "") { bl_id = int.Parse(RicercaModulo1._txthidbl.Value); } DataSet Ds = _Apparecchiature.GetReport(int.Parse(DrTipoRep.SelectedValue), bl_id); _dt = Ds.Tables[0].Copy(); if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } // // // if (_dt.Rows.Count > 65536) // { // String scriptString = "<script language=JavaScript>alert('I record trovati sono in numero maggiore di 65536 e non possono entrare in un solo foglio excel. Impostare filtri più restrittivi');"; // scriptString += "<"; // scriptString += "/"; // scriptString += "script>"; // // if(!this.IsClientScriptBlockRegistered("clientScriptexp")) // this.RegisterStartupScript ("clientScriptexp", scriptString); // } // else // { // // // } }
private void S_Button1_Click(object sender, System.EventArgs e) { //esporta in excel Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); Classi.AnagrafeImpianti.Apparecchiature _Apparecchiature = new TheSite.Classi.AnagrafeImpianti.Apparecchiature(Context.User.Identity.Name); S_Controls.Collections.S_ControlsCollection _SCollection = GetDatiAprrarecchiature(); DataSet Ds = _Apparecchiature.RicercaApparecchiaturaExcel(_SCollection).Copy(); _dt = Ds.Tables[0].Copy(); // if (_dt.Rows.Count > 180000) // { // String scriptString = "<script language=JavaScript>alert('I record trovati sono in numero maggiore di 65536 e non possono entrare in un solo foglio excel. Impostare filtri più restrittivi');"; // scriptString += "<"; // scriptString += "/"; // scriptString += "script>"; // // if(!this.IsClientScriptBlockRegistered("clientScriptexp")) // this.RegisterStartupScript ("clientScriptexp", scriptString); // } // else // { // // // } if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } }
private void S_Button1_Click(object sender, System.EventArgs e) { //esporta in excel Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); Classi.ClassiAnagrafiche.Buildings _Buildings = new Classi.ClassiAnagrafiche.Buildings(); S_Controls.Collections.S_ControlsCollection _SCollection = GetDatistanza(); DataSet Ds = _Buildings.GetDataStanzeExcel(_SCollection).Copy(); _dt = Ds.Tables[0].Copy(); if (_dt.Rows.Count > 65536) { String scriptString = "<script language=JavaScript>alert('I record trovati sono in numero maggiore di 65536 e non possono entrare in un solo foglio excel. Impostare filtri più restrittivi');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } else { if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } } }
private void btnEsportaXsl_Click(object sender, System.EventArgs e) { Classi.ClassiAnagrafiche.PmpFrequenza GetDati = new Classi.ClassiAnagrafiche.PmpFrequenza(); Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); string SSql = string.Empty; switch (Convert.ToInt32(CmbCadenza.SelectedValue)) { case -1: SSql = "PACK_PMPFREQUENZA.SP_GRTPMPFREQ_XLS_SINT"; break; case 0: SSql = "PACK_PMPFREQUENZA.SP_GRTPMPFREQ_XLS_PER"; break; case 1: SSql = "PACK_PMPFREQUENZA.SP_GRTPMPFREQ_XLS_FIS"; break; default: break; } _dt = GetDati.GetDatiXsl(txtsFrequenza.Text, txtsFrequenza_des.Text, SSql); if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } }
private void Ricerca(bool reset) { //esporta in excel Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); Classi.AnagrafeImpianti.Apparecchiature _Apparecchiature = new TheSite.Classi.AnagrafeImpianti.Apparecchiature(Context.User.Identity.Name); S_Controls.Collections.S_ControlsCollection _SCollection = GetDatiAprrarecchiature(); DataSet Ds = _Apparecchiature.RicercaAttPMPExcel(_SCollection).Copy(); _dt = Ds.Tables[0].Copy(); if (_dt.Rows.Count > 300000) { String scriptString = "<script language=JavaScript>alert('I record trovati sono in numero maggiore di 300.000. Impostare filtri più restrittivi');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } else { if (_dt.Rows.Count != 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare per le date scelte');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } } // S_Controls.Collections.S_ControlsCollection CollezioneControlli = new S_Controls.Collections.S_ControlsCollection(); // int mindex=0; // // Data Da // S_Controls.Collections.S_Object s_p_DataDa = new S_Controls.Collections.S_Object(); // s_p_DataDa.ParameterName = "p_DataDa"; // s_p_DataDa.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; // s_p_DataDa.Direction = ParameterDirection.Input; // s_p_DataDa.Index = mindex; // s_p_DataDa.Size= 20; // s_p_DataDa.Value = (CalendarPicker1.Datazione.Text =="")? "":CalendarPicker1.Datazione.Text; // CollezioneControlli.Add(s_p_DataDa); // mindex++; // S_Controls.Collections.S_Object s_p_DataA = new S_Controls.Collections.S_Object(); // s_p_DataA.ParameterName = "p_DataA"; // s_p_DataA.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; // s_p_DataA.Direction = ParameterDirection.Input; // s_p_DataA.Index = mindex; // s_p_DataA.Size= 20; // s_p_DataA.Value = (CalendarPicker2.Datazione.Text =="")? "":CalendarPicker2.Datazione.Text; // CollezioneControlli.Add(s_p_DataA); // mindex++; // // Servizio // S_Controls.Collections.S_Object s_P_servizio = new S_Object(); // s_P_servizio.ParameterName = "P_servizio"; // s_P_servizio.DbType = CustomDBType.Integer; // s_P_servizio.Direction = ParameterDirection.Input; // s_P_servizio.Index = mindex; // s_P_servizio.Value=(cmbsServizio.SelectedValue=="0")?0:int.Parse(cmbsServizio.SelectedValue); // CollezioneControlli.Add(s_P_servizio); // mindex++; // Bl codice dell'edificio // S_Controls.Collections.S_Object s_P_bl_id = new S_Object(); // s_P_bl_id.ParameterName = "P_bl_id"; // s_P_bl_id.DbType = CustomDBType.VarChar; // s_P_bl_id.Direction = ParameterDirection.Input; // s_P_bl_id.Index =mindex; // s_P_bl_id.Size=50; // s_P_bl_id.Value=RicercaModulo1.TxtCodice.Text; // CollezioneControlli.Add(s_P_bl_id); // mindex++; // // Bl Descrizione dell'edificio // S_Controls.Collections.S_Object s_P_campus = new S_Object(); // s_P_campus.ParameterName = "P_campus"; // s_P_campus.DbType = CustomDBType.VarChar; // s_P_campus.Direction = ParameterDirection.Input; // s_P_campus.Index = mindex; // s_P_campus.Size=50; // s_P_campus.Value=RicercaModulo1.Campus; // CollezioneControlli.Add(s_P_campus); // mindex++; // // Standard delle apparecchiature // S_Controls.Collections.S_Object s_P_standard = new S_Object(); // s_P_standard.ParameterName = "P_standard"; // s_P_standard.DbType = CustomDBType.Integer; // s_P_standard.Direction = ParameterDirection.Input; // s_P_standard.Index = mindex++; // s_P_standard.Value=(cmbsStdApparecchiature.SelectedValue=="")?0:int.Parse(cmbsStdApparecchiature.SelectedValue); // CollezioneControlli.Add(s_P_standard); // mindex++; // // // Apparecchiature // S_Controls.Collections.S_Object s_P_apparecchiatura = new S_Object(); // s_P_apparecchiatura.ParameterName = "P_apparecchiatura"; // s_P_apparecchiatura.DbType = CustomDBType.VarChar; // s_P_apparecchiatura.Direction = ParameterDirection.Input; // s_P_apparecchiatura.Size = 50; // s_P_apparecchiatura.Index =mindex++; // s_P_apparecchiatura.Value=CodiceApparecchiature1.CodiceApparecchiatura; // CollezioneControlli.Add(s_P_apparecchiatura); // mindex++; // S_Controls.Collections.S_Object s_CurrentUser = new S_Object(); // s_CurrentUser.ParameterName = "p_CurrentUser"; // s_CurrentUser.DbType = CustomDBType.VarChar; // s_CurrentUser.Direction = ParameterDirection.Input; // s_CurrentUser.Index = mindex++; // s_CurrentUser.Value = System.Web.HttpContext.Current.User.Identity.Name; // CollezioneControlli.Add(s_CurrentUser); // // pageindex // mindex++; // TheSite.Classi.ManProgrammata.SfogliaRdlOdl _SfogliaRdlOdl=new TheSite.Classi.ManProgrammata.SfogliaRdlOdl(Context.User.Identity.Name); // DataSet _Ds= _SfogliaRdlOdl.GetData(CollezioneControlli); // // // if (reset==true) // { // CollezioneControlli.RemoveAt(CollezioneControlli.Count -1); // CollezioneControlli.RemoveAt(CollezioneControlli.Count -1); // CollezioneControlli.RemoveAt(CollezioneControlli.Count -1); // int _totalRecords = _SfogliaRdlOdl.GetDataCount(CollezioneControlli); // // } }
private void BindingEdifici1(string BlId, bool reset) { if (BlId != "") { BlId = "'" + BlId.Replace(",", "','") + "'"; } sql_where = ""; sql_select += " select BL.BL_ID || ' - ' || BL.ADDRESS1 as EDIFICIO, "; sql_select += " PIANI.DESCRIZIONE as PIANO, "; sql_select += " t.RM_ID || '-' || t.DESCRIZIONE as STANZA, "; sql_select += " RM_CAT.CODICE_CATEGORIA || '-' || RM_CAT.DESCRIZIONE as CATEGORIA, "; sql_select += " RM_DEST_USO.DESCRIZIONE as DESTINAZIONE, "; sql_select += " t.AREA as area_mq, round(t.cost,1) as h_m, round(t.AREA*t.cost,2) as volume_mc "; sql_select += " FROM BL, RM t, PIANI, RM_DEST_USO , RM_CAT "; sql_select += " where t.id_bl=bl.id and t.id_piani=piani.id and t.Id_Rm_Cat = RM_CAT.ID_RM_CAT"; sql_select += " and t.id_rm_dest_uso = RM_DEST_USO.ID_RM_DEST_USO"; if (BlId != "") { sql_where += " and UPPER(BL.BL_ID) in (" + BlId.ToUpper() + ") "; } if (cmbsPiano.SelectedValue != String.Empty) { sql_where += " and t.ID_PIANI =" + cmbsPiano.SelectedValue.ToString(); } if (UserStanze1.DescStanza.ToString() != "") { sql_where += " and UPPER(t.RM_ID ||'-'|| t.DESCRIZIONE) like '%" + UserStanze1.DescStanza.ToUpper() + "%'"; } if (cmbsCategoria.SelectedValue != String.Empty) { sql_where += " and RM_CAT.ID_RM_CAT=" + cmbsCategoria.SelectedValue.ToString(); } if (s_txtDestinazione.Text != String.Empty) { sql_where += " and UPPER(RM_DEST_USO.DESCRIZIONE) like '%" + s_txtDestinazione.Text.ToUpper() + "%'"; } if (cmbsConfronto.SelectedValue != String.Empty & s_txtMq.Text != String.Empty) { sql_where += " and t.AREA " + cmbsConfronto.SelectedValue + " " + s_txtMq.Text.Replace(",", "."); } if (sql_where != "") { sql = sql_select + sql_where; } else { sql = sql_select; } ///select finale da passare alla store procedure // if (sql_select!="") // sql_select += ", "; // sql="SELECT " + sql_select + " RM.AREA as area_mq, round(rm.cost,1) as h_m, round(RM.AREA*cost,2) as volume_mc FROM BL JOIN FL ON (FL.Id_Bl = BL.Id) " + // "JOIN RM USING (id_piani, id_bl) JOIN PIANI ON (id_piani = PIANI.id) " + // "left JOIN RM_DEST_USO ON (RM.ID_RM_DEST_USO = RM_DEST_USO.ID_RM_DEST_USO) " + // " left JOIN RM_CAT ON (RM.ID_RM_CAT = RM_CAT.ID_RM_CAT) " + sql_where ; // // sql=sql_select + " "+ // + // + // // sql_where ; // ///Istanzio un nuovo oggetto Collection per aggiungere i parametri S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); // ///creo i parametri ///edifici S_Controls.Collections.S_Object s_sql = new S_Controls.Collections.S_Object(); s_sql.ParameterName = "p_sql"; s_sql.DbType = CustomDBType.VarChar; s_sql.Direction = ParameterDirection.Input; s_sql.Size = 4000; s_sql.Index = 0; s_sql.Value = sql; _SCollection.Add(s_sql); Classi.AnagrafeImpianti.ServiziEdifici _ServiziEdifici = new Classi.AnagrafeImpianti.ServiziEdifici(Context.User.Identity.Name); DataSet Ds = _ServiziEdifici.GetRicercaExcel(_SCollection); Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); _dt = Ds.Tables[0].Copy(); _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); }
private void BindingEdifici_(string BlId, bool reset) { if (BlId != "") { BlId = "'" + BlId.Replace(",", "','") + "'"; } // da qui if (chkEdificio.Checked == true) { sql_select += " BL.BL_ID || ' - ' || BL.ADDRESS1 as EDIFICIO"; sql_group += " BL.BL_ID || ' - ' || BL.ADDRESS1"; } if (chkPiano.Checked == true) { if (sql_select != "") { sql_select += ","; } if (sql_group != "") { sql_group += ","; } sql_select += " PIANI.DESCRIZIONE as PIANO "; sql_group += " PIANI.DESCRIZIONE "; } if (chkStanze.Checked == true) { if (sql_select != "") { sql_select += ","; } if (sql_group != "") { sql_group += ","; } sql_select += "RM.RM_ID || '-' || RM.DESCRIZIONE as STANZA "; sql_group += " RM.RM_ID,RM.DESCRIZIONE "; } if (chkCategoria.Checked == true) { if (sql_select != "") { sql_select += ","; } if (sql_group != "") { sql_group += ","; } sql_select += "RM_CAT.CODICE_CATEGORIA || '-' || RM_CAT.DESCRIZIONE as CATEGORIA "; sql_group += " RM_CAT.CODICE_CATEGORIA, RM_CAT.DESCRIZIONE "; } if (chkDestinazione.Checked == true) { if (sql_select != "") { sql_select += ","; } if (sql_group != "") { sql_group += ","; } sql_select += " RM_DEST_USO.DESCRIZIONE as DESTINAZIONE "; sql_group += " RM_DEST_USO.DESCRIZIONE "; } // if (chkReparto.Checked == true) // { // if (sql_select!="") // sql_select += ","; // if (sql_group!="") // sql_group += ","; // // sql_select += " RM_REPARTO.DESCRIZIONE as REPARTO "; // sql_group += " RM_REPARTO.DESCRIZIONE "; // } // a qui if (BlId != "") { if (sql_where != "") { sql_where += " AND"; } sql_where += " UPPER(BL.BL_ID) in (" + BlId.ToUpper() + ") "; } if (cmbsPiano.SelectedValue != String.Empty) { if (sql_where != "") { sql_where += " AND"; } sql_where += " ID_PIANI =" + cmbsPiano.SelectedValue.ToString(); } if (UserStanze1.DescStanza.ToString() != "") { if (sql_where != "") { sql_where += " AND"; } sql_where += " UPPER(RM.RM_ID ||'-'|| RM.DESCRIZIONE) like '%" + UserStanze1.DescStanza.ToUpper() + "%'"; } if (cmbsCategoria.SelectedValue != String.Empty) { if (sql_where != "") { sql_where += " AND"; } sql_where += " RM_CAT.ID_RM_CAT=" + cmbsCategoria.SelectedValue.ToString(); } // if (s_txtReparto.Text != String.Empty) // { // if (sql_where != "") // sql_where += " AND"; // sql_where += " UPPER(RM_REPARTO.DESCRIZIONE) like '%" + s_txtReparto.Text.ToUpper() + "%'" ; // } // if (s_txtDestinazione.Text != String.Empty) { if (sql_where != "") { sql_where += " AND"; } sql_where += " UPPER(RM_DEST_USO.DESCRIZIONE) like '%" + s_txtDestinazione.Text.ToUpper() + "%'"; } if (s_txtDestinazione.Text != String.Empty || chkDestinazione.Checked == true) { sql_from += " ,RM_DEST_USO "; sql_where += " and rm.id_rm_dest_uso=RM_DEST_USO.ID_RM_DEST_USO "; } if (BlId != "" || chkEdificio.Checked == true) { sql_from += " ,bl"; sql_where += "and bl.id=rm.id_bl "; } if (cmbsPiano.SelectedValue != String.Empty || chkPiano.Checked == true) { sql_from += " ,piani "; sql_where += " and rm.id_piani=PIANI.id "; } if (cmbsCategoria.SelectedValue != String.Empty || chkCategoria.Checked == true) { sql_from += " ,RM_CAT "; sql_where += " and RM.ID_RM_CAT = RM_CAT.ID_RM_CAT "; } if (cmbsConfronto.SelectedValue != String.Empty & s_txtMq.Text != String.Empty) { if (sql_where != "") { sql_where += " AND"; } sql_where += " RM.AREA " + cmbsConfronto.SelectedValue + " " + s_txtMq.Text.Replace(",", "."); } if (sql_where != "") { sql_where = " WHERE " + sql_where; } ///select finale da passare alla store procedure if (sql_select != "") { sql_select += ", "; } sql = "SELECT " + sql_select + " SUM(RM.AREA) as VALORE_INT, sum(round(RM.AREA*cost,2)) as VALORE_mc from rm "; sql += sql_from + sql_where; // FROM BL JOIN FL ON (FL.Id_Bl = BL.Id) " + // "JOIN RM USING (id_piani, id_bl) JOIN PIANI ON (id_piani = PIANI.id) " + // //"left JOIN RM_REPARTO ON (RM.ID_RM_REPARTO = RM_REPARTO.ID_RM_REPARTO) " + // "left JOIN RM_DEST_USO ON (RM.ID_RM_DEST_USO = RM_DEST_USO.ID_RM_DEST_USO) " + // " left JOIN RM_CAT ON (RM.ID_RM_CAT = RM_CAT.ID_RM_CAT) " + sql_where ; if (sql_group != "") { sql += " GROUP BY " + sql_group; } sqlCount = "SELECT count(distinct RM.RM_ID) from rm "; // JOIN FL ON (FL.Id_Bl = BL.Id) " + //"JOIN RM USING (id_piani, id_bl) JOIN PIANI ON (id_piani = PIANI.id) " + //"left JOIN RM_REPARTO ON (RM.ID_RM_REPARTO = RM_REPARTO.ID_RM_REPARTO) " + //"left JOIN RM_DEST_USO ON (RM.ID_RM_DEST_USO = RM_DEST_USO.ID_RM_DEST_USO) " + //" left JOIN RM_CAT ON (RM.ID_RM_CAT = RM_CAT.ID_RM_CAT) " + sql_where ; sqlCount += sql_from + sql_where; // ///Istanzio un nuovo oggetto Collection per aggiungere i parametri S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); // ///creo i parametri ///edifici sql = sql.Replace("WHERE and", "where "); sql = sql.Replace("WHERE and", "where "); //WHERE and S_Controls.Collections.S_Object s_sql = new S_Controls.Collections.S_Object(); s_sql.ParameterName = "p_sql"; s_sql.DbType = CustomDBType.VarChar; s_sql.Direction = ParameterDirection.Input; s_sql.Size = 4000; s_sql.Index = 0; s_sql.Value = sql.Replace("WHERE and", "where "); _SCollection.Add(s_sql); // nuovi parametri paginazione Classi.AnagrafeImpianti.ServiziEdifici _ServiziEdifici = new Classi.AnagrafeImpianti.ServiziEdifici(Context.User.Identity.Name); DataSet Ds = _ServiziEdifici.GetRicercaExcel(_SCollection); Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); _dt = Ds.Tables[0].Copy(); _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); }
private void Download(int TipoFile) { string filename = ""; int Mese; int Anno; string ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"]; string FileMaster = Server.MapPath("../MasterExcel"); string Out = Server.MapPath("../Doc_DB/TempFile"); if (TipoFile == 1) { Mese = int.Parse(drMese1.SelectedValue); Anno = int.Parse(drAnno1.SelectedValue); FileMaster += @"\MTempiIntervento.xls"; TimeRequest t = new TimeRequest(Mese, Anno, ConnectionString, FileMaster, Out); filename = t.CreateFile(); } if (TipoFile == 2) { Mese = int.Parse(drMese2.SelectedValue); Anno = int.Parse(drAnno2.SelectedValue); FileMaster += @"\MTempiPorteREI.xls"; TempiPorteREI t = new TempiPorteREI(Mese, Anno, ConnectionString, FileMaster, Out); filename = t.CreateFile(); } if (TipoFile == 3) { Mese = int.Parse(drMese3.SelectedValue); Anno = int.Parse(drAnno3.SelectedValue); FileMaster += @"\Requirements.xls"; PMProgrammata t = new PMProgrammata(Mese, Anno, ConnectionString, FileMaster, Out); filename = t.CreateFile(); } if (TipoFile == 4) { Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); DataTable _dt = new DataTable(); string Procedura = ""; if (DrProcedura.SelectedValue == "1") { Procedura = "PACK_VerificaSLA.SP_RDL"; } if (DrProcedura.SelectedValue == "2") { Procedura = "PACK_VerificaSLA.SP_RDL_DATA_BL"; } if (DrProcedura.SelectedValue == "3") { Procedura = "PACK_VerificaSLA.SP_RDL_CON_INVIO"; } if (DrProcedura.SelectedValue == "4") { Procedura = "PACK_VerificaSLA.SP_RDL_CON_INVIO_DATA_BL"; } _dt = GetDati(int.Parse(DrProcedura.SelectedValue), Procedura); if (_dt.Rows.Count > 0) { _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { return; } } Response.Clear(); Response.ContentType = "application/xls"; Response.AddHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filename)); Response.WriteFile(filename); Response.End(); }
private void S_BUTTON1_Click(object sender, System.EventArgs e) { //Ricerca(); ///Istanzio un nuovo oggetto Collection per aggiungere i parametri S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); //Id_WR S_Controls.Collections.S_Object s_p_wrid = new S_Controls.Collections.S_Object(); s_p_wrid.ParameterName = "p_wrid"; s_p_wrid.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_p_wrid.Direction = ParameterDirection.Input; s_p_wrid.Size = 50; s_p_wrid.Index = _SCollection.Count; s_p_wrid.Value = (txtRdl.Text == string.Empty)? 0:Int32.Parse(txtRdl.Text); _SCollection.Add(s_p_wrid); //id_materiale S_Controls.Collections.S_Object s_p_id_materiale = new S_Controls.Collections.S_Object(); s_p_id_materiale.ParameterName = "p_id_materiale"; s_p_id_materiale.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_p_id_materiale.Direction = ParameterDirection.Input; s_p_id_materiale.Size = 50; s_p_id_materiale.Index = _SCollection.Count; s_p_id_materiale.Value = Convert.ToInt32(cmbsMateriale.SelectedValue.ToString().Split(';')[0]); _SCollection.Add(s_p_id_materiale); //data aggiornamento Dal S_Controls.Collections.S_Object s_p_dataaggiornamentoDal = new S_Controls.Collections.S_Object(); s_p_dataaggiornamentoDal.ParameterName = "p_dataaggiornamentoDal"; s_p_dataaggiornamentoDal.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_p_dataaggiornamentoDal.Direction = ParameterDirection.Input; s_p_dataaggiornamentoDal.Size = 50; s_p_dataaggiornamentoDal.Index = _SCollection.Count; s_p_dataaggiornamentoDal.Value = CalendarPicker1.Datazione.Text; _SCollection.Add(s_p_dataaggiornamentoDal); //data aggiornamento Al S_Controls.Collections.S_Object s_p_dataaggiornamentoAl = new S_Controls.Collections.S_Object(); s_p_dataaggiornamentoAl.ParameterName = "p_dataaggiornamentoAl"; s_p_dataaggiornamentoAl.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_p_dataaggiornamentoAl.Direction = ParameterDirection.Input; s_p_dataaggiornamentoAl.Size = 50; s_p_dataaggiornamentoAl.Index = _SCollection.Count; s_p_dataaggiornamentoAl.Value = CalendarPicker2.Datazione.Text; _SCollection.Add(s_p_dataaggiornamentoAl); //Id stato S_Controls.Collections.S_Object s_p_stato = new S_Controls.Collections.S_Object(); s_p_stato.ParameterName = "p_stato"; s_p_stato.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_p_stato.Direction = ParameterDirection.Input; s_p_stato.Size = 50; s_p_stato.Index = _SCollection.Count; s_p_stato.Value = Convert.ToInt32(cmbsStato.SelectedValue); _SCollection.Add(s_p_stato); TheSite.Classi.ManCorrettiva.AnalisiCostiMateriali _Materiali = new TheSite.Classi.ManCorrettiva.AnalisiCostiMateriali(); ///Eseguo il Binding sulla Griglia. DataSet Ds = _Materiali.GetData1(_SCollection); DataTable _dt = Ds.Tables[0]; if (_dt.Rows.Count != 0) { Csy.WebControls.Export _objExport = new Csy.WebControls.Export(); _objExport.ExportDetails(_dt, Csy.WebControls.Export.ExportFormat.Excel, "exp.xls"); } else { String scriptString = "<script language=JavaScript>alert('Nessun elemento da esportare');"; scriptString += "<"; scriptString += "/"; scriptString += "script>"; if (!this.IsClientScriptBlockRegistered("clientScriptexp")) { this.RegisterStartupScript("clientScriptexp", scriptString); } } }