protected void lbtnLogOff_Click(object sender, EventArgs e) { WebMailClientManager.AccountRemove(); ddlManagedAccounts.SelectedIndex = 0; ddlServer.SelectedIndex = 0; OnStatusChanged(); }
protected void ddlManagedAccounts_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl = sender as DropDownList; decimal userId = decimal.Parse(ddl.SelectedValue); MailServerConfigFacade mailSCF = MailServerConfigFacade.GetInstance(); if (userId != -1) { try { MailUser account = mailSCF.GetUserByUserId(userId); SetAccount(account); ddlManagedAccounts.SelectedIndex = 0; } catch { ((BasePage)this.Page).info.AddError("Connessione al mail server impossibile, controllare le credenziali"); } } else { WebMailClientManager.AccountRemove(); } OnStatusChanged(); }
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)); }
private void AccountInvalidated() { WebMailClientManager.AccountRemove(); WebMailClientManager.CurrentFolderRemove(); WebMailClientManager.CurrentMailRemove(); Inbox1.Initialize(); pnlLogin.Update(); pnlMail.Update(); pnlNav.Update(); this.info.AddMessage("Account non più valido. Ripetere la selezione della casella di posta", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.INFO); }
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)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MailComposer1_AccountInvalid(object sender, EventArgs e) { WebMailClientManager.AccountRemove(); this.Login.Visible = true; onAccountInvalid(sender, e); }