public Response GetSharedDocuments(GetSharedDocumentsRequest request)
        {
            try
            {
                var ds = _dal.GetSharedDocuments(request.DocID);

                GetSharedDocumentsResponse retval = new GetSharedDocumentsResponse();
                if (ds.Tables.Count > 0)
                {
                    var tbl = ds.Tables[0];
                    if (tbl.Rows.Count > 0)
                    {
                        if (request.DocID == (string)tbl.Rows[0][0])
                        {
                            retval = new GetSharedDocumentsResponseOK((string)tbl.Rows[0][0], (string)tbl.Rows[0][1]);
                        }
                    }
                }
                return(retval);
            }
            catch (Exception ex)
            {
                return(new AppResponseError(ex.Message));
            }
        }
Ejemplo n.º 2
0
 public Response GetDocuments(GetDocumentsRequest request)
 {
     try
     {
         List <Documents> dl  = new List <Documents>();
         List <Documents> sdl = new List <Documents>();
         var ds                      = _dalDoc.GetDocuments(request.Owner);
         var sd                      = _dalShared.GetSharedDocuments(request.Owner);
         var tblDocs                 = ds.Tables[0];
         var tblShareDocs            = sd.Tables[0];
         GetDocumentsResponse retval = new GetDocumentsNotExistsResponse();
         if (tblDocs.Rows.Count > 0 || tblShareDocs.Rows.Count > 0)
         {
             for (int i = 0; i < tblDocs.Rows.Count; i++)
             {
                 if (request.Owner == (string)tblDocs.Rows[i][0])
                 {
                     Documents dc = new Documents((string)tblDocs.Rows[i][0], (string)tblDocs.Rows[i][1],
                                                  (string)tblDocs.Rows[i][2], (string)tblDocs.Rows[i][3]);
                     dl.Add(dc);
                 }
             }
             for (int i1 = 0; i1 < tblShareDocs.Rows.Count; i1++)
             {
                 if (request.Owner != (string)tblShareDocs.Rows[i1][0])
                 {
                     Documents sdc = new Documents((string)tblShareDocs.Rows[i1][0], (string)tblShareDocs.Rows[i1][1],
                                                   (string)tblShareDocs.Rows[i1][2], (string)tblShareDocs.Rows[i1][3]);
                     sdl.Add(sdc);
                 }
             }
             retval = new GetDocumentsResponseOK(dl, sdl);
         }
         return(retval);
     }
     catch (Exception ex)
     {
         return(new AppResponseError(ex.Message));
     }
 }