public void InsertDepartmentTable(ref Employee employee) { DepartmentTable deptable = new DepartmentTable(); using (HRDatabaseEntities myEntities = new HRDatabaseEntities()) { deptable.Department_Name = DepartmentNameList.Text; myEntities.DepartmentTables.Add(deptable); myEntities.SaveChanges(); employee.department_id = deptable.Department_ID; } }
public void InsertJobTable(ref Employee employee) { JobTable jobtable = new JobTable(); using (HRDatabaseEntities myEntities = new HRDatabaseEntities()) { jobtable.Job_Title = titleList.Text; jobtable.Job_Salary = decimal.Parse(JobSalaryText.Text); myEntities.JobTables.Add(jobtable); myEntities.SaveChanges(); employee.job_id = jobtable.Job_ID; } }
public void InsertHRTable(int phoneNo, Employee employee) { HRTable hrtable = new HRTable(); using (HRDatabaseEntities myEntities = new HRDatabaseEntities()) { hrtable.Name = NameText.Text; hrtable.Phone = phoneNo.ToString(); hrtable.IC = ICText.Text; hrtable.Job_ID = employee.job_id; hrtable.Department_ID = employee.department_id; myEntities.HRTables.Add(hrtable); myEntities.SaveChanges(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int s = int.Parse(GridView1.Rows[e.RowIndex].Cells[id_index].Text); using (var myEntities = new HRDatabaseEntities()) { var data = (from p in myEntities.HRTables where p.Id == s select p).Single(); myEntities.HRTables.Remove(data); myEntities.SaveChanges(); } LoadHRDatabase(); }