亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? issuenotification.cs

?? BugNET is an issue tracking and project issue management solution built using the ASP.NET web applic
?? CS
字號:
using System;
using System.Text;
using System.Web;
using System.Xml;
using System.Xml.Xsl;
using System.IO;
using System.Collections;
using Lesnikowski.Client;
using Lesnikowski.Mail;
using BugNET.POP3Reader;
using BugNET.DataAccessLayer;
using BugNET.BusinessLogicLayer;
using System.Net.Mail;
using System.Net;
using log4net;
using System.Collections.Generic;
using System.Web.Security;

namespace BugNET.BusinessLogicLayer
{
	/// <summary>
	/// Summary description for Notification.
	/// </summary>
	public class IssueNotification
	{
		private int _IssueId;
		private int _Id;
		private string _NotificationUsername;
		private string _NotificationEmail;
        private string _NotificationDisplayName;
        private static readonly ILog Log = LogManager.GetLogger(typeof(IssueNotification));

        /// <summary>
        /// Initializes a new instance of the <see cref="T:IssueNotification"/> class.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="issueId">The bug id.</param>
        /// <param name="notificationUsername">The notification username.</param>
        /// <param name="notificationEmail">The notification email.</param>
		public IssueNotification(int id,int issueId, string notificationUsername,string notificationEmail, string notificationDisplayName)
		{
			_Id = id;
			_IssueId = issueId;
			_NotificationUsername = notificationUsername;
			_NotificationEmail =notificationEmail;
            _NotificationDisplayName = notificationDisplayName;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:IssueNotification"/> class.
        /// </summary>
        /// <param name="issueId">The bug id.</param>
        /// <param name="notificationUsername">The notification username.</param>
		public IssueNotification(int issueId,string notificationUsername) : 
			this(Globals.NewId,issueId,notificationUsername,string.Empty,string.Empty){}

        /// <summary>
        /// Initializes a new instance of the <see cref="T:IssueNotification"/> class.
        /// </summary>
		public IssueNotification(){}

        /// <summary>
        /// Gets or sets the display name of the notification.
        /// </summary>
        /// <value>The display name of the notification.</value>
        public string NotificationDisplayName 
        {
            get { return _NotificationDisplayName; }
            set { _NotificationDisplayName = value; }
        }

        /// <summary>
        /// Gets the id.
        /// </summary>
        /// <value>The id.</value>
		public int Id 
		{
			get {return _Id;}
		}

        /// <summary>
        /// Gets or sets the issue id.
        /// </summary>
        /// <value>The issue id.</value>
		public int IssueId 
		{
			get {return _IssueId; }
			set
			{
				if (value<= DefaultValues.GetIssueIdMinValue() )
					throw (new ArgumentOutOfRangeException("value"));
				_IssueId=value;
			}
		}

        /// <summary>
        /// Gets the notification username.
        /// </summary>
        /// <value>The notification username.</value>
		public string NotificationUsername 
		{
			get 
			{
				if (_NotificationUsername == null || _NotificationUsername.Length==0)
					return string.Empty;
				else
					return _NotificationUsername;
			}
		}

        /// <summary>
        /// Gets the notification email.
        /// </summary>
        /// <value>The notification email.</value>
		public string NotificationEmail 
		{
			get 
			{
				if (_NotificationEmail == null || _NotificationEmail.Length==0)
					return string.Empty;
				else
					return _NotificationEmail;
			}
		}

        /// <summary>
        /// Notifcate Type
        /// </summary>
		public enum NotificationType
		{
            /// <summary>
            /// Bug update email
            /// </summary>
			BugUpdate = 1,
            /// <summary>
            /// Assigned to new user email
            /// </summary>
			BugAssignedToNewUser,
            /// <summary>
            /// New user registered email
            /// </summary>
			NewUserRegistered
		}

        /// <summary>
        /// Saves this instance.
        /// </summary>
        /// <returns></returns>
		public bool Save () 
		{
            int TempId = DataProviderManager.Provider.CreateNewIssueNotification(this);
			if (TempId>0) 
			{
				_Id = TempId;
				return true;
			} 
			else
				return false;
		}
        /// <summary>
        /// Deletes the bug notification.
        /// </summary>
        /// <param name="issueId">The bug id.</param>
        /// <param name="username">The username.</param>
        /// <returns></returns>
		public static bool DeleteIssueNotification(int issueId, string username) 
		{
			if (issueId <= Globals.NewId )
				throw (new ArgumentOutOfRangeException("issueId"));

			return DataProviderManager.Provider.DeleteIssueNotification(issueId, username);
		}

        /// <summary>
        /// Gets the bug notifications by bug id.
        /// </summary>
        /// <param name="issueId">The bug id.</param>
        /// <returns></returns>
		public static List<IssueNotification> GetIssueNotificationsByIssueId(int issueId)
		{
			if (issueId <= Globals.NewId)
				throw (new ArgumentOutOfRangeException("issueId"));

			return DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId);
		}

