Exemplo n.º 1
0
        public HttpResponseMessage GetDocumentLibrary(int siteId, int libraryId)
        {
            ContentClientProcessor.UserContext.SiteId = siteId;
            DocumentLibraryModel documentLibrary = ContentClientProcessor.GetDocumentLibrary(libraryId);

            return(Request.CreateResponse(HttpStatusCode.OK, documentLibrary));
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetDocuments(int siteId, int libraryId)
        {
            ContentClientProcessor.UserContext.SiteId = siteId;
            SetPagingParameters(ContentClientProcessor.RequestContext);
            DocumentLibraryModel documentLibrary = ContentClientProcessor.GetDocuments(libraryId);

            return(GetListResult <DocumentLibraryModel>(documentLibrary, ContentClientProcessor.RequestContext, ContentClientProcessor.ResponseContext));
        }
Exemplo n.º 3
0
        /// <summary>
        /// SaveDocumentLibrary
        /// </summary>
        /// <param name="documentLibrary"></param>
        public void SaveDocumentLibrary(DocumentLibraryModel documentLibrary)
        {
            DocumentLibraryDC     documentLibraryDC           = Mapper.Map <DocumentLibraryModel, DocumentLibraryDC>(documentLibrary);
            ServiceResponse <int> saveDocumentLibraryResponse = _contentProxy.Execute(opt => opt.SaveDocumentLibrary(documentLibraryDC));

            if (saveDocumentLibraryResponse.Status != ResponseStatus.Success)
            {
                HandleError(saveDocumentLibraryResponse.Status, saveDocumentLibraryResponse.ResponseMessage);
            }
            else
            {
                documentLibrary.DocumentLibraryId = saveDocumentLibraryResponse.Result;
            }
        }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            int OrgID = int.Parse(Request.Cookies["OrgID"].Value);
            DocumentLibraryModel model    = new DocumentLibraryModel();
            OrganizationModel    orgModel = new OrganizationService().GetOrganizationByID(OrgID);

            foreach (DepartmentModel dept in orgModel.Departments)
            {
                DepartmentModel temp = new DepartmentService().GetDepartmentDetails(dept.DepartmentID);
                dept.SubDepartments = temp.SubDepartments;
                model.Departments.Add(temp);
            }
            return(View(model));
        }
Exemplo n.º 5
0
        /// <summary>
        /// GetDocumentLibrary
        /// </summary>
        /// <param name="contentId"></param>
        /// <returns></returns>
        public DocumentLibraryModel GetDocumentLibrary(int contentId)
        {
            DocumentLibraryModel documentLibraryResult = new DocumentLibraryModel();
            ServiceResponse <DocumentLibraryDC> documentLibraryResponse = _contentProxy.Execute(opt => opt.GetDocumentLibrary(contentId));

            if (documentLibraryResponse.Status == ResponseStatus.Success)
            {
                documentLibraryResult = Mapper.Map <DocumentLibraryDC, DocumentLibraryModel>(documentLibraryResponse.Result);
            }
            else
            {
                HandleError(documentLibraryResponse.Status, documentLibraryResponse.ResponseMessage);
            }
            return(documentLibraryResult);
        }
Exemplo n.º 6
0
        /// <summary>
        /// GetDocuments
        /// </summary>
        /// <param name="documentLibraryId"></param>
        /// <returns></returns>
        public DocumentLibraryModel GetDocuments(int documentLibraryId)
        {
            DocumentLibraryModel documentLibraryModel             = null;
            ServiceResponse <DocumentLibraryDC> documentsResponse = _contentProxy.Execute(opt => opt.GetDocuments(documentLibraryId));

            if (documentsResponse.Status == ResponseStatus.Success)
            {
                documentLibraryModel           = Mapper.Map <DocumentLibraryDC, DocumentLibraryModel>(documentsResponse.Result);
                documentLibraryModel.Documents = new List <DocumentModel>();
                documentsResponse.Result.Documents.ForEach(
                    Document => documentLibraryModel.Documents.Add(Mapper.Map <DocumentDC, DocumentModel>(Document))
                    );
            }
            else
            {
                HandleError(documentsResponse.Status, documentsResponse.ResponseMessage);
            }
            return(documentLibraryModel);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Documents
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult Documents(int Id)
        {
            if (!SavePermissionsToViewBag(FeatureEnum.DocumentLibrary))
            {
                return(Redirect("~/home/unauthorized"));
            }

            DocumentLibraryModel documentLibraryModel = new DocumentLibraryModel();

            documentLibraryModel.DocumentLibraryId = Id;
            if (Request.IsAjaxRequest())
            {
                return(PartialView(documentLibraryModel));
            }
            else
            {
                return(View(documentLibraryModel));
            }
        }
Exemplo n.º 8
0
 public HttpResponseMessage SaveDocumentLibrary(DocumentLibraryModel documentLibraryModel, int siteId)
 {
     ContentClientProcessor.UserContext.SiteId = siteId;
     ContentClientProcessor.SaveDocumentLibrary(documentLibraryModel);
     return(Request.CreateResponse(HttpStatusCode.OK, new { Message = CoreMessages.SavedSuccessfully, Id = documentLibraryModel.DocumentLibraryId }));
 }