当前位置: 首页>>代码示例>>C#>>正文


C# ILog.Close方法代码示例

本文整理汇总了C#中ILog.Close方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.Close方法的具体用法?C# ILog.Close怎么用?C# ILog.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILog的用法示例。


在下文中一共展示了ILog.Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main


//.........这里部分代码省略.........
                string subject;
                if (request.cc.UserName.Equals(request.rw.UserName, StringComparison.InvariantCultureIgnoreCase))
                {
                    subject = templates.CreateMailSubject(MailTemplates.MailType.Response, request.cc.CL,
                        request.cc.UserName, Abbreviate(request.cc.Description, MaxDescriptionLength), null);

                    isBodyHtml = templates.IsTemplateHtml(MailTemplates.MailType.Response);

                    ListCommentsForReview(context, request.rw, comments, isBodyHtml, malevichUrl);

                    body = templates.CreateMail(MailTemplates.MailType.Response, request.cc.Id, null,
                        ResolveFriendlyName(Config, request.rw.UserName), Config.WebServer,
                        sourceControlRoots[request.cc.SourceControlId], null,
                        comments.ToString(), request.cc.CL);
                }
                else
                {
                    string verdict = ReviewStatusToSentence(request.rw.OverallStatus);

                    subject = templates.CreateMailSubject(MailTemplates.MailType.Iteration, request.cc.CL,
                        request.cc.UserName, Abbreviate(request.cc.Description, MaxDescriptionLength), verdict);

                    isBodyHtml = templates.IsTemplateHtml(MailTemplates.MailType.Iteration);

                    ListCommentsForReview(context, request.rw, comments, isBodyHtml, malevichUrl);

                    body = templates.CreateMail(MailTemplates.MailType.Iteration, request.cc.Id,
                        ResolveFriendlyName(Config, request.rw.UserName), ResolveFriendlyName(Config, request.cc.UserName),
                        Config.WebServer, sourceControlRoots[request.cc.SourceControlId],
                        verdict, comments.ToString(), request.cc.CL);
                }

                try
                {
                    if (exchangeItems != null)
                        exchangeItems.Add(MakeExchangeMessage(to, cc, from, replyToAlias, subject, body.ToString(),
                            isBodyHtml, request.cc.Id, false));

                    if (smtpItems != null)
                        smtpItems.Add(MakeSmtpMessage(to, cc, from, replyToAlias, sender, subject, body.ToString(),
                            isBodyHtml, request.cc.Id, false));
                }
                catch (FormatException)
                {
                    logger.Log("Could not send email - invalid email format!");
                }

                context.MailReviews.DeleteOnSubmit(request.mr);
            }

            if (remindDaysOld > 0)
            {
                DateTime threshold = DateTime.Now.AddDays(-remindDaysOld);
                var oldChangeListQuery = from rr in context.ChangeLists
                                         where rr.Stage == 0 && rr.TimeStamp < threshold
                                         select rr;

                foreach (ChangeList cl in oldChangeListQuery)
                {
                    logger.Log("Sending review reminder for {0}", cl.CL);

                    string subject = templates.CreateMailSubject(MailTemplates.MailType.Reminder, cl.CL, cl.UserName,
                        Abbreviate(cl.Description, MaxDescriptionLength), null);
                    string email = ResolveUser(Config, cl.UserName);
                    string sender = ResolveUser(Config, Config.User);
                    string from = Config.FromEmail == null ? null : Config.FromEmail + "@" + Config.EmailDomain;
                    bool isBodyHtml;
                    string body = templates.CreateMail(MailTemplates.MailType.Reminder, cl.Id,
                        null, ResolveFriendlyName(Config, cl.UserName), Config.WebServer,
                        sourceControlRoots[cl.SourceControlId],
                        null, cl.Description, cl.CL, out isBodyHtml);

                    try
                    {
                        if (exchangeItems != null)
                            exchangeItems.Add(MakeExchangeMessage(email, from, null, subject, body, isBodyHtml,
                                cl.Id, false));

                        if (smtpItems != null)
                            smtpItems.Add(MakeSmtpMessage(email, from, null, sender, subject, body, isBodyHtml,
                                cl.Id, false));
                    }
                    catch (FormatException)
                    {
                        logger.Log("Could not send email - invalid email format!");
                    }
                }
            }

            if (exchangeItems != null && exchangeItems.Count() > 0)
                SendExchangeMail(Config, exchangeItems);
            if (smtpItems != null && smtpItems.Count() > 0)
                SendSmtpMail(Config, smtpItems);

            context.SubmitChanges();

            logger.Log("Finished processing review mail @ {0}", DateTime.Now);

            logger.Close();
        }
开发者ID:daptiv,项目名称:Malevich,代码行数:101,代码来源:Program.cs


注:本文中的ILog.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。