Ejemplo n.º 1
0
        private void dgvLich_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            txtMaCN_QLCC.Text    = dgvLich.CurrentRow.Cells[0].Value.ToString();
            dgvGiolam.DataSource = cnb.ViewGioLamViec("SELECT MaCaLV,Thu,GioToi,GioVe,DiTre,Tong,[Ngay/Thang/Nam],GioLamViec.MaNV,MaGioLamViec,Ho,Ten,Hinh FROM GioLamViec,CongNhan WHERE GioLamViec.MaNV=CongNhan.MaNV AND GioLamViec.MaNV='" + dgvLich.CurrentRow.Cells[0].Value.ToString() + "' AND DATEPART(MONTH,[Ngay/Thang/Nam])=" + dgvLich.CurrentRow.Cells[32].Value.ToString() + " AND YEAR([Ngay/Thang/Nam])=" + dgvLich.CurrentRow.Cells[33].Value.ToString()).ToList();
            txtHo_QLCC.Text      = dgvGiolam.CurrentRow.Cells[9].Value.ToString();
            txtTen_QLCC.Text     = dgvGiolam.CurrentRow.Cells[10].Value.ToString();
            //picCN_QLCC.Image = Image.FromFile(dgvGiolam.CurrentRow.Cells[11].Value.ToString());
            lbThang.Text = dgvLich.CurrentRow.Cells[32].Value.ToString();
            lbNam.Text   = dgvLich.CurrentRow.Cells[33].Value.ToString();
            int j = 0;

            for (int i = 1; i <= 31; i++)
            {
                if ((bool)dgvLich.CurrentRow.Cells[i].Value)
                {
                    j++;
                }
                lbTongngay.Text = j.ToString();
            }
            try
            {
                lbTonggio.Text = cnb.ViewLuong("SELECT *FROM Luong WHERE MaNV='" + txtMaCN_QLCC.Text + "'")[0].GioLamViec.ToString();
            }
            catch (Exception p)
            {
                MessageBox.Show(p.ToString());
            }
        }