コード例 #1
0
        /// <summary>
        /// Lists the specified issue id.
        /// </summary>
        /// <param name="IssueId">The issue id.</param>
        /// <returns></returns>
        public static EMailIssueExternalRecipient[]     List(int IssueId)
        {
            ArrayList retVal = new ArrayList();

            foreach (EMailIssueExternalRecipientRow row in EMailIssueExternalRecipientRow.List(IssueId))
            {
                retVal.Add(new EMailIssueExternalRecipient(row));
            }

            return((EMailIssueExternalRecipient[])retVal.ToArray(typeof(EMailIssueExternalRecipient)));
        }
コード例 #2
0
        public static int Create(int IssueId, string EMail)
        {
            EMailIssueExternalRecipientRow newRow = new EMailIssueExternalRecipientRow();

            newRow.IssueId = IssueId;
            newRow.EMail   = EMail;

            newRow.Update();

            return(newRow.PrimaryKeyId);
        }
コード例 #3
0
        /// <summary>
        /// Strings the list.
        /// </summary>
        /// <param name="IssueId">The issue id.</param>
        /// <returns></returns>
        public static string[] StringList(int IssueId)
        {
            ArrayList retVal = new ArrayList();

            foreach (EMailIssueExternalRecipientRow row in EMailIssueExternalRecipientRow.List(IssueId))
            {
                retVal.Add(row.EMail);
            }

            return((string[])retVal.ToArray(typeof(string)));
        }
コード例 #4
0
        /// <summary>
        /// Updates the specified recipient.
        /// </summary>
        /// <param name="recipient">The recipient.</param>
        public static void Update(int IssueId, Hashtable recipientHash)
        {
            if (!Incident.CanUpdateExternalRecipients(IssueId))
            {
                throw new AccessDeniedException();
            }

            using (DbTransaction tran = DbTransaction.Begin())
            {
                EMailIssueExternalRecipientRow[] list = EMailIssueExternalRecipientRow.List(IssueId);

                Hashtable alreadyAddedItems = new Hashtable();

                foreach (EMailIssueExternalRecipientRow row in list)
                {
                    if (!alreadyAddedItems.ContainsKey(row.EMail.ToLower()))
                    {
                        alreadyAddedItems.Add(row.EMail.ToLower(), null);
                    }
                }

                // Delete
                foreach (EMailIssueExternalRecipientRow row in list)
                {
                    if (!recipientHash.ContainsKey(row.EMailIssueExternalRecipientId))
                    {
                        alreadyAddedItems.Remove(row.EMail.ToLower());
                        row.Delete();
                    }
                }

                // Insert
                foreach (int Key in recipientHash.Keys)
                {
                    string Value = (string)recipientHash[Key];

                    if (Key < 0 && !alreadyAddedItems.ContainsKey(Value.ToLower()))
                    {
                        EMailIssueExternalRecipientRow newRow = new EMailIssueExternalRecipientRow();
                        newRow.IssueId = IssueId;
                        newRow.EMail   = Value;

                        newRow.Update();

                        alreadyAddedItems.Add(Value.ToLower(), null);
                    }
                }

                tran.Commit();
            }
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EMailIssueExternalRecipient"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 private EMailIssueExternalRecipient(EMailIssueExternalRecipientRow row)
 {
     _srcRow = row;
 }