コード例 #1
0
ファイル: ProjectsDAL.cs プロジェクト: anaspoiala/borderless
        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);
        }
コード例 #2
0
ファイル: ProjectsDAL.cs プロジェクト: anaspoiala/borderless
        private Language GetSourceLanguageFromDataReader(SqlDataReader dataReader)
        {
            var languageDAL      = new LanguagesDAL(_connectionString);
            var sourceLanguageId = dataReader.GetGuid(dataReader.GetOrdinal("SourceLanguageID"));
            var sourceLanguage   = languageDAL.ReadById(sourceLanguageId);

            return(sourceLanguage);
        }