Пример #1
0
        void grdMessaggi_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.Cells.Count >= 6)
            {
                if ("True" == e.Row.Cells[5].Text)
                {
                    e.Row.Font.Bold = false;
                }
                else
                {
                    e.Row.Font.Bold = true;
                }
            }
            if (!isInArrivo)
            {
                Label labelNames = null;
                long numeroMissione;
                try
                {
                    labelNames = (Label)(e.Row.Cells[2].FindControl("lblDestinatari"));
                    numeroMissione = long.Parse(e.Row.Cells[0].Text);
                    MessaggiManager manager = new MessaggiManager(DatabaseContext);
                    foreach (string nome in manager.GetRecipients(numeroMissione))
                    {
                        labelNames.Text += nome + " ";
                    }
                }
                catch (Exception)
                {
                    if (labelNames != null)
                    {
                        labelNames.Text = "Errore durante recupero nomi";
                    }
                }

            }
        }
Пример #2
0
 private void caricaMessaggio(long numeroMessaggio)
 {
     hidMessageId.Value = numeroMessaggio.ToString();
     statusMessage.Text = string.Empty;
     MessaggiManager messageManager = new MessaggiManager(DatabaseContext);
     Missione messaggio = messageManager.GetSingleMessage(numeroMessaggio);
     lblMittente.Text = messaggio.Personaggio.Nome;
     lblTitolo.Text = messaggio.Titolo;
     lblTesto.Text = string.IsNullOrWhiteSpace(messaggio.Testo) ? string.Empty : messaggio.Testo.Replace("\r", "<br />");
     lblData.Text = messaggio.DataCreazione.ToString();
     if (isInArrivo)
     {
         numeroMittente = messaggio.Mandante;
         RubricaManager namesManager = new RubricaManager(DatabaseContext);
         btnSalvaMittente.Visible = !namesManager.HasContact(LoggedCharacter.NumeroPG, messaggio.Mandante);
         rowDestinatari.Visible = false;
         messageManager.SetIncomingMessageRead(this.LoggedCharacter.NumeroPG, numeroMessaggio);
     }
     else
     {
         numeroMittente = null;
         btnSalvaMittente.Visible = false;
         rowDestinatari.Visible = true;
         foreach (string nome in messageManager.GetRecipients(numeroMessaggio))
         {
             lblDestinatari.Text += nome + " ";
         }
         messageManager.SetOutgoingMessageRead(this.LoggedCharacter.NumeroPG, numeroMessaggio);
     }
     DatabaseContext.SaveChanges();
     if (isInArrivo)
     {
         btnRispondi.Visible = true;
     }
     else
     {
         btnRispondi.Visible = false;
     }
     PageViews.SetActiveView(readMessage);
 }