public void AddStaff() { int EmpID = Convert.ToInt32(lblEmployeeID.Text); string FirstName = txtFirstName.Text; string Surname = txtSurname.Text; string Contact = txtContact.Text; string Email = txtEmail.Text; string No = txtHouseNo.Text; string Street = txtStreetName.Text; string City = txtCity.Text; int PostCode = Convert.ToInt32(txtPostCode.Text); string Designation = txtDesignation.Text; string Department = txtDepartment.Text; string JobTitle = txtJobTitle.Text; int Gender; if (rdoMale.Checked == true) { Gender = 1; } else { Gender = 2; } if (rdoAdmin.Checked == true) { JobStatus = 1; } else if (rdoManager.Checked == true) { JobStatus = 2; } else if (rdoStaff.Checked == true) { JobStatus = 3; } if (FilePath == "") { try { if (data.Length != 0) { data = new byte[] { }; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { //Image temp = new Bitmap(FilePath); //MemoryStream stream = new MemoryStream(); //temp.Save(stream, ImageFormat.Jpeg); //ImageByteArray = stream.ToArray(); Image myImage = Image.FromFile(FilePath); //byte[] data; using (MemoryStream ms = new MemoryStream()) { myImage.Save(ms, ImageFormat.Bmp); data = ms.ToArray(); } } int result = sb.AddStaff(EmpID, FirstName, Surname, Contact, Email, No, Street, City, PostCode, Designation, Department, JobTitle, Gender, JobStatus, data); if (result == 1) { MessageBox.Show("Successsfully Added"); } else { MessageBox.Show("Something went wrong"); } }