/// <summary>
 /// Deprecated Method for adding a new object to the IssueAttachmentDALs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToIssueAttachmentDALs(IssueAttachmentDAL issueAttachmentDAL)
 {
     base.AddObject("IssueAttachmentDALs", issueAttachmentDAL);
 }
 /// <summary>
 /// Create a new IssueAttachmentDAL object.
 /// </summary>
 /// <param name="issueAttachmentID">Initial value of the IssueAttachmentID property.</param>
 /// <param name="filename">Initial value of the Filename property.</param>
 /// <param name="entryDate">Initial value of the EntryDate property.</param>
 /// <param name="userID">Initial value of the UserID property.</param>
 /// <param name="issueID">Initial value of the IssueID property.</param>
 /// <param name="mimeType">Initial value of the MimeType property.</param>
 public static IssueAttachmentDAL CreateIssueAttachmentDAL(global::System.Int32 issueAttachmentID, global::System.String filename, global::System.DateTime entryDate, global::System.Int32 userID, global::System.Int32 issueID, global::System.String mimeType)
 {
     IssueAttachmentDAL issueAttachmentDAL = new IssueAttachmentDAL();
     issueAttachmentDAL.IssueAttachmentID = issueAttachmentID;
     issueAttachmentDAL.Filename = filename;
     issueAttachmentDAL.EntryDate = entryDate;
     issueAttachmentDAL.UserID = userID;
     issueAttachmentDAL.IssueID = issueID;
     issueAttachmentDAL.MimeType = mimeType;
     return issueAttachmentDAL;
 }
Beispiel #3
0
        /// <summary>
        /// AddIssueAttachment
        /// </summary>
        /// <param name="issueAttachment">IssueAttachment</param>
        /// <returns>bool</returns>
        public static bool AddIssueAttachment(IssueAttachment issueAttachment)
        {
            var returnValue = false;

            try
            {
                using (var db = new ProjectManagerEntities())
                {
                    db.Connection.Open();
                    var ia = new IssueAttachmentDAL();
                    ia.Filename = issueAttachment.FileName;
                    ia.EntryDate = issueAttachment.EntryDate;
                    ia.Description = issueAttachment.Description;
                    ia.IssueID = issueAttachment.IssueID;
                    ia.UserID = issueAttachment.UserID;
                    ia.MimeType = issueAttachment.MimeType;
                    ia.FileData = issueAttachment.FileData;

                    // save issue Attachment.
                    db.IssueAttachmentDALs.AddObject(ia);
                    db.SaveChanges();

                }

                returnValue = true;

            }
            catch (Exception)
            {

                throw;
            }

            return returnValue;
        }