コード例 #1
0
ファイル: EmployerTranslator.cs プロジェクト: nitware/odigo
        public override EMPLOYER TranslateToEntity(Employer model)
        {
            try
            {
                EMPLOYER entity = null;
                if (model != null)
                {
                    entity               = new EMPLOYER();
                    entity.Person_Id     = model.Person.Id;
                    entity.Employer_Name = model.Name;
                    entity.Website       = model.Website;

                    if (model.Sex != null)
                    {
                        entity.Sex_Id = model.Sex.Id;
                    }

                    entity.PERSON = _personTranslator.TranslateToEntity(model.Person);
                    if (model.LoginDetail != null && model.LoginDetail.Person != null)
                    {
                        entity.PERSON.PERSON_LOGIN = _loginDetalTranslator.Translate(model.LoginDetail);
                    }
                    //if (model.Payments != null && model.Payments.Count > 0)
                    //{
                    //    entity.PERSON.PAYMENT = _paymentTranslator.Translate(model.Payments);
                    //}
                }

                return(entity);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public override TEACHER TranslateToEntity(Teacher model)
        {
            try
            {
                TEACHER entity = null;
                if (model != null)
                {
                    entity                        = new TEACHER();
                    entity.Person_Id              = model.Person.Id;
                    entity.Teacher_Type_Id        = model.Type.Id;
                    entity.Rating_Id              = model.Rating.Id;
                    entity.Verification_Status_Id = model.VerificationStatus.Id;
                    entity.Availability_Status_Id = model.AvailabilityStatus.Id;
                    entity.Sex_Id                 = model.Sex.Id;
                    entity.Image_File_Url         = model.ImageFileUrl;
                    entity.Date_Of_Birth          = model.DateOfBirth;
                    entity.Home_Town              = model.HomeTown;
                    entity.Home_Address           = model.HomeAddress;

                    entity.PERSON          = _personTranslator.TranslateToEntity(model.Person);
                    entity.TEACHER_REFEREE = _refereeTranslator.TranslateToEntity(model.Referee);
                    entity.TEACHER_EDUCATIONAL_QUALIFICATION = _teacherEducationalQualificationTranslator.Translate(model.EducationalQualifications);

                    if (model.EmploymentHistories != null && model.EmploymentHistories.Count > 0)
                    {
                        entity.TEACHER_EMPLOYMENT_HISTORY = _teacherEmploymentHistoryTranslator.Translate(model.EmploymentHistories);
                    }
                    entity.TEACHER_STUDENT_CATEGORY = _teacherStudentCategoryTranslator.Translate(model.StudentCategories);
                    entity.TEACHER_AVAILABILITY     = _teacherAvailabilityTranslator.Translate(model.TeacherAvailabilities);

                    if (model.TeacherAwards != null && model.TeacherAwards.Count > 0)
                    {
                        entity.TEACHER_AWARD = _teacherAwardTranslator.Translate(model.TeacherAwards);
                    }

                    if (model.LoginDetail != null && model.LoginDetail.Person != null)
                    {
                        entity.PERSON.PERSON_LOGIN = loginDetalTranslator.Translate(model.LoginDetail);
                    }
                }

                return(entity);
            }
            catch (Exception)
            {
                throw;
            }
        }