/// <summary> /// Handles post moderation events/buttons. /// </summary> private void List_ItemCommand(object sender, RepeaterCommandEventArgs e) { // which command are we handling switch (e.CommandName.ToLower()) { case "approve": // approve post DB.message_approve(e.CommandArgument); // re-bind data BindData(); // tell user message was approved PageContext.AddLoadMessage(GetText("APPROVED")); // create subscriptions for topic CreateMail.CreateWatchEmail(e.CommandArgument); break; case "delete": // delete message DB.message_delete(e.CommandArgument, true, "", 1, true); // re-bind data BindData(); // tell user message was deleted PageContext.AddLoadMessage(GetText("DELETED")); break; } // see if there are any items left... DataTable dt = DB.message_unapproved(PageContext.PageForumID); if (dt.Rows.Count == 0) { // nope -- redirect back to the moderate main... YafBuildLink.Redirect(ForumPages.moderate_index); } }
private void SearchBindData(bool newSearch) { try { if (newSearch && !CheckSearchRequest()) { return; } else if (newSearch || Mession.SearchData == null) { SearchWhatFlags sw = (SearchWhatFlags)System.Enum.Parse(typeof(SearchWhatFlags), listSearchWhat.SelectedValue); SearchWhatFlags sfw = (SearchWhatFlags)System.Enum.Parse(typeof(SearchWhatFlags), listSearchFromWho.SelectedValue); int forumID = int.Parse(listForum.SelectedValue); DataTable searchDataTable = YAF.Classes.Data.DB.GetSearchResult(txtSearchStringWhat.Text, txtSearchStringFromWho.Text, sfw, sw, forumID, PageContext.PageUserID, PageContext.PageBoardID, PageContext.BoardSettings.ReturnSearchMax, PageContext.BoardSettings.UseFullTextSearch); Pager.CurrentPageIndex = 0; Pager.PageSize = int.Parse(listResInPage.SelectedValue); Pager.Count = searchDataTable.DefaultView.Count; Mession.SearchData = searchDataTable; bool bResults = (searchDataTable.DefaultView.Count > 0) ? true : false; SearchRes.Visible = bResults; NoResults.Visible = !bResults; } PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; pds.DataSource = Mession.SearchData.DefaultView; pds.PageSize = Pager.PageSize; pds.CurrentPageIndex = Pager.CurrentPageIndex; UpdateHistory.AddEntry(Pager.CurrentPageIndex.ToString() + "|" + Pager.PageSize); SearchRes.DataSource = pds; SearchRes.DataBind(); } catch (Exception x) { YAF.Classes.Data.DB.eventlog_create(PageContext.PageUserID, this, x); CreateMail.CreateLogEmail(x); if (PageContext.IsAdmin) { PageContext.AddLoadMessage(string.Format("{0}", x)); } else { PageContext.AddLoadMessage("An error occured while searching."); } } }
public OperationResult Create(CreateMail entity) { try { const string source = "*****@*****.**"; var mail = new Mail(entity.Destination, entity.Subject, entity.Message, source); _mailRepository.Create(mail); _mailRepository.SaveChanges(); return(_operation.But(Tables.MailTableName).Succeeded(MailMessages.Success)); } catch (Exception exception) { Console.WriteLine(exception); return(_operation.Failed(MailMessages.Failed)); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.User.Identity.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { createEmail = new CreateMail(); GoogleMailService.initService(); radio_service_stpm.Checked = true; if (!IsPostBack && !IsCallback) { cmbCampaign.SelectedIndex = 0; cmbEmailOwn.SelectedIndex = 1; } } }
public void Load_mails() { var fixture = new CreateMail { IsSpecial = true, }; Fixture(fixture); var command = new UpdateCommand(); Run(command); var mails = localSession.Load <Mail>(fixture.Mail.Id); var attachment = mails.Attachments[0]; var open = command.Results.OfType <OpenResult>().First(); Assert.IsTrue(attachment.IsDownloaded); Assert.IsTrue(File.Exists(attachment.LocalFilename), attachment.LocalFilename); Assert.That(attachment.LocalFilename, Is.StringEnding($@"attachments\{attachment.Id}.txt")); Assert.AreEqual(Path.GetFullPath(open.Filename), attachment.LocalFilename); session.Refresh(fixture.Log); Assert.IsTrue(fixture.Log.Committed); }
/// <summary> /// Handles the PostReply click including: Replying, Editing and New post. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void PostReply_Click(object sender, System.EventArgs e) { if (!IsPostReplyVerified()) { return; } if (IsPostReplyDelay()) { return; } // update the last post time... Mession.LastPost = DateTime.Now.AddSeconds(30); long nMessageID = 0; if (TopicID != null) // Reply to topic { nMessageID = PostReplyHandleReplyToTopic(); } else if (EditTopicID != null) // Edit existing post { nMessageID = PostReplyHandleEditPost(); } else // New post { nMessageID = PostReplyHandleNewPost(); } // Check if message is approved bool bApproved = false; using (DataTable dt = DB.message_list(nMessageID)) foreach (DataRow row in dt.Rows) { bApproved = General.BinaryAnd(row["Flags"], MessageFlags.Flags.IsApproved); } // Create notification emails if (bApproved) { CreateMail.CreateWatchEmail(nMessageID); if (PageContext.ForumUploadAccess && TopicAttach.Checked) { // redirect to the attachment page... YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.attachments, "m={0}", nMessageID); } else { // regular redirect... YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.posts, "m={0}&#post{0}", nMessageID); } } else { // Tell user that his message will have to be approved by a moderator //PageContext.AddLoadMessage("Since you posted to a moderated forum, a forum moderator must approve your post before it will become visible."); string url = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.topics, "f={0}", PageContext.PageForumID); if (YAF.Classes.Config.IsRainbow) { YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.info, "i=1"); } else { YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.info, "i=1&url={0}", Server.UrlEncode(url)); } } }
public OperationResult Post(CreateMail command) { return(_mailApplication.Create(command)); }
private void QuickReply_Click(object sender, EventArgs e) { if (!PageContext.ForumReplyAccess || (_topicFlags.IsLocked && !PageContext.ForumModeratorAccess)) { YafBuildLink.AccessDenied(); } if (_quickReplyEditor.Text.Length <= 0) { PageContext.AddLoadMessage(GetText("EMPTY_MESSAGE")); return; } if (( (PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests) || (PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded) ) && Session["CaptchaImageText"].ToString() != tbCaptcha.Text.Trim()) { PageContext.AddLoadMessage(GetText("BAD_CAPTCHA")); return; } if (!(PageContext.IsAdmin || PageContext.IsModerator) && PageContext.BoardSettings.PostFloodDelay > 0) { if (Mession.LastPost > DateTime.Now.AddSeconds(-PageContext.BoardSettings.PostFloodDelay)) { PageContext.AddLoadMessage(String.Format(GetText("wait"), (Mession.LastPost - DateTime.Now.AddSeconds(-PageContext.BoardSettings.PostFloodDelay)).Seconds)); return; } } Mession.LastPost = DateTime.Now; // post message... long TopicID; long nMessageID = 0; object replyTo = -1; string msg = _quickReplyEditor.Text; TopicID = PageContext.PageTopicID; MessageFlags tFlags = new MessageFlags(); tFlags.IsHtml = _quickReplyEditor.UsesHTML; tFlags.IsBBCode = _quickReplyEditor.UsesBBCode; // Bypass Approval if Admin or Moderator. tFlags.IsApproved = (PageContext.IsAdmin || PageContext.IsModerator); if (!YAF.Classes.Data.DB.message_save(TopicID, PageContext.PageUserID, msg, null, Request.UserHostAddress, null, replyTo, tFlags.BitValue, ref nMessageID)) { TopicID = 0; } bool bApproved = false; using (DataTable dt = YAF.Classes.Data.DB.message_list(nMessageID)) foreach (DataRow row in dt.Rows) { bApproved = (( int )row ["Flags"] & 16) == 16; } if (bApproved) { // Ederon : 7/26/2007 // send new post notification to users watching this topic/forum CreateMail.CreateWatchEmail(nMessageID); // redirect to newly posted message YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.posts, "m={0}&#post{0}", nMessageID); } else { string url = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.topics, "f={0}", PageContext.PageForumID); if (YAF.Classes.Config.IsRainbow) { YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.info, "i=1"); } else { YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.info, "i=1&url={0}", Server.UrlEncode(url)); } } }
protected void Page_Load(object sender, EventArgs e) { createEmail = new CreateMail(); GoogleMailService.initService(); radio_service_stpm.Checked = true; }