Exemplo n.º 1
0
        void pbEmployeePhoto_Click(object sender, EventArgs e)
        {
            byte[] photo = null;
            /*Insert new Employee*/
            if (emp == null)
            {
                if (imagePath == "")
                {
                    object O   = Mart.Properties.Resources.ResourceManager.GetObject("no");
                    Image  img = (Image)O;
                    var    ms  = new MemoryStream();
                    img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    photo = ms.ToArray();
                }
                else
                {
                    photo = File.ReadAllBytes(imagePath);
                }
            }
            /*Update Employee*/
            else
            {
                if (imagePath == "")
                {
                    photo = emp.Photo;
                }
                else
                {
                    photo = File.ReadAllBytes(imagePath);
                }
            }
            FormPreviewPhoto preview = new FormPreviewPhoto(photo);

            preview.ShowDialog();
        }
Exemplo n.º 2
0
 void pbEmployeePhoto_Click(object sender, EventArgs e)
 {
     if (empLogin != null)
     {
         byte[] pho = null;
         if (imagePath == "")
         {
             pho = empLogin.Photo;
         }
         else
         {
             pho = File.ReadAllBytes(imagePath);
         }
         FormPreviewPhoto preview = new FormPreviewPhoto(pho);
         preview.ShowDialog();
     }
 }