        /// <summary>
        /// Sends an email to all users that are subscribed to a bug
        /// </summary>
        /// <param name="issueId">The bug id.</param>
		public static void SendIssueNotifications(int issueId) 
		{
			if (issueId <= Globals.NewId)
				throw (new ArgumentOutOfRangeException("issueId"));

			Issue issue = DataProviderManager.Provider.GetIssueById(issueId);
            List<IssueNotification> issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId);
       
            //load plugins 
            NotificationManager nm = new NotificationManager();
            nm.LoadNotificationTypes();

            //load template and replace the tokens
            string template = nm.LoadNotificationTemplate("IssueUpdated"); 
            nm.ReplaceTokens(ref template,issue);
            string subject = nm.LoadNotificationTemplate("IssueUpdatedSubject"); 
            string displayname = ITUser.GetUserDisplayName(Security.GetUserName());
           
			foreach (IssueNotification notify in issNotifications) 
			{
				try 
				{
                    //send notifications to everyone except who changed it.
                    if (notify.NotificationUsername != Security.GetUserName())
                    {                     
                        nm.SendNotification(notify.NotificationUsername, String.Format(subject, issue.FullId, displayname),template);
                    }
				} 
				catch(Exception ex)
				{
                    ProcessException(ex);
				}
			}
		}

        /// <summary>
        /// Sends the issue add notifications.
        /// </summary>
        /// <param name="issueId">The issue id.</param>
        public static void SendIssueAddNotifications(int issueId)
        {
            // validate input
            if (issueId <= Globals.NewId)
                throw (new ArgumentOutOfRangeException("issueId"));

            Issue issue = DataProviderManager.Provider.GetIssueById(issueId);
            List<IssueNotification> issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId);

            NotificationManager nm = new NotificationManager();
            nm.LoadNotificationTypes();

            //load template and replace the tokens
            string template = nm.LoadNotificationTemplate("IssueAdded");
            nm.ReplaceTokens(ref template, issue,null, null);
            string subject = nm.LoadNotificationTemplate("IssueAddedSubject"); 
            string displayname = ITUser.GetUserDisplayName(Security.GetUserName());
            

