public void LoadByType(int messageID, WaterCoolerAttachmentType type) { using (SqlCommand command = new SqlCommand()) { command.CommandText = "SET NOCOUNT OFF; SELECT [MessageID], [AttachmentID], [RefType], [CreatorID], [DateCreated] FROM [dbo].[WatercoolerAttachments] WHERE ([MessageID] = @MessageID and [RefType] = @RefType);"; command.CommandType = CommandType.Text; command.Parameters.AddWithValue("MessageID", messageID); command.Parameters.AddWithValue("RefType", type); Fill(command); } }
public void AddAttachment(int messageID, int attachmentID, WaterCoolerAttachmentType attachmentType) { try { WatercoolerAttachment ticketAttachment = (new WatercoolerAttachments(TSAuthentication.GetLoginUser()).AddNewWatercoolerAttachment()); ticketAttachment.MessageID = messageID; ticketAttachment.AttachmentID = attachmentID; ticketAttachment.RefType = attachmentType; ticketAttachment.DateCreated = DateTime.UtcNow; ticketAttachment.CreatorID = TSAuthentication.GetLoginUser().UserID; ticketAttachment.Collection.Save(); } catch (Exception e) { } }
public WatercoolerAttachmentProxy[] GetWatercoolerAttachmentProxies(WaterCoolerAttachmentType type) { List <WatercoolerAttachmentProxy> list = new List <WatercoolerAttachmentProxy>(); foreach (WatercoolerAttachment item in this) { if (item.RefType == type) { WatercoolerAttachmentProxy wcAtt = item.GetProxy(); if (wcAtt != null) { list.Add(wcAtt); } } } return(list.ToArray()); }