Ejemplo n.º 1
0
        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.RicercaAttPMPExcel(_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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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);
            //
            //			}
        }