public double GetRevenueForMonth(int year, int month, int startDay, int endDay)
        {
            using (SqlConnection con = new SqlConnection(
                       "Data Source=.;Initial Catalog=Nhom17.13A.QuanLyLinhKienDB;Integrated Security=true"))
            {
                DataTable dt = new DataTable();
                List <OrderRevenueYearDto> list = new List <OrderRevenueYearDto>();

                SqlCommand cmd = new SqlCommand("GetRevenueForMonth", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Year", SqlDbType.Int).Value     = year;
                cmd.Parameters.Add("@Month", SqlDbType.Int).Value    = month;
                cmd.Parameters.Add("@StartDay", SqlDbType.Int).Value = startDay;
                cmd.Parameters.Add("@Endday", SqlDbType.Int).Value   = endDay;

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);

                foreach (DataRow dr in dt.Rows)
                {
                    OrderRevenueYearDto obj = new OrderRevenueYearDto();

                    obj.Revenue = Convert.ToDouble(dr["TotalRevenue"].ToString());

                    list.Add(obj);
                }

                var value = Convert.ToDouble(list[0].Revenue);
                return(value);
            }
        }
        public List <OrderRevenueYearDto> GetRevenueForMonthAndYear(int year)
        {
            using (SqlConnection con = new SqlConnection(
                       "Data Source=.;Initial Catalog=Nhom17.13A.QuanLyLinhKienDB;Integrated Security=true"))
            {
                DataTable dt = new DataTable();
                List <OrderRevenueYearDto> list = new List <OrderRevenueYearDto>();

                SqlCommand cmd = new SqlCommand("GetRevenueForMonthAndYear", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Year", SqlDbType.Int).Value = year;

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);

                foreach (DataRow dr in dt.Rows)
                {
                    OrderRevenueYearDto obj = new OrderRevenueYearDto();

                    obj.Revenue = Convert.ToDouble(dr["TotalRevenue"].ToString());
                    obj.Month   = Convert.ToInt32(dr["Month"].ToString());
                    obj.Year    = Convert.ToInt32(dr["Year"].ToString());

                    list.Add(obj);
                }
                return(list);
            }
        }