Пример #1
0
        public Response AddSharing(DocumentSharingRequest request)
        {
            Response response = default;

            try
            {
                IDBParameter p1 = new SqlParameterAdapter();
                IDBParameter p2 = new SqlParameterAdapter();
                p1.ParameterName = "DocId";
                p1.Value         = request.DocID;
                p2.ParameterName = "userId";
                p2.Value         = request.UserId;
                var con = dal.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" +
                                      "Trusted_Connection=True;");

                var dataset = dal.ExecSPQuery("CreateShare", con, p1, p2);
                if (dataset != null)
                {
                    response = new DocumentSharingResponseAddOK();
                }
            }
            catch (Exception e)
            {
                response = new ResponseError();
            }

            return(response);
        }
        public DocumentsharingResponse AddSharing(DocumentSharingRequest request)
        {
            DocumentsharingResponse retval = default;

            try
            {
                var con        = _SQLDAL.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
                var parameters = _paramConverter.ConvertToParameters(request.sharingDTO);
                var dataset    = _SQLDAL.ExecSPQuery("CreateShare", con, parameters);

                if (dataset.Tables[0].Rows.Count != 0)
                {
                    retval = new DocumentSharingResponseAddOK();
                    retval.DocumentSharingDTO = new List <DocumentSharingDTO>();
                    retval.DocumentSharingDTO.Add(new DocumentSharingDTO()
                    {
                        DocID = request.sharingDTO.DocID, UserId = request.sharingDTO.UserId
                    });
                }
            }
            catch (Exception e)
            {
                retval = new DocumentSharingResponseDontAdd();
                //log
            }
            return(retval);
        }
 public SharingDAL(IInfraDal _dal)
 {
     dal = _dal;
     con = dal.Connect("Server=(localdb)\\MSSQLLocalDB;Database=Images;" +
                       "Trusted_Connection=True;");
     _paramConverter = new DBParameterConverter(dal);
 }
Пример #4
0
 public MarkerDAL(IInfraDal _dal)
 {
     dal = _dal;
     con = dal.Connect("Server=LAPTOP-6F3MEUHT\\SQLEXPRESS;Database=Images1;" +
                       "Trusted_Connection=True;");
     _paramConverter = new DBParameterConverter(dal);
 }
 public DocumentDAL(IInfraDal SQLDAL, IDocumentSharingDAL DocumentSharingDAL)
 {
     _DocumentSharingDAL = DocumentSharingDAL;
     _SQLDAL             = SQLDAL;
     _paramConverter     = new DBParameterConverter(_SQLDAL);
     con = _SQLDAL.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
 }
Пример #6
0
        public DrawingDalImpl(IConfiguration configuration)// TODO:change to IConfiguration - COMPLETED
        {
            _configuration = configuration;
            var strConn = _configuration.GetConnectionString("mainDb");

            _infraDal   = new InfraDalImpl();
            _connection = _infraDal.Connect(strConn);
        }
        public DocumentsharingResponse AddSharing(DocumentSharingRequest request)
        {
            DocumentsharingResponse retval = default;

            try
            {
                var con        = _SQLDAL.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
                var parameters = _paramConverter.ConvertToParameters(request.sharingDTO);
                var dataset    = _SQLDAL.ExecSPQuery("CreateShare", con, parameters);

                if (dataset != null)
                {
                    retval = new DocumentSharingResponseAddOK();
                }
            }
            catch (Exception e)
            {
                retval = new DocumentSharingResponseDontAdd();
                //log
            }
            return(retval);
        }
Пример #8
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);
        }
Пример #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 != null)
                {
                    response = new MarkersResponseAddOK();
                }
            }
            catch (Exception e)
            {
                response = new MarkerRsponseDontAdd();
                throw;
            }
            return(response);
        }
Пример #10
0
 public RegisterUserDAL(IInfraDal SQLDAL)
 {
     _SQLDAL = SQLDAL;
     _DalParametersConverter = new DBParameterConverter(new SQLDAL());
     con = _SQLDAL.Connect("Server=LAPTOP-B6F4SVRM;Database=DocumentProject;" + "Trusted_Connection=True;");
 }