예제 #1
0
        public List <TestWiseReportManager> SearchDateWiseInfo(TestWiseReportClass aTestWiseReportClass)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select TestName,COUNT(asp.TestName) as Total_Test,Fee,Date from asp WHERE Date Between '" +
                                       aTestWiseReportClass.FromDate + "' and '" + aTestWiseReportClass.ToDate +
                                       "'group by TestName,Fee,Date";
            SqlCommand command = new SqlCommand(query, connection);
            List <TestWiseReportManager> aList = new List <TestWiseReportManager>();

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    TestWiseReportManager aTestWiseReportManager = new TestWiseReportManager();
                    aTestWiseReportManager.TestName  = reader["TestName"].ToString();
                    aTestWiseReportManager.TotalTest = Convert.ToInt32(reader["Total_Test"].ToString());
                    aTestWiseReportManager.Fee       = Convert.ToDouble(reader["Fee"].ToString());
                    aTestWiseReportManager.TotalFee  = aTestWiseReportManager.GetTotalFee(aTestWiseReportManager.TotalTest,
                                                                                          aTestWiseReportManager.Fee);
                    aTestWiseReportManager.total = aTestWiseReportManager.GetTotal(aTestWiseReportManager.TotalFee);
                    aTestWiseReportClass.total  += aTestWiseReportManager.total;
                    aList.Add(aTestWiseReportManager);
                }
                reader.Close();
            }
            connection.Close();
            return(aList);
        }
예제 #2
0
        protected void searchButton_Click(object sender, EventArgs e)
        {
            TestWiseReportManager aTestWiseReportManager = new TestWiseReportManager();
            TestWiseReportClass   aTestWiseReportClass   = new TestWiseReportClass();

            aTestWiseReportClass.FromDate = Convert.ToDateTime(fromDateTextBox.Text);
            aTestWiseReportClass.ToDate   = Convert.ToDateTime(toDateTextBox.Text);


            List <TestWiseReportManager> aList = aTestWiseReportManager.SearchDateWiseInfo(aTestWiseReportClass);

            totalTextBox.Text       = aTestWiseReportClass.total.ToString();
            showGridView.DataSource = aList;
            showGridView.DataBind();
        }