Example #1
0
        /// <summary>
        /// Get common order results.
        /// </summary>
        /// <param name="drugId">The drug identifier.</param>
        /// <param name="productId">The product identifier.</param>
        /// <param name="localDataSetId">The local data set identifier.</param>
        /// <param name="passKey">The pass key.</param>
        /// <returns>List&lt;LexiData.CommonOrderResult&gt;.</returns>
        public List <CommonOrderResult> rx_GetCommonOrderResults(string drugId, int productId, int localDataSetId, string passKey)
        {
            if (!ValidationAndEncryptDecrypt.ValidateKey(passKey))
            {
                return(null);
            }

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

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

                var result = myDal.GetCommonOrderResults(drugId, productId, localDataSetId);

                return(result);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Method: rx_GetCommonOrderResults");
                sb.AppendLine(drugId == null ? "DrugId is null" : "DrugId: " + drugId);
                sb.AppendLine(productId == 0 ? "productId is zero" : "productId: " + productId);
                sb.AppendLine(localDataSetId == 0 ? "localDataSetID is zero" : "localDataSetID: " + localDataSetId);
                sb.AppendLine("");
                sb.AppendLine(e.ExceptionToString());
                WriteEventLogEntry(sb.ToString());
                sb.Clear();
                sb.Destroy();
                throw;
            }
            finally
            {
                myDal.Destroy();
                CloseConnection(dbConn);
            }
        }