public List <VendorDocument> ExecuteVendorDocumentFind(string queryText)
        {
            string connectionString = ConfigurationManager.AppSettings["SQLConnectionString"];

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryText, conn);
                conn.Open();

                SqlDataAdapter da = new SqlDataAdapter(command);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                conn.Close();
                da.Dispose();

                List <VendorDocument> vendorDocuments = new List <VendorDocument>();

                foreach (DataRow row in dt.Rows)
                {
                    VendorDocument document = new VendorDocument()
                    {
                        ContactID   = row["ContactID"].ToString(),
                        ContactName = row["ContactName"].ToString(),
                        Category    = row["Category"].ToString(),
                        Filename    = row["Filename"].ToString(),
                        PublicID    = row["PublicID"].ToString(),
                        SPID        = row["SPID"].ToString(),
                        Status      = row["Status"].ToString(),
                        Subcategory = row["Subcategory"].ToString(),
                        Description = row["Description"].ToString(),
                    };

                    vendorDocuments.Add(document);
                }

                return(vendorDocuments);
            }
        }
        public VendorDocument GetVendorDocumentByPublicID(string PublicID)
        {
            string connectionString = ConfigurationManager.AppSettings["SQLConnectionString"];
            string queryText        = ConfigurationManager.AppSettings["BaseVendorDocumentSelectStatement"];

            queryText += " AND (Doc.PublicID = '" + PublicID + "')";
            queryText += " ORDER BY Doc.PublicID desc";

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryText, conn);
                conn.Open();

                SqlDataAdapter da = new SqlDataAdapter(command);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                conn.Close();
                da.Dispose();

                VendorDocument matchingDocument = new VendorDocument();
                if (dt.Rows.Count > 0)
                {
                    matchingDocument.ContactID   = dt.Rows[0]["ContactID"].ToString();
                    matchingDocument.ContactName = dt.Rows[0]["ContactName"].ToString();
                    matchingDocument.Category    = dt.Rows[0]["Category"].ToString();
                    matchingDocument.Filename    = dt.Rows[0]["Filename"].ToString();
                    matchingDocument.PublicID    = dt.Rows[0]["PublicID"].ToString();
                    matchingDocument.SPID        = dt.Rows[0]["SPID"].ToString();
                    matchingDocument.Status      = dt.Rows[0]["Status"].ToString();
                    matchingDocument.Subcategory = dt.Rows[0]["Subcategory"].ToString();
                    matchingDocument.Description = dt.Rows[0]["Description"].ToString();

                    return(matchingDocument);
                }
                return(null);
            }
        }