public int RegisterUser(BusinessModelUser user) { var owner = new MailUser() { Password = user.Password, Username = user.Username }; return(_data.InsertUser(owner)); }
public int RegisterUser(string name, string hashPassword) { var user = new MailUser { Password = hashPassword, Username = name }; return(_data.InsertUser(user)); }
protected override void WriteResult(ADObject result) { TaskLogger.LogEnter(new object[] { result.Identity }); MailUser result2 = new MailUser((ADUser)result); base.WriteResult(result2); TaskLogger.LogExit(); }
public void UpdateMailUser(MailUser mailUser) { try { mailUserRepository.Update(mailUser); } catch (Exception ex) { LogServerManager.AddErrLog(ErrLogType.DBErr, ex); } }
protected override void WriteResult() { TaskLogger.LogEnter(new object[] { this.DataObject.Id }); MailUser sendToPipeline = new MailUser(this.DataObject); base.WriteObject(sendToPipeline); TaskLogger.LogExit(); }
protected void Page_PreRender(object sender, EventArgs e) { if (WebMailClientManager.AccountIsValid()) { MailUser m = WebMailClientManager.getAccount(); hfCurrentFolder.Value = "1"; hfPFolder.Value = "I"; JsonCartella = createJsonCartella(m.IsManaged); JsonStatus = createJsonStatus(); } }
private string createJsonCartella(bool IsManaged) { StringBuilder stBuilder = new StringBuilder(); MailUser m = WebMailClientManager.getAccount(); string Nom = string.Empty; if (m == null) { return("[]"); } if (IsManaged) { List <Folder> Folders = m.Folders; stBuilder.Append("["); if (Folders != null && Folders.Count > 0) { for (int i = 0; i < Folders.Count; i++) { if (i > 0) { stBuilder.Append(","); } switch (Folders[i].TipoFolder) { case "I": Nom = string.Empty; break; case "O": Nom = string.Empty; break; case "E": case "A": case "D": Nom = " Archivio"; break; case "C": Nom = " Cestino"; break; } stBuilder.Append("['" + Folders[i].Id + "','" + Folders[i].Nome + Nom + "']"); } stBuilder.Append("]"); } else { return("[]"); } } return(stBuilder.ToString()); }
private static void PostMessage(MailUser user, string subject, string msg) { TRACE("PostMessage", "[" + ThreadName + " Posts " + MailBox.GetMailUserName(user) + ": " + MailBox.Limit(msg, 8) + "...]"); try { MailBox.Post(user, subject + ';' + msg); } catch (Exception e) { TRACE("PostMessage", "HANDELED EXCEPTION: could not post message. " + e.Message); } }
public IHttpActionResult CreateProjectStory(int projectId, UserStory model) { if (projectId != model.ProjectId) { return(NotFound()); } if (ModelState.IsValid) { var transaction = _repoFactory.BeginTransaction(); try { var newStoryId = _repoFactory.ProjectStories.CreateProjectStory(model, transaction); if (newStoryId.HasValue) { model.StoryId = newStoryId.Value; if (!string.IsNullOrWhiteSpace(model.SprintIds)) { var sprintIds = model.SprintIds.Split(','); foreach (var s in sprintIds) { if (int.TryParse(s, out var sprintId)) { _repoFactory.Sprints.AddStoryToSprint(sprintId, model.StoryId, transaction); } } } _repoFactory.CommitTransaction(); if (!string.IsNullOrWhiteSpace(model.AssignedToUserId) && !string.Equals(model.AssignedToUserId, UserId, System.StringComparison.OrdinalIgnoreCase)) { var receipientName = _cacheService.GetUserName(model.AssignedToUserId); if (!string.IsNullOrWhiteSpace(receipientName)) { var receipient = new MailUser(model.AssignedToUserId, receipientName); var actor = new MailUser(UserId, DisplayName); var userStoryLink = UrlFactory.GetUserStoryPageUrl(projectId, model.StoryId); _emailService.SendMail(receipient, Core.Enumerations.EmailType.UserStoryAssigned, actor, userStoryLink); } } return(Created($"/api/{projectId}/projectstories/{model.StoryId}", model)); } } catch (System.Exception ex) { _repoFactory.RollbackTransaction(); _logger.Error(ex, Request.RequestUri.ToString()); return(InternalServerError(ex)); } } return(BadRequest(ModelState)); }
//protected void ucPaging_Init(object sender, EventArgs e) //{ // this.ucPaging = sender as UCPaging; //} protected void BindDataViews(bool refresh) { if (WebMailClientManager.AccountIsValid()) { MailUser user = WebMailClientManager.getAccount(); this.Visible = true; } else { this.Visible = false; } }
public static void SetAccount(MailUser u) { MailUser m = (MailUser)HttpContext.Current.Session[SessionKeys.MAIL_ACCOUNT.ToString()]; if (m == null) { HttpContext.Current.Session.Add(SessionKeys.MAIL_ACCOUNT.ToString(), u); } else if (m != u) { HttpContext.Current.Session.Add(SessionKeys.MAIL_ACCOUNT.ToString(), u); } }
public Task SendPasswordResetMail(MailUser to, string resetLink) { var email = new Email() { To = new List <MailUser> { to }, Subject = "Matcha Password Reset", HTML = _mailTemplate.GetResetTemplate(resetLink) }; _logger.LogInformation("[MAIL] Email sent to \"{0}\" with Subject \"{1}\"", to.Email, email.Subject); return(SendMail(new Mailable(email))); }
public Task SendViewedMail(MailUser to, string viewedBy) { var email = new Email() { To = new List <MailUser> { to }, Subject = "Matcha Profile Viewed", HTML = _mailTemplate.GetViewedTemplate(to.Name, viewedBy) }; _logger.LogInformation("[MAIL] Email sent to \"{0}\" with Subject \"{1}\"", to.Email, email.Subject); return(SendMail(new Mailable(email))); }
public Task SendMessagedMail(MailUser to, string fromName, string messageSnippet) { var email = new Email() { To = new List <MailUser> { to }, Subject = "Matcha - New Message", HTML = _mailTemplate.GetMessagedTemplate(to.Name, fromName, messageSnippet) }; _logger.LogInformation("[MAIL] Email sent to \"{0}\" with Subject \"{1}\"", to.Email, email.Subject); return(SendMail(new Mailable(email))); }
public static int MsgCount(MailUser user) { switch (user) { case MailUser.MainThread: return(MainThreadMailbox.Count); case MailUser.WifiThread: return(WifiThreadMailbox.Count); default: throw new Exception("Unrecognized mail user"); } }
public int InsertUser(MailUser owner) { try { _context.GroupOwners.Add(owner); _context.SaveChanges(); return(owner.Id); } catch (Exception e) { _logger.LogError(e, "error", new string[0]); return(-1); } }
public static void AreEqual(MailUserEntity source, MailUser target, bool checkPassword = true) { Assert.AreEqual(source.Id, target.Id); Assert.AreEqual(source.Enabled, target.Enabled); Assert.AreEqual(source.LastLoginDateUtc, target.LastLoginDateUtc); Assert.AreEqual(source.CreationDateUtc, target.CreationDateUtc); Assert.AreEqual(source.Username, target.Username); Assert.AreEqual(source.DisplayName, target.DisplayName); if (checkPassword) { Assert.AreEqual(source.Password, target.Password); } }
public Task SendVerificationMail(MailUser to, string verifyLink) { var email = new Email() { To = new List <MailUser> { to }, Subject = "Matcha Account Verification", HTML = _mailTemplate.GetRegisterTemplate(verifyLink) }; _logger.LogInformation("[MAIL] Email sent to \"{0}\" with Subject \"{1}\"", to.Email, email.Subject); return(SendMail(new Mailable(email))); }
public void Update(MailUser u, Message entity) { using (OracleCommand oCmd = base.CurrentConnection.CreateCommand()) { oCmd.CommandText = cmdUpdateMessage; oCmd.BindByName = true; oCmd.Parameters.AddRange(MapToOracleUpdateParams(u, entity)); try { oCmd.ExecuteNonQuery(); } catch { } } }
public static bool AccountIsValid() { MailUser m = (MailUser)HttpContext.Current.Session[SessionKeys.MAIL_ACCOUNT.ToString()]; if (m == null) { return(false); } if (m.Validated) { return(true); } else { return(false); } }
//检查邮件用户,不存在就添加,存在如果名字有变化就更改 private void CheckMailUser(string userIP, string userName) { MailUser mailUser = mailServerManager.GetMailUsersByIP(userIP); if (mailUser == null) { mailUser = new MailUser(); mailUser.UserIP = userIP; mailUser.UserName = userName; mailServerManager.AddMailUser(mailUser); return; } if (mailUser.UserName != userName) { mailUser.UserName = userName; mailServerManager.UpdateMailUser(mailUser); return; } }
public MailServerService GetInstance(MailUser acs) { this._AccSettings = acs; this.IncomingConnect(); Connect conn = null; switch (acs.IncomingProtocol) { case "POP3": if (!String.IsNullOrEmpty(acs.IncomingServer)) { conn = this.Pop3.Connect; } break; case "IMAP": if (!String.IsNullOrEmpty(acs.IncomingServer)) { conn = this.Imap.Connect; } break; } if (!conn(_AccSettings)) { //TASK: Allineamento log - Ciro ManagedException mEx = new ManagedException( String.Format("Mail: non posso connettermi a {0} usando il protocollo {1}", _AccSettings.IncomingServer, _AccSettings.IncomingProtocol), "ERR_MAIL_0101", string.Empty, string.Empty, null); ErrorLogInfo err = new ErrorLogInfo(mEx); _log.Error(mEx); throw mEx; //throw new ManagedException(String.Format("Mail: non posso connettermi a {0} usando il protocollo {1}", _AccSettings.IncomingServer, _AccSettings.IncomingProtocol) // , "ERR_MAIL_0001", "MailServerFacade.cs", "MailServerFacade", "popController.Connect", "", "", null // ); } this.IncomingDisconnect(); return(this); }
public void FromCsv(Csv csv) { UserList.Clear(); foreach (CsvEntry?e in csv.Items) { if (e == null) { continue; } if (e.Count >= 4) { try { MailUser u = new MailUser(e); this.UserList.Add(u); } catch { } } else if (e.Count == 1) { try { string mail = e[0]; if (Str.CheckMailAddress(mail)) { MailUser u = new MailUser(mail, mail, "", "ja", new List <KeyValuePair <string, string> >()); this.UserList.Add(u); } } catch { } } } }
public static void AreEqual(MailUser source, MailUserEntity target) { if (source == null) { throw new ArgumentException("source object cannot be null"); } if (target == null) { throw new ArgumentException("target object cannot be null"); } Assert.AreEqual(source.Enabled, target.Enabled); Assert.AreEqual(source.CreationDateUtc, target.CreationDateUtc); Assert.AreEqual(source.DisplayName, target.DisplayName); Assert.AreEqual(source.Id, target.Id); Assert.AreEqual(source.LastLoginDateUtc, target.LastLoginDateUtc); Assert.AreEqual(source.Password, target.Password); Assert.AreEqual(source.Username, target.Username); }
private void checkedListBox_Contact_ItemCheck(object sender, ItemCheckEventArgs e) { ListItem item = checkedListBox_Contact.SelectedItem as ListItem; if (item == null) { return; } MailUser mailUser = mailUserList.Find(_ => _.MailUserID.ToString().Equals(item.ValueMember)); if (e.NewValue == CheckState.Checked) { ReceiverList.Add(mailUser); } else { ReceiverList.Remove(mailUser); } DisplayReceivers(); }
protected void Page_Load(object sender, EventArgs e) { MailUser mailuser = WebMailClientManager.getAccount(); if (!(WebMailClientManager.AccountIsValid())) { (this.Page as BasePage).info.AddMessage("Account non più valido. Ripetere la selezione della casella di posta", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.INFO); } if (Page.IsPostBack) { string test = HidHtml.Value; if (!(string.IsNullOrEmpty(test))) { SessionManager <string> .set(SessionKeys.TESTO_MAIL, test); } } else { SessionManager <string> .del(SessionKeys.TESTO_MAIL); } }
protected void odsMailConfig_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { MailUser mu = e.InputParameters[0] as MailUser; MailAccountService mailAccountService = new MailAccountService(); if (!IsValidEmailDesc(mu.EmailAddress)) { e.Cancel = true; info.AddMessage("Errore nel formato della mail", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); return; } try { mailAccountService.Insert(mu); this.IdSender_ViewState = mu.UserId; BackendUserService buservice = new BackendUserService(); _bUser = (BackendUser)buservice.GetByUserName(MySecurityProvider.CurrentPrincipal.MyIdentity.UserName); popolaGridElencoEmailsShared(); info.AddMessage("Operazione effettuata", Com.Delta.Messaging.MapperMessages.LivelloMessaggio.OK); } catch (Exception ex) { if (ex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException("Errore nell'inserimento della nuova configurazione mail", "CM009", string.Empty, string.Empty, ex.InnerException); ErrorLogInfo err = new ErrorLogInfo(mEx); err.loggingAppCode = "WEB_MAIL"; err.objectID = this.Context.Session.SessionID; log.Error(err); info.AddMessage(mEx.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } else { info.AddMessage(ex.Message, Com.Delta.Messaging.MapperMessages.LivelloMessaggio.ERROR); } } e.Cancel = true; }
public static void Post(MailUser recepient, string message) { switch (recepient) { case MailUser.MainThread: lock (MainThreadMailbox) { MainThreadMailbox.Enqueue((object)message); } break; case MailUser.WifiThread: lock (WifiThreadMailbox) { WifiThreadMailbox.Enqueue((object)message); } break; default: break; } }
internal static MAIL_INBOX MapToMailInBox(MailUser u, ActiveUp.Net.Mail.Message m) { MAIL_INBOX inbox = new MAIL_INBOX(); inbox.MAIL_FROM = m.From.ToString(); inbox.MAIL_TO = String.Join(";", m.To.Select(to => to.Email).ToArray()); inbox.MAIL_CC = (!string.IsNullOrEmpty(m.Cc.ToString())) ? String.Join(";", m.Cc.Select(cc => cc.Email).ToArray()) : string.Empty; inbox.MAIL_CCN = (!string.IsNullOrEmpty(m.Bcc.ToString())) ? String.Join(";", m.Bcc.Select(Bcc => Bcc.Email).ToArray()) : string.Empty; inbox.MAIL_SUBJECT = m.Subject; inbox.MAIL_TEXT = LinqExtensions.TryParseBody(m.BodyText); inbox.DATA_INVIO = m.ReceivedDate.ToLocalTime(); inbox.DATA_RICEZIONE = m.Date.ToLocalTime(); inbox.STATUS_SERVER = (String.IsNullOrEmpty(m.MessageId)) ? ((int)MailStatusServer.DA_NON_CANCELLARE).ToString() : ((int)MailStatusServer.PRESENTE).ToString(); inbox.STATUS_MAIL = (String.IsNullOrEmpty(m.MessageId)) ? ((int)MailStatus.SCARICATA_INCOMPLETA).ToString() : ((int)MailStatus.SCARICATA).ToString(); inbox.MAIL_FILE = System.Text.Encoding.GetEncoding("iso-8859-1").GetString(m.OriginalData); inbox.FLG_ATTACHMENTS = Convert.ToInt16(m.Attachments.Count > 0).ToString(); inbox.FOLDERID = String.IsNullOrEmpty(m.HeaderFields["X-Ricevuta"]) ? 1 : 3; inbox.FOLLOWS = LinqExtensions.TryParseFollows(m.HeaderFields); inbox.MSG_LENGTH = m.OriginalData.Length; inbox.FOLDERTIPO = "I"; inbox.FOLLOWS = LinqExtensions.TryParseFollows(m.HeaderFields); return(inbox); }
protected void btnLogin_Click(object sender, EventArgs e) { MailServerConfigFacade mailServerConfigFacade = MailServerConfigFacade.GetInstance(); MailServer m = mailServerConfigFacade.LoadServerConfigById(decimal.Parse(ddlServer.SelectedValue)); MailUser account = new MailUser(m); account.Password = txtPassword.Text; account.LoginId = txtName.Text; account.EmailAddress = txtName.Text; account.Dominus = hidDominus.Value; account.Casella = string.Empty; try { IList <MailUser> ctrlAccount = mailServerConfigFacade.GetUserByServerAndUsername(account.Id, account.LoginId); if (ctrlAccount != null) { if (ctrlAccount.Where(acc => acc.LoginId.Equals(account.LoginId) && (acc.Id == m.Id) && acc.IsManaged).Count() != 0) { ((BasePage)this.Page).info.AddError("Questo account è gestito applicativamente. Impossibile effetuare il login da applicazione"); return; } } SetAccount(account); OnStatusChanged(); } catch (ManagedException bex) { if (bex.GetType() != typeof(ManagedException)) { ManagedException mEx = new ManagedException(bex.Message, "ERR_G044", string.Empty, string.Empty, bex); ErrorLogInfo er = new ErrorLogInfo(mEx); log.Error(er); } ((BasePage)this.Page).info.AddError("Connessione al mail server impossibile, controllare le credenziali"); } }