Ejemplo n.º 1
0
        public static string[] GetStatistic(int catalogType, int category, FrmStatistic frm)
        {
            string[] results = new string[7] {
                "", "", "", "", "", "", ""
            };
            if (catalogType == 0 & category == 0)
            {
                return(results);
            }

            string[] queries = GetQueries(catalogType, category);

            using (SqlConnection connection = new SqlConnection(DataBase.ConStrDB))
            {
                SqlCommand cmd = connection.CreateCommand();
                connection.Open();

                for (int i = 0; i < results.Length; i++)
                {
                    cmd.CommandText = queries[i];
                    frm.tbTEST.Text = queries[i];
                    SqlDataReader reader = cmd.ExecuteReader();

                    if (!reader.HasRows)
                    {
                        results[i] = string.Empty;
                    }
                    else
                    {
                        reader.Read();
                        double price;
                        if ((i == 2 || i == 3) && double.TryParse(reader[0].ToString(), out price))
                        {
                            results[i] = price.ToString();
                        }
                        else
                        {
                            results[i] = reader[0].ToString();
                        }
                    }
                    reader.Close();
                }
            }
            return(results);
        }
Ejemplo n.º 2
0
        private void tsmMenuStatistic_Click(object sender, EventArgs e)
        {
            FrmStatistic frmStaristic = new FrmStatistic();

            frmStaristic.ShowDialog();
        }