public DataSet GetSharedDocumentsForUser(UserRequest userRequest) { p = _paramConverter.ConvertToParameter(userRequest, "UserID"); var data = dal.ExecSPQuery("DocsIParticipateIn", con, p); return(data); }
public DocumentsharingResponse GetShareForDoc(DocumentSharingRequestGetForDoc request) { DocumentsharingResponse res = new DcumentSharingResponseEmpty(); try { var con = _SQLDAL.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;"); var param = _paramConverter.ConvertToParameter(request, "DocID"); var dataset = _SQLDAL.ExecSPQuery("GetShareForDoc", con, param); if (dataset.Tables[0].Rows.Count != 0) { res = new DocumentsharingResponse() { DocumentSharingDTO = new List <DocumentSharingDTO>() }; var sharesList = dataset.Tables[0].AsEnumerable().Select(dataRow => new DocumentSharingDTO { DocID = dataRow.Field <Guid>("DocID"), UserId = dataRow.Field <string>("UserId") }).ToList(); res.DocumentSharingDTO = sharesList; } } catch (Exception e) { throw; } return(res); }
public CommentResponse DeleteComment(CommentRequestDelete request) { CommentResponse retval = default; try { var parameter = _paramConverter.ConvertToParameter(request, "CommentID"); var dataset = _SQLDAL.ExecSPQuery("RemoveComment", con, parameter); if (dataset.Tables[0].Rows.Count != 0) { retval = new CommentResonseRemoveOk() { comments = new List <CommentDTO>() { new CommentDTO() { CommentID = request.CommentID } } }; } } catch (Exception e) { retval = new CommentResponseDontRemove(); //log } return(retval); }
public DocumentResponse GetDocumentsForUser(DocumentRequestGetForUser request) { DocumentResponse retval = default; try { var param = _paramConverter.ConvertToParameter(request, "UserID"); var dataset = _SQLDAL.ExecSPQuery("GetDocumentsForUser", con, param); if (dataset.Tables[0].Rows.Count != 0) { retval = new DocumentResponse() { documentDTO = new List <DocumentDTO>() }; var docList = dataset.Tables[0].AsEnumerable().Select(dataRow => new DocumentDTO { DocName = dataRow.Field <string>("DocName"), ImageURL = dataRow.Field <string>("ImageURL"), UserID = dataRow.Field <string>("UserID"), DocID = dataRow.Field <Guid>("DocID") }).ToList(); retval.documentDTO = docList; } var sharing = _DocumentSharingDAL.GetShareForUser(new DocumentSharingRequestGetForUser() { userID = request.UserID }); List <DocumentDTO> sharedDocs = new List <DocumentDTO>(); if (sharing.DocumentSharingDTO != null && sharing.DocumentSharingDTO.Count != 0) { foreach (var item in sharing.DocumentSharingDTO) { var doc = GetDocument(item.DocID); if (doc.documentDTO[0].UserID != request.UserID) { sharedDocs.Add(doc.documentDTO[0]); } } if (retval == null) { retval = new DocumentResponse() { documentDTO = new List <DocumentDTO>() }; } retval.documentDTO.AddRange(sharedDocs); } if (retval == null) { retval = new DocumentResponseEmpty(); } } catch (Exception e) { //log } return(retval); }
public MarkerRsponse RemoveMarker(MarkerRequestRemove request) { MarkerRsponse response = default; try { var con = _SQLdal.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;"); var parameters = _paramConverter.ConvertToParameter(request, "MarkerId"); var dataset = _SQLdal.ExecSPQuery("RemoveMarker", con, parameters); if (dataset.Tables[0].Rows.Count != 0) { var markers = new List <MarkerDTO>(); markers.Add(new MarkerDTO() { MarkerID = request.MarkerId }); response = new MarkerResponseRemoveOk() { Markers = markers }; } } catch (Exception e) { response = new MarkerRsponseDontRemove(); throw; } return(response); }
public DataSet CreateDocument(Document document) { var p = _paramConverter.ConvertToParameter(document, "UserID"); var p1 = _paramConverter.ConvertToParameter(document, "ImageURL"); var p2 = _paramConverter.ConvertToParameter(document, "DocumentName"); var data = dal.ExecSPQuery("CreateDocument", con, p, p1, p2); return(data); }
public DataSet CreateMarker(Marker marker) { var p = _paramConverter.ConvertToParameter(marker, "docID"); var p1 = _paramConverter.ConvertToParameter(marker, "MarkerType"); var p2 = _paramConverter.ConvertToParameter(marker, "cx"); var p3 = _paramConverter.ConvertToParameter(marker, "cy"); var p4 = _paramConverter.ConvertToParameter(marker, "rx"); var p5 = _paramConverter.ConvertToParameter(marker, "ry"); var p6 = _paramConverter.ConvertToParameter(marker, "Fore"); var p7 = _paramConverter.ConvertToParameter(marker, "userID"); var p8 = _paramConverter.ConvertToParameter(marker, "text"); var data = dal.ExecSPQuery("CreateMarker", con, p, p1, p2, p3, p4, p5, p6, p7, p8); return(data); }
public void RemoveUser(User user) { var p = _paramConverter.ConvertToParameter(user, "UserID"); dal.ExecSPQuery("RemoveUser", con, p); }