private void dtgUngVien_SelectionChanged(object sender, EventArgs e)
        {
            if (dtgUngVien["hinhanh", dtgUngVien.CurrentRow.Index].Value.ToString().Length != 0)
            {
                //MessageBox.Show(dtgNhanVien["hinhanh", dtgNhanVien.CurrentRow.Index].Value.ToString().Length.ToString());
                DataTable dt = new DataTable();
                dt = ungvien.LayHinhTheoUngVien(dtgUngVien["maungvien", dtgUngVien.CurrentRow.Index].Value.ToString());
                DataRow dr;
                dr = dt.Rows[0];
                byte[] Hinh = new byte[0];
                Hinh = (byte[])dr["hinhanh"];
                MemoryStream stream = new MemoryStream(Hinh);
                PicHinh.SizeMode = PictureBoxSizeMode.Zoom;
                PicHinh.Image    = Image.FromStream(stream);

                cohinh = 1;

                PicHinh.Refresh();
            }
            else
            {
                if (File.Exists(Application.StartupPath + "\\Images\\NoImage.bmp"))
                {
                    PicHinh.SizeMode = PictureBoxSizeMode.StretchImage;
                    PicHinh.Image    = Image.FromFile(Application.StartupPath + "\\Images\\NoImage.bmp");
                }

                cohinh = 0;
            }
        }
Exemple #2
0
        public void PhongChange()
        {
            if (dtgPhongBan.CurrentRow != null)
            {
                tocontrol.HienThi(dtgPhongBan["maphong", dtgPhongBan.CurrentRow.Index].Value.ToString(), txtMaTo, txtTenTo, cmbToTruong, cmbPhongBan, txtghichuTo, dtgToLamViec, bnToLamViec);
                if (cachhienthinhanvien == 0)
                {
                    nhanviencontrol.HienthiNhanVienTheoPhong(dtgPhongBan["maphong", dtgPhongBan.CurrentRow.Index].Value.ToString(), dtgNhanVien, bnNhanVien);
                }
                //else
                //{
                //    dtToTheoPhong = to.LayToLamViecTheoPhong(dtgPhongBan["maphong", dtgPhongBan.CurrentRow.Index].Value.ToString());
                //    if (dtToTheoPhong.Rows.Count == 0)
                //        nhanviencontrol.HienthiNhanVienTheoTo(null, dtgNhanVien, bnNhanVien);
                //}

                if (dtgPhongBan["cmbcolTruongPhong", dtgPhongBan.CurrentRow.Index].Value.ToString().Length == 0)
                {
                    if (File.Exists(Application.StartupPath + "\\Images\\NoImage.bmp"))
                    {
                        PicHinh.SizeMode = PictureBoxSizeMode.StretchImage;
                        PicHinh.Image    = Image.FromFile(Application.StartupPath + "\\Images\\NoImage.bmp");
                    }
                }

                dtNhanVien = nhanvien.LayNhanVien();
                foreach (DataRow dr in dtNhanVien.Rows)
                {
                    if (dtgPhongBan["cmbcolTruongPhong", dtgPhongBan.CurrentRow.Index].Value.ToString() == dr["manv"].ToString())
                    {
                        if (dr["hinhanh"].ToString().Length != 0)
                        {
                            byte[] Hinh = new byte[0];
                            Hinh = (byte[])dr["hinhanh"];
                            MemoryStream stream = new MemoryStream(Hinh);
                            PicHinh.SizeMode = PictureBoxSizeMode.Zoom;
                            PicHinh.Image    = Image.FromStream(stream);

                            PicHinh.Refresh();
                        }
                        else
                        {
                            if (File.Exists(Application.StartupPath + "\\Images\\NoImage.bmp"))
                            {
                                PicHinh.SizeMode = PictureBoxSizeMode.StretchImage;
                                PicHinh.Image    = Image.FromFile(Application.StartupPath + "\\Images\\NoImage.bmp");
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemple #3
0
 private void bntXoay4_Click(object sender, EventArgs e)
 {
     PicHinh.Image.RotateFlip(RotateFlipType.Rotate180FlipNone);
     PicHinh.Refresh();//xoaylen
     click = 0;
 }
Exemple #4
0
 private void bntXoay2_Click(object sender, EventArgs e)
 {
     PicHinh.Image.RotateFlip(RotateFlipType.Rotate90FlipXY);
     PicHinh.Refresh();
     click = 0;
 }