Example #1
0
 private void resetFields()
 {
     hidField.Value            = null;
     lblDescrizione.Text       = "Inserire ingredienti";
     txtElencoIngredienti.Text = string.Empty;
     btnCrea.Enabled           = false;
     ElaborazioneViews.SetActiveView(viewAttesa);
 }
Example #2
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            Timer1.Enabled = false;
            string[]     ingredientiLetti       = hidField.Value.Split(';');
            List <long?> progressiviIngredienti = new List <long?>();

            for (int i = 0; i < ingredientiLetti.Length; i++)
            {
                if (!string.IsNullOrWhiteSpace(ingredientiLetti[i]))
                {
                    long progressivo = long.Parse(ingredientiLetti[i]);
                    progressiviIngredienti.Add(progressivo);
                }
            }
            SostanzeManager manager  = new SostanzeManager(DatabaseContext);
            NewSostanze     sostanza = manager.GetSubstanceFromListOfComponents(progressiviIngredienti);

            ElaborazioneViews.SetActiveView(viewRisultato);
            if (sostanza != null)
            {
                if (sostanza.Tipo == 0 || sostanza.Tipo == 2 || sostanza.Tipo == 3)
                {
                    lblNome.Text = sostanza.Nome;
                    if (!string.IsNullOrWhiteSpace(sostanza.Descrizione))
                    {
                        lblDescrizione.Text = sostanza.Descrizione.Replace("\r", "<br />");
                    }
                    if (!string.IsNullOrWhiteSpace(sostanza.Effetto))
                    {
                        lblEffetto.Text = sostanza.Effetto.Replace("\r", "<br />");
                    }
                    lblData.Text      = sostanza.DataScadenza.HasValue ? sostanza.DataScadenza.Value.ToString("dd/MM/yyyy") : string.Empty;
                    lblCosto.Text     = sostanza.Costo.ToString();
                    lblEfficacia.Text = sostanza.ValoreEfficacia.ToString();
                    lblTipo.Text      = sostanza.TipoSostanze.Descrizione;
                    lblModoUso.Text   = sostanza.ModoUso;
                    if (!string.IsNullOrWhiteSpace(sostanza.Immagine))
                    {
                        imgOggetto.Visible  = true;
                        imgOggetto.ImageUrl = sostanza.Immagine;
                    }
                    btnCrea.Enabled = false;
                }
                else
                {
                    resetResults();
                    ElaborazioneViews.SetActiveView(viewAttesa);
                    lblDescrizione.Text = "Gli ingredienti inseriti non hanno dato un risultato";
                }
            }
            else
            {
                resetResults();
                ElaborazioneViews.SetActiveView(viewAttesa);
                lblDescrizione.Text = "Gli ingredienti inseriti non hanno dato un risultato";
            }
        }
Example #3
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            Timer1.Enabled = false;
            string[]     ingredientiLetti       = hidField.Value.Split(';');
            List <long?> progressiviIngredienti = new List <long?>();

            for (int i = 0; i < ingredientiLetti.Length; i++)
            {
                if (!string.IsNullOrWhiteSpace(ingredientiLetti[i]))
                {
                    long progressivo = long.Parse(ingredientiLetti[i]);
                    progressiviIngredienti.Add(progressivo);
                }
            }
            OggettiManager manager = new OggettiManager(DatabaseContext);
            NewOggetti     oggetto = manager.GetItemFromListOfComponents(progressiviIngredienti);

            ElaborazioneViews.SetActiveView(viewRisultato);
            if (oggetto != null)
            {
                lblNome.Text = oggetto.Nome;
                if (!string.IsNullOrWhiteSpace(oggetto.Descrizione))
                {
                    lblDescrizione.Text = oggetto.Descrizione.Replace("\r", "<br />");
                }
                if (!string.IsNullOrWhiteSpace(oggetto.Effetto))
                {
                    lblEffetto.Text = oggetto.Effetto.Replace("\r", "<br />");
                }

                lblCosto.Text       = oggetto.Costo.ToString();
                lblCariche.Text     = oggetto.NumeroCariche.HasValue ? oggetto.NumeroCariche.ToString() : string.Empty;
                lblDescrizione.Text = string.IsNullOrWhiteSpace(oggetto.Descrizione) ? string.Empty : oggetto.Descrizione.Replace("\r", "<br />");
                lblTipo.Text        = oggetto.TipoOggetti.Descrizione;
                if (!string.IsNullOrWhiteSpace(oggetto.Immagine))
                {
                    imgOggetto.Visible  = true;
                    imgOggetto.ImageUrl = oggetto.Immagine;
                }
                btnCrea.Enabled = false;
            }
            else
            {
                resetResults();
                ElaborazioneViews.SetActiveView(viewAttesa);
                lblDescrizione.Text = "I componenti inseriti non possono essere assemblati tra loro";
            }
        }
Example #4
0
 protected void btnCrea_Click(object sender, EventArgs e)
 {
     Timer1.Interval = 45000;
     Timer1.Enabled  = true;
     ElaborazioneViews.SetActiveView(viewElaborazione);
 }