コード例 #1
0
ファイル: frm_History.cs プロジェクト: hoanvu9495/FaceID
        private void button1_Click(object sender, EventArgs e)
        {
            s   = (DateTime)dateTimePicker1.Value;
            end = (DateTime)dateTimePicker2.Value;
            if (s > end)
            {
                MessageBox.Show("Vui lòng điều chỉnh lại thời gian bắt đầu và kết thúc", "Thông báo");
            }
            else
            {
                PageCount       = DAL_HISTORY.PageCount(s, end);
                button3.Enabled = false;
                if (PageCount > 1)
                {
                    button2.Enabled = true;
                }
                else
                {
                    button2.Enabled = false;
                }
                dgv_History.DataSource = BLL_HISTORY.filterPage(s, end, 1);
                if (dgv_History.Rows.Count > 0)
                {
                    DataGridViewImageColumn img = (DataGridViewImageColumn)dgv_History.Columns["AnhNV"];
                    img.ImageLayout = DataGridViewImageCellLayout.Stretch;
                    PageCur         = 1;
                    for (int i = 0; i < dgv_History.Rows.Count; i++)
                    {
                        try
                        {
                            Bitmap imgv = new Bitmap(dgv_History.Rows[i].Cells["IMG_FACE"].Value.ToString());
                            img.Image = imgv;
                        }
                        catch (Exception)
                        {
                            img.Image = new Bitmap(Application.StartupPath + @"\File\noimagefound.Jpg");
                        }

                        dgv_History.Rows[i].MinimumHeight = 80;
                    }
                }
            }
        }
コード例 #2
0
ファイル: frm_History.cs プロジェクト: hoanvu9495/FaceID
        private void loadDGV()
        {
            DateTime now = DateTime.Today;

            s               = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
            end             = new DateTime(now.Year, now.Month, now.Day, 23, 59, 0);
            PageCount       = DAL_HISTORY.PageCount(s, end);
            button3.Enabled = false;
            if (PageCount > 1)
            {
                button2.Enabled = true;
            }
            else
            {
                button2.Enabled = false;
            }
            dgv_History.DataSource = BLL_HISTORY.filterPage(s, end, 1);
            if (dgv_History.Rows.Count > 0)
            {
                DataGridViewImageColumn img = (DataGridViewImageColumn)dgv_History.Columns["AnhNV"];
                img.ImageLayout = DataGridViewImageCellLayout.Stretch;
                PageCur         = 1;
                for (int i = 0; i < dgv_History.Rows.Count; i++)
                {
                    try
                    {
                        Bitmap imgv = new Bitmap(dgv_History.Rows[i].Cells["IMG_FACE"].Value.ToString());
                        img.Image = imgv;
                    }
                    catch (Exception)
                    {
                        img.Image = new Bitmap(Application.StartupPath + @"\File\noimagefound.Jpg");
                    }

                    dgv_History.Rows[i].MinimumHeight = 80;
                }
            }
        }