예제 #1
0
        public override MvcHtmlString Html(HtmlHelper htmlHelper, string name, object value)
        {
            var htmlAttributes = GetHtmlAttributes();
            var result         = "";

            if (!Readonly)
            {
                if (htmlHelper.ViewData["hasDataBoxJs"] == null)
                {
                    var configMapper = PFDataHelper.GetConfigMapper();
                    var pathConfig   = configMapper.GetPathConfig();
                    result = string.Format("<script language='javascript' type='text/javascript' src='/{0}'></script>", pathConfig.DataBoxJsPath);
                    htmlHelper.ViewData["hasDataBoxJs"] = true;
                }
            }
            return(new MvcHtmlString(result + htmlHelper.TextBox(name, PFDataHelper.ObjectToDateString(value, _format), htmlAttributes).ToString()));
        }
예제 #2
0
        //[TestMethod]
        //public void TestSendEmailAsync() {
        //    string producerEmailTitle = "PFEmailMq_producer_"+ "会员资料表";//中文有问题--benjamin todo
        //    //string producerEmailTitle = "PFEmailMq_producer_" + "hyzl";
        //    //消费方(使用系统邮箱)
        //    string result = "";
        //    bool success = false;
        //    var consumerTask = new PFListenEmailTask("TestForceUpdateHyzl",
        //    new PFEmailManager(PFDataHelper.SysEmailHostName, PFDataHelper.SysEmailUserName, PFDataHelper.SysEmailPwd),
        //    email =>
        //    {
        //        result = "{success:true}";

        //        //消费方回复邮件
        //        PFDataHelper.SendEmail(PFDataHelper.SysEmailUserName, PFDataHelper.SysEmailPwd, PFDataHelper.SysEmailHostName,
        //            new string[] { UserEmailUserName }, "PFEmailMq_consumer_" + email.Subject,
        //            result);
        //    },
        //    (email//, task
        //    ) =>
        //    {
        //       //消费方监听生产方邮件
        //       //return email.Subject != null && email.Subject.IndexOf("TestForceUpdateHyzl_") == 0;//这里不要用>-1,否则可能把自动回复的邮件也当作是了
        //       return email.Subject== producerEmailTitle;
        //    });
        //    consumerTask.Start();

        //    //生产方(使用User邮箱,也可以用系统邮箱吧)
        //    var rt=PFDataHelper.SendEmailAsync(UserEmailUserName, UserEmailPwd, UserEmailHostName,
        //        new string[] { PFDataHelper.SysEmailUserName },
        //        producerEmailTitle, "会员资料表");
        //    rt.Wait();
        //    var resultTitle = rt.Result.Subject;
        //    Assert.IsTrue(resultTitle== "PFEmailMq_consumer_" + producerEmailTitle);
        //}
        private String GetDateString()
        {
            return(PFDataHelper.ObjectToDateString(DateTime.Now, PFDataHelper.DateFormat));
        }