Beispiel #1
0
        private void btnMatDoSuDung_ThongKe_Click(object sender, EventArgs e)
        {
            if (cbMatDoSuDung_Thang.Text != "")
            {
                List <PhongDTO> dsphg = new List <PhongDTO>();
                dsphg = PhongBUS.LayDSPhong();
                int[] arrNgayThue = new int[dsphg.Count];
                arrNgayThue = PhongBUS.LapBaoCaoMatDo(Int32.Parse(cbMatDoSuDung_Thang.Text));

                int tong = 0;
                for (int i = 0; i < dsphg.Count; i++)
                {
                    tong += arrNgayThue[i];
                }

                dgv_MatDoSudung.Rows.Clear();
                for (int i = 0; i < dsphg.Count; i++)
                {
                    dgv_MatDoSudung.Rows.Add(i + 1, dsphg[i].MaPhong, arrNgayThue[i],
                                             (Convert.ToDouble(arrNgayThue[i]) * 100 / Convert.ToDouble(tong)).ToString("00.00") + "%");
                }
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn tháng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }