internal override bool Insert(string code, string name, string mail, string departmentCode) { using (var db = new SampleModelContainer()) { try { //重複チェック if (db.Employees.Any(e => e.Code == code || e.MailAddress == mail)) { return false; } var dept = db.Departments.First(d => d.Code == departmentCode); var employee = new Employee() { Code = code, Name = name, MailAddress = mail, Department = dept, }; db.Employees.Add(employee); db.SaveChanges(); Employees.Add(new ModelEmployee() { Code = code, Name = name, MailAddress = mail, ModelDepartment = Departments.First(d => d.Code == dept.Code) }); OnUpdate(); } catch { return false; } } return true; }
public void AddUnionMember(int id, Employee e) { unionMembers[id] = e; }
public void AddEmployee(Employee employee) { employees[employee.EmpId] = employee; }
public static void AddUnionMember_Static(int id, Employee e) { instance.AddUnionMember(id, e); }
public static void AddEmployee_Static(Employee employee) { instance.AddEmployee(employee); }