Example #1
0
        public IActionResult Laithu([FromForm] LaiThuModel model)
        {
            var a = new MailGrid();

            a.Main("*****@*****.**", "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", model);
            return(View(model));
        }
Example #2
0
 protected void MailGrid_CustomJSProperties(object sender, ASPxGridViewClientJSPropertiesEventArgs e)
 {
     if (MailTree.SelectedNode.Name == "Inbox")
     {
         var list = new List <IMessage>();
         for (var i = 0; i < MailGrid.VisibleRowCount; i++)
         {
             if (MailGrid.IsGroupRow(i))
             {
                 continue;
             }
             var message = MailGrid.GetRow(i) as IMessage;
             if (message != null)
             {
                 list.Add(message);
             }
         }
         e.Properties["cpVisibleMailKeysHash"] = GetMessagesKeyMap(list);
     }
 }
Example #3
0
    void BindGrid()
    {
        MailGrid.DataSource = SelectMessages();

        MailGrid.DataBind();
    }
Example #4
0
    protected void MailGrid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        if (string.IsNullOrEmpty(e.Parameters))
        {
            return;
        }
        var args = e.Parameters.Split('|');

        if (args[0] == "FolderChanged")
        {
            MailGrid.FilterExpression = "";
            BindGrid();
            MailGrid.ExpandAll();
        }
        if (args[0] == "Search")
        {
            if (string.IsNullOrEmpty(SearchText))
            {
                MailGrid.FilterExpression = "";
            }
            CriteriaOperator criteria = new GroupOperator(GroupOperatorType.Or,
                                                          new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty(ShowToColumn() ? "To" : "From"), SearchText),
                                                          new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty("Subject"), SearchText)
                                                          );
            MailGrid.FilterExpression = criteria.ToString();

            BindGrid();
            MailGrid.ExpandAll();
        }
        if (args[0] == "SendMail" || args[0] == "SaveMail")
        {
            var    subject     = SubjectEditor.Text;
            var    to          = ToEditor.Text;
            string messageText = MailEditor.Html.Length <= 10000 ? MailEditor.Html : MailEditor.Html.Substring(0, 10000);
            string folder      = args[0] == "SendMail" ? "Sent Items" : "Drafts";
            int    id;
            if (args.Length == 2 && int.TryParse(args[1], out id))
            {
                MessageBL bl = new MessageBL();
                bl.UpdateMessage(id, subject, to, messageText, folder);
            }
            else
            {
                MessageBL bl      = new MessageBL();
                bool      IsReply = false;
                if (Session["CurrentReplyEmailID"] != null)
                {
                    IsReply = true;
                }
                bl.AddMessage(subject, User.Identity.Name, to, messageText, folder, IsReply);
            }

            Session["CurrentReplyEmailID"] = null;
            BindGrid();
        }
        if (args[0] == "Delete" && args.Length > 1)
        {
            int[] keys = null;
            if (!TryParseKeyValues(args.Skip(1), out keys))
            {
                return;
            }

            MessageBL bl = new MessageBL();

            bl.DeleteMessages(keys);
            BindGrid();
        }
    }