Ejemplo n.º 1
0
 private void button3_Click(object sender, EventArgs e)
 {
     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
     {
         dgv_History.DataSource = BLL_HISTORY.filterPage(s, end, PageCur - 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;
             }
         }
     }
     if (PageCur == 1)
     {
         button3.Enabled = false;
         button2.Enabled = true;
     }
 }
Ejemplo n.º 2
0
 private void button5_Click(object sender, EventArgs e)
 {
     s   = (DateTime)dtp_Start.Value;
     end = (DateTime)dtp_End.Value;
     if (s > end)
     {
         MessageBox.Show("Vui lòng chọn lại thời gian bắt đầu và kết thúc", "Lỗi lọc");
     }
     else
     {
         dgv_history.DataSource = BLL_HISTORY.filterByPer(s, end, idps);
         if (dgv_history.Rows.Count > 0)
         {
             dayEnd   = dgv_history.Rows[0].Cells["NGAY"].Value.ToString();
             dayStart = dgv_history.Rows[dgv_history.Rows.Count - 1].Cells["NGAY"].Value.ToString();
         }
     }
 }
Ejemplo n.º 3
0
        private void dgv_AllEmp_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            txt_HoTen.Text = dgv_AllEmp.Rows[e.RowIndex].Cells["NAME"].Value.ToString();
            url_Face_Cur   = dgv_AllEmp.Rows[e.RowIndex].Cells["IMG_FACE"].Value.ToString();
            try
            {
                Bitmap img = new Bitmap(url_Face_Cur);
                ptb_ImageCustomer.Image = img;
            }
            catch (Exception)
            {
                ptb_ImageCustomer.Image = new Bitmap(Application.StartupPath + @"\File\noimagefound.Jpg");
            }

            ptb_ImageCustomer.SizeMode = PictureBoxSizeMode.StretchImage;
            txt_Cmt.Text    = dgv_AllEmp.Rows[e.RowIndex].Cells["CMT"].Value.ToString();
            txt_Email.Text  = dgv_AllEmp.Rows[e.RowIndex].Cells["EMAIL"].Value.ToString();
            txt_GhiChu.Text = dgv_AllEmp.Rows[e.RowIndex].Cells["GHICHU"].Value.ToString();
            txt_SDT.Text    = dgv_AllEmp.Rows[e.RowIndex].Cells["PHONE"].Value.ToString();
            if (dgv_AllEmp.Rows[e.RowIndex].Cells["GT"].Value.ToString() == "Nam")
            {
                rbn_Nam.Checked = true;
            }
            else
            {
                rbn_Nu.Checked = true;
            }
            dtp_birthday.Text = dgv_AllEmp.Rows[e.RowIndex].Cells["BIRTHDAY"].Value.ToString();
            txt_DiaChi.Text   = dgv_AllEmp.Rows[e.RowIndex].Cells["ADDRESS"].Value.ToString();
            idps = int.Parse(dgv_AllEmp.Rows[e.RowIndex].Cells["ID_PS"].Value.ToString());
            dgv_history.DataSource = BLL_HISTORY.getByEmp(idps);
            if (dgv_history.Rows.Count > 0)
            {
                dayEnd   = dgv_history.Rows[0].Cells["NGAY"].Value.ToString();
                dayStart = dgv_history.Rows[dgv_history.Rows.Count - 1].Cells["NGAY"].Value.ToString();
            }
            emp = DAL_EMPLOYEE.getEmpByIDPER(idps);
        }
Ejemplo n.º 4
0
        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;
                }
            }
        }