Ejemplo n.º 1
0
        /// <summary>
        /// Search generic drug.
        /// </summary>
        /// <param name="searchText">The search text.</param>
        /// <param name="searchCriteria">The search criteria.</param>
        /// <param name="drugFilter">The drug filter.</param>
        /// <param name="passKey">The pass key.</param>
        /// <returns>List&lt;LexiData.GenericDrug&gt;.</returns>
        public List <GenericDrug> rx_SearchGenericDrug(string searchText, SearchCriteria searchCriteria, DrugFilter drugFilter, string passKey)
        {
            if (!ValidationAndEncryptDecrypt.ValidateKey(passKey))
            {
                return(null);
            }

            SqlConnection dbConn = new SqlConnection();
            GenericDAL    myDal  = null;

            try
            {
                dbConn = OpenLexidataConnection();
                myDal  = GetLexidataDAL(dbConn);

                var genericDrug = myDal.SearchGenericDrug(searchText, searchCriteria, drugFilter);

                return(genericDrug);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Method: rx_SearchGenericDrug");
                sb.AppendLine(searchText == null ? "searchText is null" : "searchText: " + searchText);
                sb.AppendLine(searchCriteria == null ? "searchCriteria is null" : "searchCriteria: " + searchCriteria);
                sb.AppendLine(drugFilter == null ? "drugFilter is null" : "drugFilter: " + drugFilter.RxOTCStatus);
                sb.AppendLine("");
                sb.AppendLine(e.ExceptionToString());
                WriteEventLogEntry(sb.ToString());
                sb.Clear();
                sb.Destroy();
                throw;
            }
            finally
            {
                myDal.Destroy();
                CloseConnection(dbConn);
            }
        }