override protected void OnInit(EventArgs e) { InitializeMyComponents(); objUtente = new Utente(); objWorkflow = new Workflow(); objClienti = new Clienti(); objUtilita = new Utilita(); base.OnInit(e); }
protected DataSet fillDataSet() { object[] paramValues = null; paramValues = new object[1]; paramValues[0] = WhereClause; DataSet ds = Utilita.GetDataSet(qClassMethod, "WhereClause", paramValues); return(ds); }
protected override void OnInit(EventArgs e) { InitializeMyComponents(); p = this.Page as BasePage; objUtente = new Utente(); objSistema = new Sistema(); objClienti = new Clienti(); objUtilita = new Utilita(); base.OnInit(e); }
public void Init() { LumenApplication app = LumenApplication.Instance; IObservable <ScaricoFotoMsg> observable = app.bus.Observe <ScaricoFotoMsg>(); observable.Subscribe(this); _impl = new ScaricatoreFotoSrvImpl(); _impl.start(); // ------- using (LumenEntities dbContext = new LumenEntities()) { InfoFissa i = dbContext.InfosFisse.Single <InfoFissa>(f => f.id == "K"); _mario = Utilita.ottieniFotografoMario(dbContext); // Se hai fatto bene la configurazione, il fotografo artista deve sempre esistere _artista = dbContext.Fotografi.Single(f => f.id == Configurazione.ID_FOTOGRAFO_DEFAULT); // cerco l'evento con la descrizione _ballo = (from e in dbContext.Eventi where e.descrizione == "BALLO" select e).FirstOrDefault(); if (_ballo == null) { _ballo = new Evento(); _ballo.descrizione = "BALLO"; _ballo.id = Guid.NewGuid(); dbContext.Eventi.Add(_ballo); } _briscola = (from e in dbContext.Eventi where e.descrizione == "BRISCOLA" select e).FirstOrDefault(); if (_briscola == null) { _briscola = new Evento(); _briscola.id = Guid.NewGuid(); _briscola.descrizione = "BRISCOLA"; dbContext.Eventi.Add(_briscola); } dbContext.SaveChanges(); } }
private ParamStampaFoto ricavaParamStampaFoto() { ParamStampaFoto p = new ParamStampaFoto(); // Vediamo se esiste il formato // TODO : creare un nuovo attributo che identifica il formato carta come chiave naturale (per esempio A4 oppure 6x8) LumenEntities dbContext = UnitOfWorkScope.currentDbContext; FormatoCarta formato = Utilita.ottieniFormatoCarta(dbContext, "A5"); formato.prezzo = 5; p.formatoCarta = formato; p.nomeStampante = Costanti.NomeStampantePdf; // Qui non si deve spaccare Digiphoto.Lumen.Database.OrmUtil.forseAttacca <FormatoCarta>(ref formato); return(p); }
public void initTest() { System.Diagnostics.Trace.WriteLine("INIZIO"); LumenApplication app = LumenApplication.Instance; app.avvia(); ScaricatoreFotoImplTest scaricatore = new ScaricatoreFotoImplTest(); scaricatore.Init(); scaricatore.scaricaFileTest(); giorni = Configurazione.infoFissa.numGiorniEliminaFoto; System.Diagnostics.Trace.WriteLine("GIORNI " + giorni); using (LumenEntities dbContext = new LumenEntities()) { _mario = Utilita.ottieniFotografoMario(dbContext); } _impl = new EliminaFotoVecchieSrvImpl(); _impl.start(); }
public static bool getDizionarioPermessiDTF() { Utilita objUtilita = new Utilita(); Dictionary <string, int> dizionarioPermessi = (Dictionary <string, int>)HttpContext.Current.Session["dizionarioPermessi"]; if (dizionarioPermessi.ContainsKey("DTF")) { if (dizionarioPermessi["DTF"] == objUtilita.AccessDelete) { return(true); } else { return(false); } } else { return(false); } }
/// <summary> /// Override onInit Base Page: Setto di dafault It /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { objDictionary = new Dizionario(); objTestiPagine = new TestiPagine(); objUtilita = new Utilita(); qNAZ_ID_NAZIONE = 1;//it Session["NAZ_ID_NAZIONE"] = 1; switch (qNAZ_ID_NAZIONE) { case 1: qCultureInfoName = "it"; break; case 3: qCultureInfoName = "en"; break; default: qCultureInfoName = "it"; break; } objDizionarioUI = objDictionary.GetDictionary(qNAZ_ID_NAZIONE); objTestiPagineUI = objTestiPagine.GetTestipagina(Page.GetType().BaseType.Name, qNAZ_ID_NAZIONE); objUtilita.Naz_id_nazione = qNAZ_ID_NAZIONE; getCulture(); //objSistema.Read(); if (Page.Header != null) { this.Title = GetValueDizionarioUI("NOME_APPLICAZIONE"); } base.OnInit(e); }
protected void LoadDataSource() { try { VWhereClause = "WHERE UTENTE.CLI_ID_CLIENTE = " + idCliente + " AND UTE_FLAG_ELIMINATO = 0 "; if (txtUtente.Value != "") { VWhereClause += " AND COALESCE(UTE_COGNOME + ' ' + UTE_NOME,UTE_COGNOME) LIKE '%" + Utilita.safeParamSql(txtUtente.Value) + "%'"; } VWhereClause += " ORDER BY UTE_COGNOME ASC,UTE_NOME ASC"; if (primoAccesso) { VWhereClause = "WHERE 1=2 "; } AccessData(); } catch (Exception ex) { ExceptionPolicy.HandleException(ex, "Propagate Policy"); } }
/// <summary> /// Override onInit Base Page: Controllo Sessioni /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { objDictionary = new Dizionario(); objTestiPagine = new TestiPagine(); objUtilita = new Utilita(); //Utilizzato per i permessi di accesso try { //Controllo se l'utente è autenticato if (!User.Identity.IsAuthenticated) { Exception ex = new Exception("Unauthenticated user. Please log in."); throw ex; } //Controllo se ci sono delle variabili in Session if (Session.Count == 0) { Exception ex = new Exception("Session Timed Out. Please log in again."); throw ex; } idLoggedUser = Convert.ToInt32(Session["UTE_ID_UTENTE"]); } catch (Exception ecc) { string strERROR = ecc.Message.Replace("'", ""); // Gestione messaggistica all'utente e trace in DB dell'errore ExceptionPolicy.HandleException(ecc, "Propagate Policy"); Response.Write(@"<script type='text/javascript'> try { if(window.opener) { if(window.opener.parent.frames) window.opener.parent.frames.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; else window.opener.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; self.close(); } else { if(parent.frames) parent.frames.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; else document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; } } catch(e) { self.close(); } </script>"); Response.End(); } //Spostato da PageLoad INIZIO ---------------------- if (Session["NAZ_ID_NAZIONE"] != null) { qNAZ_ID_NAZIONE = Convert.ToInt32(Session["NAZ_ID_NAZIONE"]); } else { qNAZ_ID_NAZIONE = Convert.ToInt32(Request.QueryString["NAZ_ID_NAZIONE"]); } switch (qNAZ_ID_NAZIONE) { case 1: qCultureInfoName = "it"; break; case 3: qCultureInfoName = "en"; break; default: qCultureInfoName = "it"; break; } dizionarioPermessi = (Dictionary <string, int>)Session["dizionarioPermessi"]; objDizionarioUI = objDictionary.GetDictionary(qNAZ_ID_NAZIONE); objTestiPagineUI = objTestiPagine.GetTestipagina(Page.GetType().BaseType.Name, qNAZ_ID_NAZIONE); objUtilita.Naz_id_nazione = qNAZ_ID_NAZIONE; getCulture(); if (Page.Header != null) { this.Title = GetValueDizionarioUI("NOME_APPLICAZIONE"); } base.OnInit(e); }
private void BindDataRssNews() { try { StringBuilder strTagRssNews = new StringBuilder(); DateTimeFormatInfo myDateTime = new CultureInfo(Thread.CurrentThread.CurrentCulture.Name, false).DateTimeFormat; //Download xml WebRequest myRequest = WebRequest.Create(QSIS_LINK_RSS_NEWS); myRequest.Timeout = 2000; WebResponse myResponse = myRequest.GetResponse(); Stream rssStream = myResponse.GetResponseStream(); XmlDocument rssDoc = new XmlDocument(); rssDoc.Load(rssStream); rssStream.Flush(); rssStream.Close(); myResponse.Close(); XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item"); string title = string.Empty; string link = string.Empty; string description = string.Empty; //string image = string.Empty; string pubDate = string.Empty; for (int i = 0; i < rssItems.Count; i++) { XmlNode rssDetail; rssDetail = rssItems.Item(i).SelectSingleNode("title"); if (rssDetail != null) { title = Utilita.StripHTML(rssDetail.InnerText); } else { title = string.Empty; } rssDetail = rssItems.Item(i).SelectSingleNode("link"); if (rssDetail != null) { link = rssDetail.InnerText; } else { link = string.Empty; } rssDetail = rssItems.Item(i).SelectSingleNode("description"); if (rssDetail != null) { description = rssDetail.InnerText;// Utilita.pulisciTesto(Utilita.StripHTML(rssDetail.InnerText)); if (description.Trim() == string.Empty) { description = getDizionarioUI("LB_RSS_DESCR_EMPTY"); } } else { description = string.Empty; } //rssDetail = rssItems.Item(i).SelectSingleNode("pubDate"); //if (rssDetail != null) //{ // pubDate = Convert.ToDateTime(rssDetail.InnerText).ToString(myDateTime.ShortDatePattern); //} //else //{ // pubDate = string.Empty; //} //non ci sono rss if (rssItems.Count == 0) { DivPanelNews.Visible = false; } else { if (i == 0)//Sono al primo { strTagRssNews.Append("<ul>"); } strTagRssNews.Append("<li><div class='titolo'>"); strTagRssNews.Append("<span><a target=\"new\" href=\"" + link + "\">\n"); strTagRssNews.Append(title + "</a></span></div>"); strTagRssNews.Append("<br/>"); strTagRssNews.Append("<div class='descr'><span>"); strTagRssNews.Append(description + "</span></div>"); strTagRssNews.Append("<br/><br/><br/></li>"); if (i == rssItems.Count - 1)//Sono arrivato alla fine { strTagRssNews.Append("</ul>"); DivRssNews.InnerHtml = strTagRssNews.ToString(); } } } } catch (WebException ex) { if (ex.Status.ToString() != "Timeout") { // Gestione messaggistica all'utente e trace in DB dell'errore //ExceptionPolicy.HandleException(ex, "Propagate Policy"); } else { DivRssNews.InnerHtml = "<ul><li>" + GetValueDizionarioUI("MSG_ERR_RSS_TIMEOUT") + "</li></ul>"; } } catch (Exception ex) { // Gestione messaggistica all'utente e trace in DB dell'errore //ExceptionPolicy.HandleException(ex, "Propagate Policy"); } }
/// <summary> /// Rss Scioperi /// </summary> private void BindDataRssScioperi() { try { StringBuilder strTagRssScioperi = new StringBuilder(); DateTimeFormatInfo myDateTime = new CultureInfo(Thread.CurrentThread.CurrentCulture.Name, false).DateTimeFormat; //Download xml WebRequest myRequest = WebRequest.Create(QSIS_LINK_RSS_SCIOPERI); myRequest.Timeout = 10000; myRequest.Credentials = CredentialCache.DefaultCredentials; myRequest.PreAuthenticate = true; WebResponse myResponse = myRequest.GetResponse(); Stream rssStream = myResponse.GetResponseStream(); XmlDocument rssDoc = new XmlDocument(); XmlReader reader = XmlReader.Create(new StreamReader(rssStream, Encoding.UTF8)); rssDoc.Load(reader); rssStream.Flush(); rssStream.Close(); myResponse.Close(); XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item"); string title = string.Empty; string link = string.Empty; string description = string.Empty; //string image = string.Empty; string pubDate = string.Empty; for (int i = 0; i < rssItems.Count; i++) { XmlNode rssDetail; rssDetail = rssItems.Item(i).SelectSingleNode("title"); if (rssDetail != null) { title = Utilita.StripHTML(rssDetail.InnerText); } else { title = string.Empty;; } rssDetail = rssItems.Item(i).SelectSingleNode("link"); if (rssDetail != null) { link = rssDetail.InnerText; } else { link = string.Empty;; } rssDetail = rssItems.Item(i).SelectSingleNode("description"); if (rssDetail != null) { description = rssDetail.InnerText;// Utilita.pulisciTesto(Utilita.StripHTML(rssDetail.InnerText)); if (description.Trim() == string.Empty) { description = getDizionarioUI("LB_RSS_DESCR_EMPTY"); } } else { description = string.Empty; } if (rssItems.Count == 0) { // Non ci sono rss DivPanelScioperi.Visible = false; } else { strTagRssScioperi.Append("<a target=\"new\" href=\"" + link + "\">"); strTagRssScioperi.Append(title + ""); strTagRssScioperi.Append("</a><p>"); strTagRssScioperi.Append(description); strTagRssScioperi.Append("</p>"); if (i == rssItems.Count - 1) // Sono arrivato alla fine { DivRssScioperi.InnerHtml = strTagRssScioperi.ToString(); } } } } catch (WebException ex) { if (ex.Status.ToString() != "Timeout") { // Gestione messaggistica all'utente e trace in DB dell'errore //ExceptionPolicy.HandleException(ex, "Propagate Policy"); } else { DivRssScioperi.InnerHtml = "<ul><li>" + GetValueDizionarioUI("MSG_ERR_RSS_TIMEOUT") + "</li></ul>"; } } catch (Exception ex) { // Gestione messaggistica all'utente e trace in DB dell'errore //ExceptionPolicy.HandleException(ex, "Propagate Policy"); } }
public void carrelloTest() { using (LumenEntities dbContext = new LumenEntities()) { Carrello c1 = new Carrello(); c1.id = Guid.NewGuid(); c1.giornata = DateTime.Today; c1.tempo = DateTime.Now; c1.totaleAPagare = 123m; c1.righeCarrello = new EntityCollection <RigaCarrello>(); _carrelloInserito = c1; // --- RigaCarrello r1 = new RigaCarrello(); r1.fotografia = Costanti.findUnaFotografiaRandom(dbContext); r1.fotografo = r1.fotografia.fotografo; r1.discriminator = RigaCarrello.TIPORIGA_MASTERIZZATA; r1.id = Guid.NewGuid(); r1.prezzoLordoUnitario = new Decimal(20); r1.quantita = 2; r1.prezzoNettoTotale = Decimal.Multiply(r1.prezzoLordoUnitario, r1.quantita); r1.descrizione = "Foto masterizzata"; c1.righeCarrello.Add(r1); _contaMasterizzate++; // --- RigaCarrello r2 = new RigaCarrello(); r2.fotografia = Costanti.findUnaFotografiaRandom(dbContext); r2.discriminator = RigaCarrello.TIPORIGA_STAMPA; r2.id = Guid.NewGuid(); r2.prezzoLordoUnitario = new Decimal(5); r2.quantita = 3; r2.prezzoNettoTotale = Decimal.Multiply(r2.prezzoLordoUnitario, r2.quantita); r2.descrizione = "RicaFotoStampata1"; r2.totFogliStampati = 3; r2.prodotto = Utilita.ottieniFormatoCarta(dbContext, "A4"); r2.fotografo = Utilita.ottieniFotografoMario(dbContext); c1.righeCarrello.Add(r2); _contaStampate++; // --- RigaCarrello r3 = new RigaCarrello(); r3.fotografia = Costanti.findUnaFotografiaRandom(dbContext); r3.discriminator = RigaCarrello.TIPORIGA_STAMPA; r3.id = Guid.NewGuid(); r3.prezzoLordoUnitario = new Decimal(5); r3.quantita = 2; r3.prezzoNettoTotale = Decimal.Multiply(r3.prezzoLordoUnitario, r3.quantita); r3.descrizione = "RicaFotoStampata1"; r3.totFogliStampati = 3; r3.prodotto = Utilita.ottieniFormatoCarta(dbContext, "A4"); r3.fotografo = Utilita.ottieniFotografoMario(dbContext); c1.righeCarrello.Add(r3); _contaStampate++; // --- dbContext.Carrelli.Add(c1); try { dbContext.SaveChanges(); } catch (Exception ee) { String msg = ErroriUtil.estraiMessage(ee); Console.WriteLine(msg); throw ee; } } // Verifico che l'inserimento appena effettuato sia andato bene. queryPolimorficaCorrente(); // provo altre tecniche di query, giusto per sport. queryPolimorficaSql(); queryPolimorfica(); }
protected override void OnInit(EventArgs e) { try { ButtonReset.ServerClick += new EventHandler(ButtonReset_Click); objSessioniUtenti = new SessioniUtenti(); #region Login with WS objUtente = new Utente(); objClienti = new Clienti(); objCentriDiCosto = new Centri_di_costo(); objDictionary = new Dizionario(); objSistema = new Sistema(); objErrori = new Errori(); objRuoliUtente = new RuoliUtente(); objCrossUtenteWorkflow = new CrossUtenteWorkflow(); objUtilita = new Utilita(); string acronimoCliente = string.Empty; string UrlReferrer = string.Empty; objSistema.Read(); //Questa parte di codice serve per gestire il fatto di non andare in eccezione se il certificato //SSl è scaduto. ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback( delegate( object sender2, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }); //Fine if (hLingua.SelectedValue != "") { objDizionarioUI = objDictionary.GetDictionary((int)Convert.ToInt32(hLingua.SelectedValue)); } else { objDizionarioUI = objDictionary.GetDictionary((int)objSistema.Naz_id_nazione); } #endregion ButtonLogin.ServerClick += new EventHandler(ButtonLogin_Click); this.PreRender += new System.EventHandler(this.frm_LGN_PreRender); base.OnInit(e); } catch (Exception ex) { // Gestione messaggistica all'utente e trace in DB dell'errore ExceptionPolicy.HandleException(ex, "Propagate Policy"); } }