private void DoDelete(PersonLanguageProficiency languageProficiencyToDelete)
 {
     if (languageProficiencyToDelete != null)
     {
         Context.PersonLanguageProficiencies.Remove(languageProficiencyToDelete);
     }
 }
Пример #2
0
        public bool Insert(PersonLanguageProficiency personlanguageproficiency)
        {
            int autonumber = 0;
            PersonLanguageProficiencyDAC personlanguageproficiencyComponent = new PersonLanguageProficiencyDAC();
            bool endedSuccessfuly = personlanguageproficiencyComponent.InsertNewPersonLanguageProficiency(ref autonumber, personlanguageproficiency.PersonId, personlanguageproficiency.LanguageId, personlanguageproficiency.CanRead, personlanguageproficiency.CanWrite, personlanguageproficiency.CanSpeak);

            if (endedSuccessfuly)
            {
                personlanguageproficiency.PersonLanguageProficiencyId = autonumber;
            }
            return(endedSuccessfuly);
        }
Пример #3
0
        public List <PersonLanguageProficiency> GetAll()
        {
            PersonLanguageProficiencyDAC _personLanguageProficiencyComponent = new PersonLanguageProficiencyDAC();
            IDataReader reader = _personLanguageProficiencyComponent.GetAllPersonLanguageProficiency().CreateDataReader();
            List <PersonLanguageProficiency> _personLanguageProficiencyList = new List <PersonLanguageProficiency>();

            while (reader.Read())
            {
                if (_personLanguageProficiencyList == null)
                {
                    _personLanguageProficiencyList = new List <PersonLanguageProficiency>();
                }
                PersonLanguageProficiency _personLanguageProficiency = new PersonLanguageProficiency();
                if (reader["PersonLanguageProficiencyId"] != DBNull.Value)
                {
                    _personLanguageProficiency.PersonLanguageProficiencyId = Convert.ToInt32(reader["PersonLanguageProficiencyId"]);
                }
                if (reader["PersonId"] != DBNull.Value)
                {
                    _personLanguageProficiency.PersonId = Convert.ToInt32(reader["PersonId"]);
                }
                if (reader["LanguageId"] != DBNull.Value)
                {
                    _personLanguageProficiency.LanguageId = Convert.ToInt32(reader["LanguageId"]);
                }
                if (reader["CanRead"] != DBNull.Value)
                {
                    _personLanguageProficiency.CanRead = Convert.ToBoolean(reader["CanRead"]);
                }
                if (reader["CanWrite"] != DBNull.Value)
                {
                    _personLanguageProficiency.CanWrite = Convert.ToBoolean(reader["CanWrite"]);
                }
                if (reader["CanSpeak"] != DBNull.Value)
                {
                    _personLanguageProficiency.CanSpeak = Convert.ToBoolean(reader["CanSpeak"]);
                }
                _personLanguageProficiency.NewRecord = false;
                _personLanguageProficiencyList.Add(_personLanguageProficiency);
            }
            reader.Close();
            return(_personLanguageProficiencyList);
        }
Пример #4
0
        public PersonLanguageProficiency GetByID(int _personLanguageProficiencyId)
        {
            PersonLanguageProficiencyDAC _personLanguageProficiencyComponent = new PersonLanguageProficiencyDAC();
            IDataReader reader = _personLanguageProficiencyComponent.GetByIDPersonLanguageProficiency(_personLanguageProficiencyId);
            PersonLanguageProficiency _personLanguageProficiency = null;

            while (reader.Read())
            {
                _personLanguageProficiency = new PersonLanguageProficiency();
                if (reader["PersonLanguageProficiencyId"] != DBNull.Value)
                {
                    _personLanguageProficiency.PersonLanguageProficiencyId = Convert.ToInt32(reader["PersonLanguageProficiencyId"]);
                }
                if (reader["PersonId"] != DBNull.Value)
                {
                    _personLanguageProficiency.PersonId = Convert.ToInt32(reader["PersonId"]);
                }
                if (reader["LanguageId"] != DBNull.Value)
                {
                    _personLanguageProficiency.LanguageId = Convert.ToInt32(reader["LanguageId"]);
                }
                if (reader["CanRead"] != DBNull.Value)
                {
                    _personLanguageProficiency.CanRead = Convert.ToBoolean(reader["CanRead"]);
                }
                if (reader["CanWrite"] != DBNull.Value)
                {
                    _personLanguageProficiency.CanWrite = Convert.ToBoolean(reader["CanWrite"]);
                }
                if (reader["CanSpeak"] != DBNull.Value)
                {
                    _personLanguageProficiency.CanSpeak = Convert.ToBoolean(reader["CanSpeak"]);
                }
                _personLanguageProficiency.NewRecord = false;
            }
            reader.Close();
            return(_personLanguageProficiency);
        }
 private void DoUpdate(UpdatedPersonLanguageProficiency updatedLanguageProficiency, PersonLanguageProficiency modelToUpdate)
 {
     Contract.Requires(updatedLanguageProficiency != null, "The updatedLanguageProficiency must not be null.");
     throwIfLanguageProficiencyNotFound(modelToUpdate, updatedLanguageProficiency.LanguageId);
     if (updatedLanguageProficiency.NewLanguageId.HasValue && updatedLanguageProficiency.NewLanguageId != modelToUpdate.LanguageId)
     {
         DoDelete(modelToUpdate);
         User user = updatedLanguageProficiency.Update.User;
         var  newLanguageProficiency = new NewPersonLanguageProficiency(updatedLanguageProficiency.Update.User, updatedLanguageProficiency.PersonId, updatedLanguageProficiency.NewLanguageId.Value,
                                                                        updatedLanguageProficiency.IsNativeLanguage, updatedLanguageProficiency.SpeakingProficiency, updatedLanguageProficiency.ReadingProficiency, updatedLanguageProficiency.ComprehensionProficiency);
         var person = Context.People.Find(updatedLanguageProficiency.PersonId);
         var temp   = DoCreate(newLanguageProficiency, person);
     }
     else
     {
         modelToUpdate.LanguageId               = (updatedLanguageProficiency.NewLanguageId.HasValue) ? updatedLanguageProficiency.NewLanguageId.Value : updatedLanguageProficiency.LanguageId;
         modelToUpdate.IsNativeLanguage         = updatedLanguageProficiency.IsNativeLanguage;
         modelToUpdate.SpeakingProficiency      = updatedLanguageProficiency.SpeakingProficiency;
         modelToUpdate.ReadingProficiency       = updatedLanguageProficiency.ReadingProficiency;
         modelToUpdate.ComprehensionProficiency = updatedLanguageProficiency.ComprehensionProficiency;
         updatedLanguageProficiency.Update.SetHistory(modelToUpdate);
     }
     if (updatedLanguageProficiency.IsNativeLanguage)
     {
         SetAllLanguagesNotNative(updatedLanguageProficiency.PersonId, updatedLanguageProficiency.LanguageId);
     }
 }
Пример #6
0
        public bool Update(PersonLanguageProficiency personlanguageproficiency, int old_personLanguageProficiencyId)
        {
            PersonLanguageProficiencyDAC personlanguageproficiencyComponent = new PersonLanguageProficiencyDAC();

            return(personlanguageproficiencyComponent.UpdatePersonLanguageProficiency(personlanguageproficiency.PersonId, personlanguageproficiency.LanguageId, personlanguageproficiency.CanRead, personlanguageproficiency.CanWrite, personlanguageproficiency.CanSpeak, old_personLanguageProficiencyId));
        }