            foreach (IssueNotification notify in issNotifications)
            {
                try
                {
                    //send notifications to everyone except who changed it.
                    if (notify.NotificationUsername != Security.GetUserName())
                    {
                        nm.SendNotification(notify.NotificationUsername, String.Format(subject, issue.FullId, displayname), template);
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
        }


        /// <summary>
        /// Sends the issue notifications.
        /// </summary>
        /// <param name="issueId">The issue id.</param>
        /// <param name="issueChanges">The issue changes.</param>
        public static void SendIssueNotifications(int issueId, string issueChanges)
        {
            // validate input
            if (issueId <= Globals.NewId)
                throw (new ArgumentOutOfRangeException("issueId"));

            Issue issue = DataProviderManager.Provider.GetIssueById(issueId);
            List<IssueNotification> issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId);

            //load notification plugins 
            NotificationManager nm = new NotificationManager();
            nm.LoadNotificationTypes();

            //load template and replace the tokens
            string template = nm.LoadNotificationTemplate("IssueUpdatedWithChanges");
            nm.ReplaceTokens(ref template, issue);
            string subject = nm.LoadNotificationTemplate("IssueUpdatedSubject"); 
            string displayname = ITUser.GetUserDisplayName(Security.GetUserName());
         

            foreach (IssueNotification notify in issNotifications)
            {
                try
                {
                    //send notifications to everyone except who changed it.
                    if (notify.NotificationUsername != Security.GetUserName())
                    {
                        nm.SendNotification(notify.NotificationUsername, String.Format(subject, issue.FullId, displayname), String.Format(template, issueChanges));
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
        }

        /// <summary>
        /// Sends an email to the user that is assigned to the issue
        /// </summary>
        /// <param name="issueId">The issue id.</param>
        /// <param name="newAssigneeUserName">New name of the assignee user.</param>
		public static void SendNewAssigneeNotification(int issueId, string newAssigneeUserName)
		{
			if (issueId <= Globals.NewId)
				throw (new ArgumentOutOfRangeException("issueId"));

            Issue issue = DataProviderManager.Provider.GetIssueById(issueId);
            List<IssueNotification> issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId);

            //load notification plugins 
            NotificationManager nm = new NotificationManager();
            nm.LoadNotificationTypes();

            //load template and replace the tokens
            string template = nm.LoadNotificationTemplate("NewAssignee");
            nm.ReplaceTokens(ref template, issue);
            string subject = nm.LoadNotificationTemplate("NewAssigneeSubject"); 
            string displayname = ITUser.GetUserDisplayName(Security.GetUserName());
           

            foreach (IssueNotification notify in issNotifications)
            {
                try
                {
                    //send notifications to everyone except who changed it.
                    if (notify.NotificationUsername != Security.GetUserName())
                    {
                        nm.SendNotification(notify.NotificationUsername, String.Format(subject, issue.FullId), template);
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
		}

        /// <summary>
        /// Sends the new issue comment notification.
        /// </summary>
        /// <param name="issueId">The issue id.</param>
        /// <param name="newComment">The new comment.</param>
        public static void SendNewIssueCommentNotification(int issueId, IssueComment newComment)
        {
            if (issueId <= Globals.NewId)
                throw (new ArgumentOutOfRangeException("issueId"));
            if (newComment == null)
                throw new ArgumentNullException("newComment");

            Issue issue = DataProviderManager.Provider.GetIssueById(issueId);
            List<IssueNotification> issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId);

            //load notification plugins 
            NotificationManager nm = new NotificationManager();
            nm.LoadNotificationTypes();

            //load template and replace the tokens
            string template = nm.LoadNotificationTemplate("NewIssueComment");
            nm.ReplaceTokens(ref template, newComment);
            string subject = nm.LoadNotificationTemplate("NewIssueCommentSubject");  
            string displayname = ITUser.GetUserDisplayName(Security.GetUserName());
            

            foreach (IssueNotification notify in issNotifications)
            {
                try
                {
                    //send notifications to everyone except who changed it.
                   //{
                        nm.SendNotification(notify.NotificationUsername, String.Format(subject, issue.FullId,displayname), template);
                   // }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
        }

        
         

        /// <summary>
        /// Processes the exception by logging and throwing a wrapper exception with non-sensitive data.
        /// </summary>
        /// <param name="ex">The ex.</param>
        /// <returns>New exception to wrap the thrown one.</returns>
        private static ApplicationException ProcessException(Exception ex)
        {
            //set user to log4net context, so we can use %X{user} in the appenders
            if (HttpContext.Current != null && HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
                MDC.Set("user", HttpContext.Current.User.Identity.Name);

            if (Log.IsErrorEnabled)
                Log.Error("Email Notification Error", ex);

            return new ApplicationException("An error has occured sending notifications. Please check the error log for details.", ex);
        }
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品麻豆99久久久久久| 3751色影院一区二区三区| 久久影视一区二区| 久久69国产一区二区蜜臀| 亚洲精品在线免费观看视频| 久久99国产精品成人| 久久久精品蜜桃| 大白屁股一区二区视频| 成人欧美一区二区三区小说| 色噜噜狠狠色综合欧洲selulu| 亚洲婷婷综合色高清在线| 91免费国产视频网站| 亚洲一区二区欧美日韩| 在线电影国产精品| 极品少妇xxxx精品少妇| 国产精品嫩草99a| 色爱区综合激月婷婷| 日韩激情视频在线观看| 精品日韩一区二区三区| 99视频超级精品| 亚洲va韩国va欧美va| 精品少妇一区二区三区日产乱码| 97aⅴ精品视频一二三区| 亚洲黄色av一区| 日韩一二在线观看| 成人午夜视频免费看| 亚洲欧美福利一区二区| 91精品婷婷国产综合久久| 国产精品亚洲一区二区三区在线 | 欧美中文字幕一区二区三区亚洲 | 日韩影院在线观看| 久久综合中文字幕| 欧洲一区二区三区免费视频| 精品影院一区二区久久久| 日韩一区在线免费观看| 欧美va在线播放| 99re8在线精品视频免费播放| 天天综合天天做天天综合| 日本一区二区三区视频视频| 在线成人免费观看| www.色精品| 国内一区二区在线| 一区二区三区国产精华| 久久亚洲私人国产精品va媚药| 91成人在线精品| 国产黄色精品网站| 日本午夜一本久久久综合| 亚洲欧洲三级电影| 精品国产乱码久久久久久图片 | 在线观看区一区二| 国产成人一级电影| 免费成人在线播放| 亚洲国产精品视频| 亚洲欧美日本韩国| 亚洲国产高清在线| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 六月婷婷色综合| 亚洲五月六月丁香激情| 国产精品第13页| 久久久久久麻豆| 精品粉嫩超白一线天av| 欧美二区三区的天堂| 欧美亚洲动漫另类| 91亚洲精品乱码久久久久久蜜桃| 国产中文字幕一区| 九一久久久久久| 青青草91视频| 日本免费新一区视频| 亚洲成av人影院| 亚洲福利电影网| 一区二区三区在线播放| 亚洲你懂的在线视频| 亚洲欧洲在线观看av| 成人欧美一区二区三区视频网页 | 丰满少妇久久久久久久| 国产一区二区免费视频| 精彩视频一区二区三区| 美国欧美日韩国产在线播放| 免费精品99久久国产综合精品| 五月天中文字幕一区二区| 亚洲高清在线精品| 亚洲制服欧美中文字幕中文字幕| 尤物av一区二区| 亚洲午夜激情网页| 午夜精品一区二区三区三上悠亚| 亚洲国产成人av好男人在线观看| 亚洲一区欧美一区| 五月天中文字幕一区二区| 午夜成人在线视频| 蜜臀99久久精品久久久久久软件 | 一区二区在线免费| 亚洲综合一区二区三区| 亚洲国产欧美另类丝袜| 亚洲成精国产精品女| 日韩二区三区四区| 国产一区二区视频在线播放| 丁香激情综合国产| 色视频一区二区| 欧美高清dvd| 久久久久久久久伊人| 国产精品乱人伦| 亚洲一级二级三级| 美女尤物国产一区| 国产麻豆精品在线观看| 不卡高清视频专区| 欧美喷水一区二区| 久久日韩精品一区二区五区| 国产精品毛片a∨一区二区三区| 亚洲黄色免费电影| 免费高清在线一区| 99久久综合99久久综合网站| 欧美日韩一本到| 精品国产乱码久久久久久浪潮 | 在线免费一区三区| 91精品国产aⅴ一区二区| 久久久精品黄色| 亚洲一区二区三区自拍| 人人超碰91尤物精品国产| 成人教育av在线| 欧美日本在线一区| 国产精品视频看| av一本久道久久综合久久鬼色| 欧美丝袜丝交足nylons图片| 精品国产凹凸成av人网站| 综合在线观看色| 久久狠狠亚洲综合| 在线亚洲欧美专区二区| 精品国产凹凸成av人网站| 亚洲精品国产无天堂网2021 | 国产综合久久久久久鬼色| 色妞www精品视频| 久久精品一区二区三区四区| 亚洲国产aⅴ天堂久久| 高清久久久久久| 日韩一区二区免费在线电影 | 国产日韩在线不卡| 日韩精品乱码免费| 成人高清免费观看| 欧美成人精精品一区二区频| 亚洲成人一二三| 99久久精品国产麻豆演员表| 欧美成人高清电影在线| 亚洲国产日韩在线一区模特| 国产成人啪免费观看软件| 日韩亚洲欧美中文三级| 亚洲一区二三区| 91丨porny丨蝌蚪视频| 久久嫩草精品久久久精品一| 午夜欧美大尺度福利影院在线看| 91蜜桃传媒精品久久久一区二区| 久久久精品免费网站| 久久电影网电视剧免费观看| 欧美老肥妇做.爰bbww视频| 中文字幕字幕中文在线中不卡视频| 久久成人精品无人区| 在线综合+亚洲+欧美中文字幕| 亚洲欧美视频在线观看视频| 成人国产电影网| 国产精品乱码一区二三区小蝌蚪| 国产呦精品一区二区三区网站| 欧美一级免费观看| 男人的天堂久久精品| 欧美日韩国产高清一区| 亚洲激情第一区| 色网综合在线观看| 亚洲久草在线视频| 91视视频在线观看入口直接观看www | 欧美在线视频你懂得| 亚洲激情第一区| 在线观看国产一区二区| 一区二区三区日韩欧美| 在线精品视频一区二区| 一区二区三区自拍| 欧美亚洲免费在线一区| 亚洲成av人片| 91精品国产综合久久精品| 日韩中文字幕亚洲一区二区va在线| 欧美日韩激情在线| 婷婷丁香激情综合| 日韩精品一区二区在线| 国产在线观看一区二区| 亚洲国产精品激情在线观看| 成人99免费视频| 一区二区三区美女| 欧美视频一二三区| 美国三级日本三级久久99| 久久奇米777| 成人激情免费电影网址| 玉米视频成人免费看| 欧美一区二区三区视频在线观看 | 亚洲国产精品人人做人人爽| 这里只有精品电影| 国产在线精品一区在线观看麻豆| 久久久高清一区二区三区| 99久久精品免费看| 亚洲国产精品久久久久婷婷884 | 欧美日韩在线直播| 蜜桃在线一区二区三区| 国产人成一区二区三区影院| 91蜜桃视频在线|