public MarkerRsponse AddMarker(MarkerRequestAdd request)
        {
            MarkerRsponse             response = default;
            List <DocumentSharingDTO> shared   = default;
            List <string>             mylist   = new List <string>();

            try
            {
                response = _dal.AddMarker(request);

                shared = _documentSharingService.GetShareForDoc(new DocumentSharingRequestGetForDoc()
                {
                    DocID = request.MarkerDTO.DocID
                }).DocumentSharingDTO;
                if (shared != null)
                {
                    //create list type string for send to all
                    shared.ForEach(s => mylist.Add(s.UserId));
                    //add the usrid of the usr whose document he owns

                    mylist.Remove(request.MarkerDTO.userId);
                    _messanger.SendMarkerToAll(mylist, response);
                }
            }
            catch (Exception e)
            {
                //log e
                response = new MarkerRsponseDontAdd();
            }
            return(response);
        }
        public MarkerRsponse RemoveMarker(MarkerRequestRemove request)
        {
            List <DocumentSharingDTO> shared   = default;
            List <string>             mylist   = new List <string>();
            MarkerRsponse             response = default;

            try
            {
                response = _dal.RemoveMarker(request);
                shared   = _documentSharingService.GetShareForDoc(new DocumentSharingRequestGetForDoc()
                {
                    DocID = request.DocID
                }).DocumentSharingDTO;
                if (shared != null)
                {
                    shared.ForEach(s => mylist.Add(s.UserId));

                    mylist.Remove(request.UserID);
                    _messanger.SendMarkerToAll(mylist, response);
                }
            }
            catch (Exception e)
            {
                //log
                response = new MarkerRsponseDontRemove();
                throw;
            }
            return(response);
        }
示例#3
0
        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);
        }
示例#4
0
        public MarkerRsponse RemoveMarker(MarkerRequestRemove request)
        {
            MarkerRsponse response = default;

            try
            {
                response = _dal.RemoveMarker(request);
            }
            catch (Exception e)
            {
                //log
                response = new MarkerRsponseDontRemove();
                throw;
            }
            return(response);
        }
        public MarkerRsponse GetMarkers(RequestGetMarkers request)
        {
            MarkerRsponse retval = default;

            try
            {
                if (request.DocID != null)
                {
                    retval = _dal.GetMarkers(request);
                }
            }
            catch (Exception e)
            {
                throw;
            }
            return(retval);
        }
示例#6
0
        public MarkerRsponse AddMarker(MarkerRequestAdd request)
        {
            MarkerRsponse response = default;

            try
            {
                //if available
                response = _dal.AddMarker(request);
            }
            catch (Exception e)
            {
                //log
                response = new MarkerRsponseDontAdd();
                throw;
            }
            return(response);
        }
示例#7
0
        public MarkerRsponse GetMarkers(RequestGetMarkers request)
        {
            MarkerRsponse retval = default;

            try
            {
                var con       = _SQLdal.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
                var parameter = _paramConverter.ConvertToParameter(request, "DocId");

                if (parameter != null)
                {
                    var dataset = _SQLdal.ExecSPQuery("GetMarkers", con, parameter);
                    if (dataset.Tables[0].Rows.Count != 0)
                    {
                        retval = new MarkerRsponse()
                        {
                            Markers = new List <MarkerDTO>()
                        };
                        var markersList = dataset.Tables[0].AsEnumerable().Select(dataRow => new MarkerDTO
                        {
                            CenterX    = dataRow.Field <int>("CenterX"),
                            CenterY    = dataRow.Field <int>("CenterY"),
                            RadiusX    = dataRow.Field <int>("RadiusX"),
                            RadiusY    = dataRow.Field <int>("RadiusY"),
                            ForeColor  = dataRow.Field <string>("ForeColor"),
                            BackColor  = dataRow.Field <string>("BackColor"),
                            MarkerType = dataRow.Field <string>("MarkerType"),
                            DocID      = dataRow.Field <Guid>("DocID"),
                            userId     = dataRow.Field <string>("userId"),
                            MarkerID   = dataRow.Field <Guid>("MarkerID")
                        }).ToList();
                        retval.Markers = markersList;
                    }
                }
            }
            catch (Exception e)
            {
                //log
                throw;
            }
            return(retval);
        }
示例#8
0
        public MarkerRsponse RemoveMarker(MarkerRequestRemove request)
        {
            MarkerRsponse response = default;

            try
            {
                var con        = _SQLdal.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
                var parameters = new DBParameterConverter(_SQLdal).ConvertToParameters(request);
                var dataset    = _SQLdal.ExecSPQuery("RemoveMarker", con, parameters);
                if (dataset != null)
                {
                    response = new MarkerResponseRemoveOk();
                }
            }
            catch (Exception e)
            {
                response = new MarkerRsponseDontRemove();
                throw;
            }
            return(response);
        }
示例#9
0
        public MarkerRsponse AddMarker(MarkerRequestAdd request)
        {
            MarkerRsponse response = default;

            //------------
            try
            {
                var con        = _SQLdal.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
                var parameters = _paramConverter.ConvertToParameters(request.MarkerDTO);
                var dataset    = _SQLdal.ExecSPQuery("CreateMarker", con, parameters);
                if (dataset.Tables[0].Rows.Count != 0)
                {
                    var markers = new List <MarkerDTO>();
                    markers.Add(new MarkerDTO()
                    {
                        BackColor  = request.MarkerDTO.BackColor,
                        CenterX    = request.MarkerDTO.CenterX,
                        CenterY    = request.MarkerDTO.CenterY,
                        DocID      = request.MarkerDTO.DocID,
                        ForeColor  = request.MarkerDTO.ForeColor,
                        MarkerID   = dataset.Tables[0].Rows[0].Field <Guid>("MarkerID"),
                        MarkerType = request.MarkerDTO.MarkerType,
                        RadiusX    = request.MarkerDTO.RadiusX,
                        RadiusY    = request.MarkerDTO.RadiusY,
                        userId     = request.MarkerDTO.userId
                    });
                    response = new MarkersResponseAddOK()
                    {
                        Markers = markers
                    };
                }
            }
            catch (Exception e)
            {
                response = new MarkerRsponseDontAdd();
                throw;
            }
            return(response);
        }
示例#10
0
        public MarkerRsponse AddMarker(MarkerRequestAdd request)
        {
            MarkerRsponse response = default;

            //------------
            try
            {
                var con        = _SQLdal.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
                var parameters = _paramConverter.ConvertToParameters(request.MarkerDTO);
                var dataset    = _SQLdal.ExecSPQuery("CreateMarker", con, parameters);
                if (dataset != null)
                {
                    response = new MarkersResponseAddOK();
                }
            }
            catch (Exception e)
            {
                response = new MarkerRsponseDontAdd();
                throw;
            }
            return(response);
        }