//Leggiddl("select struttura, tipo_ente_ek order by struttura", ddlEnte, true); // devo leggere la tabella Proposta public void Leggiddl(string select, DropDownList ddl, bool vuota) // devo leggere la tabella Proposta { string msg = ""; SQLClass.openaSQLConn(out msg); if (msg.Length >= 1) { tStato.Text = "ATTENZIONE: si è verificato un\'errore: " + msg + ". Contattare l'assistenza al numero " + (string)Session["assistenza"]; SQLClass.closeaSQLConn(out msg); } else { msg = ""; //tbl.Clear(); tbl = SQLClass.getfromDSet(select, "tb", out msg); SQLClass.closeaSQLConn(out msg); if (msg.Length >= 1) { tStato.Text = "ATTENZIONE: si è verificato un\'errore: " + msg + ". Contattare l'assistenza al numero " + (string)Session["assistenza"]; } else { if (tbl.Rows.Count > 0) { ddl.Items.Clear(); string s = ""; for (int i = 0; i < tbl.Rows.Count; i++) { s = tbl.Rows[i][0] == DBNull.Value ? "" : tbl.Rows[i][0].ToString(); //ss = tbl.Rows[i][1] == DBNull.Value ? "" : tbl.Rows[i][1].ToString(); //ddl.Items.Insert(i, new ListItem(s, ss)); ddl.Items.Insert(i, s); } if (vuota) { ddl.Items.Insert(0, ""); } } else { tStato.Text = "ATTENZIONE: si è verificato un\'errore: non ci sono occorrenze nella tabella " + select.Substring(select.IndexOf("FROM ") + 4, 10).ToUpper() + ". Contattare l'assistenza al numero " + (string)Session["assistenza"]; } } } }
protected void Page_Load(object sender, EventArgs e) { lAsterisconn.Text = ""; lAsteriscopwd.Text = ""; string msg = ""; SQLClass.openaSQLConn(out msg); tbl = SQLClass.getfromDSet("select * from manutenzione where attivo='1' and pagina='logoff'", "manutenzione", out msg); if (tbl.Rows.Count > 0 && test != "TEST") { Stato(tbl.Rows[0]["Descrizione"].ToString(), Color.Red); nikname.Enabled = false; password.Enabled = false; cbpwddimenticata.Enabled = false; cbRegistrati.Enabled = false; cbAccedi.Enabled = false; SQLClass.closeaSQLConn(out msg); return; } cbAccedi.Focus(); }
protected void initChartCollection() { DateTime dada = DateTime.Now, ada = DateTime.Now; switch (rblist.SelectedValue) { case "Oggi": dada = DateTime.Now; ada = DateTime.Now; titolo = "Accessi di oggi"; break; case "Ultima settimana": ada = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek - 1 + 1)); dada = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek - 1 + 7)); titolo = "Accessi ultima settimana"; break; case "Ultimo mese": ada = DateTime.Now; dada = DateTime.Now.AddDays(-(DateTime.Now.Day - 1)); titolo = "Accessi ultimo mese"; break; case "Da inizio anno": ada = DateTime.Now; dada = DateTime.Now.AddDays(-(DateTime.Now.DayOfYear - 1)); titolo = "Accessi da inizio anno"; break; case "Anno precedente": ada = new DateTime(DateTime.Now.Year - 1, 12, 31); dada = new DateTime(DateTime.Now.Year - 1, 1, 1); titolo = "Accessi anno precedente"; break; } //string dadata = "", adata = ""; tStato.Text = ""; //dadata = (da == null || da.ToShortDateString() == "1900-01-01") ? DateTime.Now.ToString(formatodata) : da.ToString(formatodata); //adata = (a == null || a.ToShortDateString() == "1900-01-01") ? DateTime.Now.ToString(formatodata) : a.ToString(formatodata); sqlfiltro = " CAST (a.voraentrata as date) BETWEEN (DATE '" + dada.ToString(formatodata) + "') and ( DATE '" + ada.ToString(formatodata) + "' )"; Giornaliera.Titles.Clear(); switch (rblTipo.SelectedValue) { case "Numero registrazioni per SEDE": sqlstr = "SELECT count(a.IDVISITA) as Visite, b.SSEDE as Sede FROM ACCESSI as a left join sedi as b on a.VSEDE_EK=b.SID where " + sqlfiltro + " group by b.ssede"; sqlstr = "SELECT count(a.IDVISITA) as Registrazioni, coalesce(sum(vgruppo),0) as accompagnati, (count(idVisita) + coalesce(sum(vgruppo),0)) as Visite , b.SSEDE as Sede FROM ACCESSI as a left join "; sqlstr += "sedi as b on a.VSEDE_EK = b.SID where " + sqlfiltro + " group by b.ssede"; break; case "Numero registrazioni per orario": //sqlstr = "SELECT count (a.IDVISITA) as Registrazioni, (count(idVisita) + sum(vgruppo)) as Visite, extract ( hour from a.VORAENTRATA ) as ore FROM ACCESSI a where " + sqlfiltro + " group by ore having extract(hour from a.VORAENTRATA ) >= 7 and extract (hour from a.VORAENTRATA ) <= 19"; sqlstr = "SELECT count (a.IDVISITA) as Registrazioni, (count(idVisita) + coalesce(sum(vgruppo),0)) as Visite, extract ( hour from a.VORAENTRATA ) as dalleore, "; sqlstr += "(extract(hour from a.voraentrata ) || ' - ' || cast(extract(hour from a.voraentrata ) + 1 as varchar(2))) as labelx FROM ACCESSI a where "; sqlstr += sqlfiltro + " group by dalleore having extract(hour from a.VORAENTRATA ) >= 7 and extract (hour from a.VORAENTRATA ) <= 19 "; //sqlstr += "order by mese"; break; case "Numero registrazioni per mese": sqlstr = "SELECT count (a.IDVISITA) as Registrazioni, sum(vgruppo), (count(idVisita) + coalesce(sum(vgruppo), 0)) as Visite, "; sqlstr += "trim(iif(EXTRACT(MONTH FROM a.VORAENTRATA) > 9, '', '0') || EXTRACT(MONTH FROM a.VORAENTRATA)) || '-' || cast(extract(year from a.VORAENTRATA) as varchar(4)) as mese "; sqlstr += "FROM ACCESSI a where " + sqlfiltro + " group by extract(year from a.VORAENTRATA), mese "; sqlstr += "order by extract(year from a.VORAENTRATA), mese "; break; } tTitolo.Text = "Rilevazione accessi a partire dal " + dada.ToString("dd-MM-yyyy") + " sino al " + ada.ToString("dd-MM-yyyy"); tTitolo.Enabled = false; SqlCommand cmd = new SqlCommand(); try { SQLClass.openaSQLConn(out msg); if (SQLClass.SQLConn.State != ConnectionState.Open) { SQLClass.closeaSQLConn(out msg); SQLClass.openaSQLConn(out msg); } SqlDataReader reader = cmd.ExecuteReader(); } catch (Exception ex) { tStato.Text = string.Format("ERRORE: non è possibile leggere la tabella ACCESSI E SEDI. {0}", ex.Message); return; } long rr = SQLClass.getSQLdata(sqlstr, "AccessiXSedi", out msg); //tStato.Text = string.Format("Numero sedi attive in data {0} : {1}", Data.ToShortDateString(), rr); if (ds.Tables["AccessiXSedi"].Rows.Count > 0 && rblTipo.SelectedValue == "Numero registrazioni per SEDE") { Giornaliera.Series.Clear(); Giornaliera.DataSource = ds.Tables["AccessiXSedi"]; Giornaliera.Titles.Add(titolo).Font = new System.Drawing.Font("Thaoma", 12); Giornaliera.Series.Add("Serie Sedi"); Giornaliera.Series["Serie Sedi"].BorderWidth = 1; Giornaliera.Series["Serie Sedi"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column; Giornaliera.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Verdana", 7); Giornaliera.ChartAreas["ChartArea1"].AxisX.Interval = 1; Giornaliera.ChartAreas["ChartArea1"].AxisX.IsLabelAutoFit = false; Giornaliera.ChartAreas["ChartArea1"].AxisX.LabelStyle.TruncatedLabels = false; Giornaliera.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.FromName("AliceBlue"); Giornaliera.ChartAreas["ChartArea1"].BackSecondaryColor = System.Drawing.Color.FromName("Red"); Giornaliera.ChartAreas["ChartArea1"].BackGradientStyle = System.Web.UI.DataVisualization.Charting.GradientStyle.TopBottom; Giornaliera.Series["Serie Sedi"].XValueMember = "Sede"; Giornaliera.Series["Serie Sedi"].AxisLabel = "Sede"; Giornaliera.Series["Serie Sedi"].Color = System.Drawing.Color.FromName("RoyalBlue"); Giornaliera.ChartAreas["ChartArea1"].AxisY.LabelStyle.TruncatedLabels = false; Giornaliera.Series["Serie Sedi"].YValueMembers = "Visite"; Giornaliera.Series["Serie Sedi"].IsValueShownAsLabel = true; Giornaliera.Series["Serie Sedi"].Font = new System.Drawing.Font("Thaoma", 12); Giornaliera.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Giornaliera.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Giornaliera.ChartAreas["Serie Sedi"]. Giornaliera.ChartAreas["ChartArea1"].AxisY2.Enabled = new System.Web.UI.DataVisualization.Charting.AxisEnabled(); //Giornaliera.Series["Serie Sedi"].Label = Giornaliera.Series["Serie Sedi"].YValueMembers; Giornaliera.DataBind(); } if (ds.Tables["AccessiXSedi"].Rows.Count > 0 && rblTipo.SelectedValue == "Numero registrazioni per orario") { Giornaliera.Series.Clear(); Giornaliera.DataSource = ds.Tables["AccessiXSedi"]; Giornaliera.Titles.Add(titolo).Font = new System.Drawing.Font("Thaoma", 12); Giornaliera.Series.Add("Serie Ore"); Giornaliera.Series["Serie Ore"].BorderWidth = 1; Giornaliera.Series["Serie Ore"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column; Giornaliera.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Verdana", 7); Giornaliera.ChartAreas["ChartArea1"].AxisX.Interval = 1; Giornaliera.ChartAreas["ChartArea1"].AxisX.IsLabelAutoFit = false; Giornaliera.ChartAreas["ChartArea1"].AxisX.LabelStyle.TruncatedLabels = false; Giornaliera.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.FromName("Bisque"); Giornaliera.ChartAreas["ChartArea1"].BackSecondaryColor = System.Drawing.Color.FromName("Red"); Giornaliera.ChartAreas["ChartArea1"].BackGradientStyle = System.Web.UI.DataVisualization.Charting.GradientStyle.TopBottom; Giornaliera.Series["Serie Ore"].XValueMember = "labelx"; Giornaliera.Series["Serie Ore"].AxisLabel = "labelx"; Giornaliera.Series["Serie Ore"].Color = System.Drawing.Color.FromName("Coral"); Giornaliera.ChartAreas["ChartArea1"].AxisY.LabelStyle.TruncatedLabels = false; Giornaliera.Series["Serie Ore"].YValueMembers = "Visite"; Giornaliera.Series["Serie Ore"].IsValueShownAsLabel = true; Giornaliera.Series["Serie Ore"].Font = new System.Drawing.Font("Thaoma", 12); Giornaliera.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Giornaliera.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Giornaliera.ChartAreas["Serie Sedi"]. Giornaliera.ChartAreas["ChartArea1"].AxisY2.Enabled = new System.Web.UI.DataVisualization.Charting.AxisEnabled(); //Giornaliera.Series["Serie Sedi"].Label = Giornaliera.Series["Serie Sedi"].YValueMembers; Giornaliera.DataBind(); } if (ds.Tables["AccessiXSedi"].Rows.Count > 0 && rblTipo.SelectedValue == "Numero registrazioni per mese") { Giornaliera.Series.Clear(); Giornaliera.DataSource = ds.Tables["AccessiXSedi"]; Giornaliera.Titles.Add(titolo).Font = new System.Drawing.Font("Thaoma", 12); Giornaliera.Series.Add("Serie Mesi"); Giornaliera.Series["Serie Mesi"].BorderWidth = 1; Giornaliera.Series["Serie Mesi"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column; Giornaliera.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Verdana", 7); Giornaliera.ChartAreas["ChartArea1"].AxisX.Interval = 1; Giornaliera.ChartAreas["ChartArea1"].AxisX.IsLabelAutoFit = false; Giornaliera.ChartAreas["ChartArea1"].AxisX.LabelStyle.TruncatedLabels = false; Giornaliera.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.FromName("Azure"); Giornaliera.ChartAreas["ChartArea1"].BackSecondaryColor = System.Drawing.Color.FromName("Red"); Giornaliera.ChartAreas["ChartArea1"].BackGradientStyle = System.Web.UI.DataVisualization.Charting.GradientStyle.TopBottom; Giornaliera.Series["Serie Mesi"].XValueMember = "Mese"; Giornaliera.Series["Serie Mesi"].AxisLabel = "Mese"; Giornaliera.Series["Serie Mesi"].Color = System.Drawing.Color.FromName("LightGoldenrodYellow"); Giornaliera.ChartAreas["ChartArea1"].AxisY.LabelStyle.TruncatedLabels = false; Giornaliera.Series["Serie Mesi"].YValueMembers = "Visite"; Giornaliera.Series["Serie Mesi"].IsValueShownAsLabel = true; Giornaliera.Series["Serie Mesi"].Font = new System.Drawing.Font("Thaoma", 12); Giornaliera.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Giornaliera.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Giornaliera.ChartAreas["Serie Sedi"]. Giornaliera.ChartAreas["ChartArea1"].AxisY2.Enabled = new System.Web.UI.DataVisualization.Charting.AxisEnabled(); //Giornaliera.Series["Serie Sedi"].Label = Giornaliera.Series["Serie Sedi"].YValueMembers; Giornaliera.DataBind(); } SQLClass.closeaSQLConn(out msg); }