public Attendnces() { employee = new Employee(); }
public void AddRecord(Employee employee) { byte[] img = null; FileStream fs = new FileStream(employee.ImageLoc, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); img = br.ReadBytes((int)fs.Length); connection.Open(); //set up command SqlCommand command = new SqlCommand("eprocedureInsertEmployee", connection); //set up commandType command.CommandType = CommandType.StoredProcedure; //set up parameters command.Parameters.AddWithValue("@EmoloyeeID", employee.EmoloyeeID); command.Parameters.AddWithValue("@FirstName", employee.FirstName); command.Parameters.AddWithValue("@MiddleName", employee.MiddleName); command.Parameters.AddWithValue("@LastName", employee.LastName); command.Parameters.AddWithValue("@Age", employee.Age); command.Parameters.AddWithValue("@Birthday", employee.Birthday); command.Parameters.AddWithValue("@Sex", employee.Sex); command.Parameters.AddWithValue("@City", employee.City); command.Parameters.AddWithValue("@Province", employee.Province); command.Parameters.AddWithValue("@Street", employee.Street); command.Parameters.AddWithValue("@Country", employee.Country); command.Parameters.AddWithValue("@Religion", employee.Religion); command.Parameters.AddWithValue("@CivilStatus", employee.CivilStatus); command.Parameters.AddWithValue("@NoOfChild", employee.NoOfChild); command.Parameters.AddWithValue("@NoOfDependent", employee.NoOfDependent); command.Parameters.AddWithValue("@Position", employee.Position); command.Parameters.AddWithValue("@Salary", employee.Salary); command.Parameters.AddWithValue("@EmployeePicture", img); command.Parameters.AddWithValue("@TertiarySchool", employee.TertiarySchool); command.Parameters.AddWithValue("@TertiaryYear", employee.TertiaryYear); command.Parameters.AddWithValue("@SecondarySchool", employee.SecondarySchool); command.Parameters.AddWithValue("@SecondaryYear", employee.SecondaryYear); command.Parameters.AddWithValue("@ElementarySchool", employee.ElementarySchool); command.Parameters.AddWithValue("@ElementaryYear", employee.ElementaryYear); command.Parameters.AddWithValue("@DateHired", employee.DateHired); command.ExecuteNonQuery(); connection.Close(); }
public Leaves() { employee = new Employee(); }