protected void MailResearch_Mail(RicercaMail.MailSelectedEventArgs e) { if (!e.UId.IsNullOrWhiteSpace()) { if (!(WebMailClientManager.CurrentMailExist() && e.UId.Trim() == WebMailClientManager.CurrentMailGet().Uid)) { MailServerConfigFacade mailserveconfigfacade = MailServerConfigFacade.GetInstance(); MailUser account = mailserveconfigfacade.GetUserByUserId(decimal.Parse(e.CurrentAccount)); account.Validated = true; WebMailClientManager.SetAccount(account); int idim = 0; WebMailClientManager.CurrentFolderSet(e.CurrentFolder); WebMailClientManager.ParentFolderSet(e.ParentFolder); if (e.Dimension != string.Empty) { idim = int.Parse(e.Dimension); } if (idim < int.Parse(ConfigurationManager.AppSettings["MaxMemoryDimensionForMailViewer"])) { MailViewer1.Initialize(e.UId, e.CurrRating, e.CurrentFolder, e.ParentFolder); pnlMail.Update(); } else { Message msg = new Message(); msg.Uid = e.UId; msg.Size = idim; WebMailClientManager.CurrentMailSet(msg); MailViewer1.Initialize(e.UId, e.CurrRating, WebMailClientManager.CurrentFolderGet(), WebMailClientManager.ParentFolderGet()); pnlMail.Update(); } } } }
private static void SetAccount(MailUser account) { MailServerFacade mailSCF = MailServerFacade.GetInstance(account); account.Validated = true; WebMailClientManager.SetAccount(account); }
public HttpResponseMessage AbilitaUsers(string idemail, string itemselector) { FoldersSendersModel model = new FoldersSendersModel(); BackendUserService bus = new BackendUserService(); if (string.IsNullOrEmpty(idemail) && string.IsNullOrEmpty(itemselector)) { model.success = "false"; model.message = "Valori insufficienti nella richiesta"; this.Request.CreateResponse <FoldersSendersModel>(HttpStatusCode.OK, model); } try { // model.FoldersList = listaCartelleNonAbilitate.ToArray(); string[] users = itemselector.Split(';'); var usersAbilitati = bus.GetDipendentiDipartimentoAbilitati(int.Parse(idemail)).Select(z => z.UserId).ToArray(); var ff = Array.ConvertAll(usersAbilitati, x => x.ToString()); var usersda = users.Except(ff); var usersa = ff.Except(users); foreach (string s in usersda) { bus.InsertAbilitazioneEmail(Convert.ToInt32(s), Convert.ToInt32(idemail), 0); } foreach (string s in usersa) { { bus.RemoveAbilitazioneEmail(Convert.ToInt32(s), Convert.ToInt32(idemail)); } } MailUser m = WebMailClientManager.getAccount(); if (m != null) { WebMailClientManager.AccountRemove(); MailServerConfigFacade facade = MailServerConfigFacade.GetInstance(); MailUser account = facade.GetUserByUserId(m.UserId); MailServerFacade serverFacade = MailServerFacade.GetInstance(account); account.Validated = true; WebMailClientManager.SetAccount(account); } model.success = "true"; } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Eccezione nellA ABILITAZIONE UTENTI", "ERR_U005", string.Empty, ex.Message, null); ErrorLogInfo er = new ErrorLogInfo(mEx); er.objectID = idemail.ToString(); log.Error(er); model.success = "false"; model.message = mEx.Message; } else { model.success = "false"; model.message = ex.Message; } } return(this.Request.CreateResponse <FoldersSendersModel>(HttpStatusCode.OK, model)); }
public HttpResponseMessage AbilitaFolders(string idemail, string itemselector) { FoldersSendersModel model = new FoldersSendersModel(); SendersFoldersService sfs = new SendersFoldersService(); if (string.IsNullOrEmpty(idemail) && string.IsNullOrEmpty(itemselector)) { model.success = "false"; model.message = "Valori insufficienti nella richiesta"; this.Request.CreateResponse <FoldersSendersModel>(HttpStatusCode.OK, model); } try { // model.FoldersList = listaCartelleNonAbilitate.ToArray(); string[] folders = itemselector.Split(';'); var foldersAbilitati = sfs.GetFoldersAbilitatiByIdSender(int.Parse(idemail)).Select(z => z.IdNome).ToArray(); var ff = Array.ConvertAll(foldersAbilitati, x => x.ToString()); var foldersda = folders.Except(ff); var foldersa = ff.Except(folders); foreach (string s in foldersda) { sfs.InsertAbilitazioneFolder(Convert.ToInt32(s), Convert.ToInt32(idemail), 0); } foreach (string s in foldersa) { if (s != "1" && s != "2" && s != "3") { sfs.DeleteAbilitazioneFolder(Convert.ToInt32(s), Convert.ToInt32(idemail)); } } MailUser m = WebMailClientManager.getAccount(); if (m != null) { WebMailClientManager.AccountRemove(); MailServerConfigFacade facade = MailServerConfigFacade.GetInstance(); MailUser account = facade.GetUserByUserId(m.UserId); MailServerFacade serverFacade = MailServerFacade.GetInstance(account); account.Validated = true; WebMailClientManager.SetAccount(account); } model.success = "true"; MailLocalService mailLocalService = new MailLocalService(); CacheManager <List <ActiveUp.Net.Common.DeltaExt.Action> > .set(CacheKeys.FOLDERS_ACTIONS, mailLocalService.GetFolderDestinationForAction()); } catch (Exception ex) { if (!ex.GetType().Equals(typeof(ManagedException))) { ManagedException mEx = new ManagedException("Eccezione nella lettura delle cartelle", "ERR_F005", string.Empty, ex.Message, null); ErrorLogInfo er = new ErrorLogInfo(mEx); er.objectID = idemail.ToString(); log.Error(er); model.success = "false"; model.message = mEx.Message; } else { model.success = "false"; model.message = ex.Message; } } return(this.Request.CreateResponse <FoldersSendersModel>(HttpStatusCode.OK, model)); }