public void DrawPage() { txt_welcomeMessage.InnerText = String.Format("Bentornato {0}, sei un {1}", oUtente.Username, oUtente.RuoloToString());//ruolo è intero, estrarre stringa List <Postazione> postazioni = null; if (oUtente.Ruolo == 1) { postazioni = new daoPostazioni().GetBasedOnUtente(oUtente); } else if (oUtente.Ruolo == 3) { postazioni = new daoPostazioni().GetAll(); //postazioni.Insert(0, new Postazione("Gestione", "commerciale")); postazioni.Add(new Postazione("Gestione", "commerciale")); } else { postazioni = new List <Postazione>(); //postazioni.Insert(0, new Postazione("Gestione", "commerciale")); postazioni.Add(new Postazione("Gestione", "commerciale")); } if (postazioni != null) { Panel row = new Panel(); row.CssClass = "row"; int i = 0; foreach (Postazione p in postazioni) { if (p.Tipo == "commerciale") { if (row.Controls.Count > 0) { container.Controls.Add(row); row = new Panel(); row.CssClass = "row"; row.Controls.Add(CustomDiv(p)); container.Controls.Add(row); row = new Panel(); row.CssClass = "row"; } else { row.Controls.Add(CustomDiv(p)); container.Controls.Add(row); row = new Panel(); row.CssClass = "row"; } } else { if (i % 4 == 0) { container.Controls.Add(row); row = new Panel(); row.CssClass = "row"; } row.Controls.Add(CustomDiv(p)); i++; } } container.Controls.Add(row); } }