public static PersonDepartment Normalize(PersonDepartment t, Person p, Department d)
 {
     if (t == null)
         return t;
     if ((t.Person = p) != null)
         t.Person_Id = p.Id;
     if ((t.Department = d) != null)
         t.Department_Id = d.Id;
     return t;
 }
Пример #2
0
        public PersonDepartment Copy(PersonDepartment src, bool copyId = false)
        {
            var dst = this;
            if (copyId) dst.Id = src.Id;
            dst.Rank = src.Rank;
            dst.Role = src.Role;
            if (dst.Person == null)
                dst.Person = src.Person;
            else
                dst.Person.Copy(src.Person);

            if (dst.Department == null)
                dst.Department = src.Department;
            else
                dst.Department.Copy(src.Department);
            return src;
        }
 private void Bind(PersonDepartment selected, NespeDbContext db)
 {
     selected.Person = (from t in db.PersonSet where t.Id == selected.Person_Id select t).FirstOrDefault();
     selected.Department = (from t in db.DepartmentSet where t.Id == selected.Department_Id select t).FirstOrDefault();
 }
Пример #4
0
 private PersonDepartment _PersonDepartment()
 {
     return PersonDepartment != null ? PersonDepartment : PersonDepartment = new PersonDepartment { };
 }