示例#1
0
        /// <summary>
        /// Get generic drug products.
        /// </summary>
        /// <param name="genericDrugId">The generic drug identifier.</param>
        /// <param name="df">The df.</param>
        /// <param name="passKey">The pass key.</param>
        /// <returns>List&lt;LexiData.GenericProduct&gt;.</returns>
        public List <GenericProduct> rx_GetGenericDrugProducts(string genericDrugId, DrugFilter df, string passKey)
        {
            if (!ValidationAndEncryptDecrypt.ValidateKey(passKey))
            {
                return(null);
            }

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

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

                var result = myDal.GetGenericDrugProducts(genericDrugId, df);

                return(result);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Method: rx_GetGenericDrugProducts");
                sb.AppendLine(genericDrugId == null ? "genericDrugId is null" : "genericDrugId: " + genericDrugId);
                sb.AppendLine(df == null ? "df is null" : "df: " + df);
                sb.AppendLine("");
                sb.AppendLine(e.ExceptionToString());
                WriteEventLogEntry(sb.ToString());
                sb.Clear();
                sb.Destroy();
                throw;
            }
            finally
            {
                myDal.Destroy();
                CloseConnection(dbConn);
            }
        }