public List <TypeWiseReportManager> GetTypeWiseSearchInfo(TypeWiseReportClass aTypeWiseReportClass)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      =
                "select TypeName,Count(TestName) as No_Of_Test,sum(Fee) as Total,Date from typewisetable WHERE Date Between '" +
                aTypeWiseReportClass.FromDate + "' and '" + aTypeWiseReportClass.ToDate + "' group by TypeName,Date ";
            SqlCommand command = new SqlCommand(query, connection);
            List <TypeWiseReportManager> aList = new List <TypeWiseReportManager>();

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

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    TypeWiseReportManager aWiseReportManager = new TypeWiseReportManager();
                    aWiseReportManager.TypeName  = reader["TypeName"].ToString();
                    aWiseReportManager.TotalTest = Convert.ToInt32(reader["No_Of_Test"].ToString());
                    aWiseReportManager.TotalFee  = Convert.ToDouble(reader["Total"].ToString());
                    aTypeWiseReportClass.total  += aWiseReportManager.TotalFee;
                    aList.Add(aWiseReportManager);
                }
                reader.Close();
            }
            connection.Close();
            return(aList);
        }
Exemplo n.º 2
0
        protected void searchButton_Click(object sender, EventArgs e)
        {
            TypeWiseReportManager aTypeWiseReportManager = new TypeWiseReportManager();
            TypeWiseReportClass   aTypeWiseReportClass   = new TypeWiseReportClass();

            aTypeWiseReportClass.FromDate = Convert.ToDateTime(fromDateTextBox.Text);
            aTypeWiseReportClass.ToDate   = Convert.ToDateTime(toDateTextBox.Text);
            List <TypeWiseReportManager> aList = aTypeWiseReportManager.GetTypeWiseSearchInfo(aTypeWiseReportClass);

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