예제 #1
0
        //code for story 6
        public List <Testsearch> SearchallTestType(DateTime fromDate, DateTime toDate)
        {
            Query   = "SELECT SUM(Fee) AS Total,COUNT(*) AS TotalTest,TestTypeName  FROM TESTwithPatientandType WHERE  DateofIssue BETWEEN '" + fromDate + "' AND '" + toDate + "'  GROUP BY TestTypeName";
            Command = new SqlCommand(Query, Connection);
            List <Testsearch> testSearch = new List <Testsearch>();

            Connection.Open();
            SqlDataReader reader = Command.ExecuteReader();

            while (reader.Read())
            {
                Testsearch aTestsearch = new Testsearch();

                aTestsearch.TestType = reader["TestTypeName"].ToString();
                if (reader["TotalTest"] == null)
                {
                    aTestsearch.TotalTest = 0;
                }
                else
                {
                    aTestsearch.TotalTest = (int)reader["TotalTest"];
                }

                aTestsearch.TotalFee = Convert.ToDouble(reader["Total"]);
                testSearch.Add(aTestsearch);
            }
            Connection.Close();
            reader.Close();
            return(testSearch);
        }
        //code for story 6
        public List <Testsearch> SearchallTestType(DateTime fromDate, DateTime toDate)
        {
            List <Testsearch> testtypes = _atestGatewaysrb.SearchallTestType(fromDate, toDate);

            if (testtypes.Count == 0)
            {
                Testsearch aTestsearch = new Testsearch();
                aTestsearch.TestType  = "0";
                aTestsearch.TotalTest = 0;
                aTestsearch.TotalFee  = 0;
                testtypes.Add(aTestsearch);
                return(testtypes);
            }
            else
            {
                return(testtypes);
            }
        }