Esempio n. 1
0
        private List <Language> ReadTargetLanguagesByProjectId(Guid projectId)
        {
            var result = new List <Language>();

            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();

                using (var command = new SqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = DbStrings.TARGET_LANGUAGES_READ_ALL_BY_PROJECT_ID;
                    command.Parameters.Add(new SqlParameter("@ProjectId", projectId));

                    using (var dataReader = command.ExecuteReader())
                    {
                        var languagesDal = new LanguagesDAL(_connectionString);

                        while (dataReader.Read())
                        {
                            var guid = dataReader.GetGuid(dataReader.GetOrdinal("LanguageID"));
                            result.Add(languagesDal.ReadById(guid));
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        private Language GetSourceLanguageFromDataReader(SqlDataReader dataReader)
        {
            var languageDAL      = new LanguagesDAL(_connectionString);
            var sourceLanguageId = dataReader.GetGuid(dataReader.GetOrdinal("SourceLanguageID"));
            var sourceLanguage   = languageDAL.ReadById(sourceLanguageId);

            return(sourceLanguage);
        }