Esempio n. 1
0
 protected void Inbox1_OnRowSelected(object sender, InBox.RowSelectedEventArgs e)
 {
     if (!WebMailClientManager.AccountIsValid())
     {
         AccountInvalidated();
     }
     if (!e.UId.IsNullOrWhiteSpace())
     {
         if (!(WebMailClientManager.CurrentMailExist() && e.UId.Trim() == WebMailClientManager.CurrentMailGet().Uid))
         {
             // string folder = e.CurrentFolder.Parse(0);
             //  MailFolder mailFolder = (MailFolder)folder;
             WebMailClientManager.CurrentFolderSet(e.CurrentFolder);
             WebMailClientManager.ParentFolderSet(e.ParentFolder);
             if (e.Dimension < int.Parse(ConfigurationManager.AppSettings["MaxMemoryDimensionForMailViewer"]))
             {
                 MailViewer1.Initialize(e.UId, e.CurrentRating, e.CurrentFolder, e.ParentFolder);
             }
             else
             {
                 Message msg = new Message();
                 MailViewer1.hfUIDMailValue = msg.Uid = e.UId;
                 msg.Size = e.Dimension;
                 WebMailClientManager.CurrentMailSet(msg);
                 MailViewer1.Initialize(e.UId, e.CurrentRating, WebMailClientManager.CurrentFolderGet(), WebMailClientManager.ParentFolderGet());
                 pnlMail.Update();
             }
         }
     }
 }
Esempio n. 2
0
        // Testare bene todo modificare mailmove
        protected void MailViewer1_OnRequireAction(object sender, MailActionEventArgs action, string parentFolder)
        {
            switch (action.Action)
            {
            case MailActions.ACQUIRE:
                if (WebMailClientManager.CurrentMailExist() && WebMailClientManager.AccountIsValid())
                {
                    MailUser muser = WebMailClientManager.getAccount();
                    Message  msg   = WebMailClientManager.CurrentMailGet();
                    while (msg.Container != null)
                    {
                        msg = msg.Container;
                        WebMailClientManager.CurrentMailRemove();
                    }
                    if (!WebMailClientManager.CurrentMailExist())
                    {
                        WebMailClientManager.CurrentMailSet(msg);
                    }
                    if (!String.IsNullOrEmpty(msg.HeaderFields["x-trasporto"]) &&
                        msg.HeaderFields["x-trasporto"].Equals("posta-certificata", StringComparison.InvariantCultureIgnoreCase))
                    {
                        string uid = msg.Uid;
                        int    id  = msg.Id;
                        msg     = msg.SubMessages[0];
                        msg.Uid = uid;
                        msg.Id  = id;
                    }
                    try
                    {
                        //TODO:ACQUISIOZNE MAIL INIT BEAKPONT - ALBERTO
                        if (msg.Uid == null)
                        {
                            msg.Uid = MailViewer1.hfUIDMailValue;
                        }
                        //Richiesta req = FaxPec.ServiceContracts.ServiceLocator.GetServiceFactory().RichiestaService.ProcessMail(muser, msg, parentFolder);
                        //if (req != null)
                        //{
                        //    List<string> uids = new List<string>();
                        //    uids.Add(msg.Uid);
                        //    string utente = Com.Delta.Anag.Security.MySecurityProvider.CurrentPrincipalName;
                        //    ServiceLocator.GetServiceFactory().getMailServerFacade(muser).MailMove(uids, MailStatus.LETTA, "1", utente, parentFolder);
                        //    FaxPec.Caching.Session.SessionManager<Richiesta>.set(FaxPec.Caching.Session.SessionKeys.FAXPEC_RICHIESTA, req);
                        //}
                    }
                    catch (ManagedException bex)
                    {
                        if (bex.GetType() != typeof(ManagedException))
                        {
                            ManagedException mEx = new ManagedException(bex.Message, "ERR_G043", string.Empty, string.Empty, bex);
                            ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                            log.Error(er);
                        }
                        ((BasePage)Page).info.AddMessage(bex, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR);
                        return;
                    }
                    //  Response.Redirect("~/pages/Istruz/IstruzioneRichiesta.aspx?m=m");
                }
                break;

            case MailActions.FORWARD:
            case MailActions.REPLY_TO:
            case MailActions.RE_SEND:
                ucSendMail.Visible = true;
                if (WebMailClientManager.AccountIsValid())
                {
                    ucSendMail.LoginVisibile(false);
                }
                ucSendMail.Initialize(action.Action);
                break;

            case MailActions.SEND:
                throw new NotImplementedException();
            }
        }