Пример #1
0
        public IList <SearchDocumentResultItem> GetDocuments(SearchDocumentConditions sc, out int totalRowCount)
        {
            List <SearchDocumentResultItem> results = new List <SearchDocumentResultItem>();

            totalRowCount = 0;

            if (db == null)
            {
                throw new Exception("Do poprawnego działania wymagany jest SQL Server 2005!");
            }

            DbCommand cmd = db.GetStoredProcCommand("Wyszukiwarki.getDocuments", sc.UserGuid, sc.HasExtendedSearchRole,
                                                    sc.StartPage, sc.PageSize, sc.DocumentCategory, sc.DocumentType, sc.DocumentNumber, sc.SystemNumber, sc.ClientName,
                                                    sc.DocumentStartDate, sc.DocumentEndDate, sc.Mark, sc.Status, sc.Text, sc.SearchDescription, sc.SearchContent);

            cmd.CommandTimeout = 120;
            totalRowCount      = 0;

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    results.Add(new SearchDocumentResultItem()
                    {
                        DocumentNumber     = dr["registryNumber"].ToString(),
                        CreationDate       = (DateTime)dr["creationDate"],
                        DocumentCategory   = dr["categoryName"].ToString(),
                        DocumentType       = dr["typeName"].ToString(),
                        SystemNumber       = (int)dr["documentID"],
                        ClientName         = dr["sender"].ToString(),
                        DocumentStatus     = dr["status"].ToString(),
                        Mark               = dr["referenceNumber"].ToString(),
                        Owner              = dr["owner"].ToString(),
                        FoundInContent     = dr["foundInContent"].ToString(),
                        FoundInDescription = dr["foundInDescription"].ToString(),
                        IsInContent        = (bool)dr["isInContent"],
                        IsInDescription    = (bool)dr["isInDescription"]
                    });
                }

                if (dr.NextResult())
                {
                    if (dr.Read())
                    {
                        totalRowCount = int.Parse(dr["totalRowCount"].ToString());
                    }
                }
            };

            return(results);
        }
Пример #2
0
 public IList <SearchDocumentResultItem> GetDocuments(SearchDocumentConditions sc, out int totalRowCount)
 {
     return(dao.GetDocuments(sc, out totalRowCount));
 }