Ejemplo n.º 1
0
        /// <summary>
        /// Reads the attachments.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="pagename">The pagename.</param>
        /// <returns></returns>
        public ActionResult ReadAttachments([DataSourceRequest] DataSourceRequest request, string pagename)
        {
            GetAttachmentsResponse response = new GetAttachmentsResponse();

            int?ContactID     = null;
            int?OpportunityID = null;

            if (pagename == "contacts")
            {
                var contactid = ReadCookie("contactid");
                ContactID = contactid == null ? new Nullable <int>() : Convert.ToInt32(contactid);
            }
            else if (pagename == "opportunities")
            {
                var opportunityid = ReadCookie("opportunityid");
                OpportunityID = opportunityid == null ? new Nullable <int>() : Convert.ToInt32(opportunityid);
            }

            response = attachmentService.GetAllAttachments(new GetAttachmentsRequest()
            {
                ContactId     = ContactID,
                Limit         = request.PageSize,
                PageNumber    = request.Page,
                Page          = pagename,
                OpportunityID = OpportunityID
            });
            return(Json(
                       new DataSourceResult
            {
                Data = response.Attachments,
                Total = response.TotalRecords
            },
                       JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public HttpResponseMessage GetDocRepository(int ContactID)
        {
            GetAttachmentsResponse response = docrepositoryService.GetAllAttachments(new GetAttachmentsRequest()
            {
                ContactId = ContactID
            });

            return(Request.BuildResponse(response));
        }
Ejemplo n.º 3
0
        public GetAttachmentsResponse GetAllAttachments(GetAttachmentsRequest request)
        {
            GetAttachmentsResponse     response    = new GetAttachmentsResponse();
            IEnumerable <Attachment>   attachments = attachmentRepository.FindAllAttachments(request.ContactId, request.OpportunityID, request.Page, request.Limit, request.PageNumber);
            AttachmentActivityAnalyzer analyser    = new AttachmentActivityAnalyzer(attachments, request.DateFormat);

            response.Attachments  = Mapper.Map <IEnumerable <Attachment>, IEnumerable <AttachmentViewModel> >(analyser.GenerateAnalysis());
            response.TotalRecords = attachmentRepository.TotalNumberOfAttachments(request.ContactId, request.OpportunityID, request.Page);
            return(response);
        }
Ejemplo n.º 4
0
        public Dictionary <int, BugAttachment> GetAttachments(int[] attachmentIds)
        {
            GetAttachmentsParam args = new GetAttachmentsParam();

            args.attachment_ids = attachmentIds;
            GetAttachmentsResponse          res  = Proxy.GetAttachments(args);
            Dictionary <int, BugAttachment> dict = new Dictionary <int, BugAttachment> ();

            foreach (BugAttachment b in res.attachments)
            {
                dict [b.id] = b;
            }
            return(dict);
        }
Ejemplo n.º 5
0
        public HttpResponseMessage GetAllAttachments(AttachmentDataViewModel attachmentviewmodel)
        {
            GetAttachmentsResponse response = docrepositoryService.GetAllAttachments(new GetAttachmentsRequest()
            {
                ContactId     = attachmentviewmodel.ContactID,
                Limit         = 5,
                PageNumber    = attachmentviewmodel.PageNumber,
                Page          = attachmentviewmodel.PageName,
                OpportunityID = attachmentviewmodel.OpportunityID,
                DateFormat    = this.DateFormat
            });

            return(Request.BuildResponse(response));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets all attachments.
        /// </summary>
        /// <param name="attachmentviewmodel">The attachmentviewmodel.</param>
        /// <returns></returns>
        public ActionResult GetAllAttachments(AttachmentDataViewModel attachmentviewmodel)
        {
            GetAttachmentsResponse response = attachmentService.GetAllAttachments(new GetAttachmentsRequest()
            {
                ContactId     = attachmentviewmodel.ContactID,
                Limit         = 5,
                PageNumber    = attachmentviewmodel.PageNumber,
                Page          = attachmentviewmodel.PageName,
                OpportunityID = attachmentviewmodel.OpportunityID,
                DateFormat    = this.Identity.ToDateFormat()
            });

            return(Json(
                       new DataSourceResult
            {
                Data = response.Attachments,
                Total = response.TotalRecords
            },
                       JsonRequestBehavior.AllowGet));
        }