Ejemplo n.º 1
0
        public void ActionAttachments()
        {
            string userData = _userScot;
            AuthenticationModel authentication = AuthenticationModel.AuthenticationModelTest(userData, _connectionString);

            using (ConnectionContext connection = new ConnectionContext(authentication))
            {
                // user ticket
                TicketProxy ticketProxy = IDTreeTest.EmptyTicket();                                   // from front end
                TicketModel ticketModel = (TicketModel)Data_API.Create(connection.User, ticketProxy); // dbo.Tickets

                // ticket action
                ActionProxy actionProxy = IDTreeTest.EmptyAction();                               // from front end
                ActionModel actionModel = (ActionModel)Data_API.Create(ticketModel, actionProxy); // dbo.Actions

                // action attachment
                ActionAttachmentProxy attachmentProxy = (ActionAttachmentProxy)IDTreeTest.CreateAttachment(connection.OrganizationID,
                                                                                                           AttachmentProxy.References.Actions, actionModel.ActionID, actionModel.AttachmentPath);
                AttachmentModel attachmentModel = (AttachmentModel)Data_API.Create(actionModel, attachmentProxy);

                // read back attachment
                AttachmentProxy read = Data_API.ReadRefTypeProxy <AttachmentProxy>(connection, attachmentProxy.AttachmentID);
                switch (read)
                {
                case ActionAttachmentProxy output:      // Action attachment
                    Assert.AreEqual(attachmentProxy, output);
                    break;

                default:
                    Assert.Fail();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public static AttachmentProxy CreateAttachment(int organizationID, AttachmentProxy.References refType, int refID, string path)
        {
            ActionAttachmentProxy attachmentProxy = (ActionAttachmentProxy)AttachmentProxy.ClassFactory(AttachmentProxy.References.Actions);

            attachmentProxy.OrganizationID = organizationID;
            attachmentProxy.ActionID       = refID;
            attachmentProxy.FileName       = "stuff";
            attachmentProxy.FilePathID     = 3;
            attachmentProxy.FileSize       = 256;
            attachmentProxy.FileType       = "text something...";
            attachmentProxy.Path           = path; // IAttachmentDestination
            return(attachmentProxy);
        }