예제 #1
0
        // GET: DbMailTasks/Create
        public ActionResult Create()
        {
            ViewBag.RecipientCount = db.DbRecipients.Count();

            var mailTask = new DbMailTask();

            mailTask.Subject = "Test email from ASP.NET MVC";
            mailTask.IsAuthenticationRequired = false;

            var body = new StringBuilder();

            body.Append("This sample demonstrates how to pickup recipient from database and send emails from ASP.NET MVC with thread pool.\r\n");
            body.Append("Curren task id is: [$taskid]\r\n\r\n");
            body.Append("From: [$sender]\r\n");
            body.Append("To: [$rcpt]\r\n");
            body.Append("Subject: [$subject]\r\n\r\n");

            body.Append("Above sender, rcpt, subject values will be replaced by actual value based on each recipient.\r\n\r\n");
            body.Append("If no sever address was specified, the email will be delivered to the recipient's server directly.\r\n");
            body.Append("However, it is not recommended, because most email providers would reject your message due to anti-spam policy.\r\n");

            mailTask.TextBody = body.ToString();

            ViewBag.Port     = DropDownListData.PortList(mailTask.Port);
            ViewBag.Protocol = DropDownListData.ProtocolList(mailTask.Protocol);

            ViewBag.IsSyncSendSucceeded = false;
            ViewBag.SyncSendStatus      = string.Empty;

            return(View(mailTask));
        }
            public void Should_return_HTML_code_representing_a_DropDownList_with_its_value_embedded_in_it()
            {
                _dropDownListData = new DropDownListData(_items)
                    .WithValidationFrom(_propertyMetaData)
                    .WithId(_id)
                    .WithSelectedValue("Value2");

                _dropDownListData.ToString().ShouldBeEqualTo(_htmlText);
            }
            public void Should_return_a_GridData_With_the_newly_added_filter()
            {
                var kvpList = new List<KeyValuePair<string, string>>
                              {
                                  new KeyValuePair<string, string>("Name1", "Value2"),
                                  new KeyValuePair<string, string>("Name1", "Value2")
                              };

                var dropDownListData = new DropDownListData(kvpList);
                dropDownListData.SubmitOnChange();

                var grid = _gridData.WithFilter(dropDownListData);
                Assert.AreSame(_gridData, grid);
            }
 public void BeforeEachTest()
 {
     PropertyMetaData = PropertyMetaDataMocker.CreateStub("Name", false, null, null, null, null, typeof(string));
     DropDownListData = new DropDownListData(_items).WithValidationFrom(PropertyMetaData);
 }
            public void Should_add_hidden_control_with_the_selected_value()
            {
                var dropDownListData = new DropDownListData(_items)
                    .AsReadOnly()
                    .WithId(_id);

                var result = dropDownListData.ToString();
                result.ShouldBeEqualTo(_htmlText);
            }