コード例 #1
0
ファイル: MainForm.cs プロジェクト: cloughin/VoteProject.5
        private void CheckProfileContentTypeButton_Click(object sender, EventArgs e)
        {
            List <string> errors = new List <string>();

            CheckProfileContentTypeButton.Enabled = false;
            int count = 0;
            var table = PoliticiansImagesData.GetAllData();

            foreach (var row in table)
            {
                count++;
                string politicianKey = row.PoliticianKey;
                byte[] blob          =
                    PoliticiansImagesBlobs.GetProfileOriginalByPoliticianKey(politicianKey);
                if (blob != null)
                {
                    string dbContentType = PoliticiansImagesData
                                           .GetProfileOriginalContentTypeByPoliticianKey(politicianKey);
                    string actualContentType = Images.GetContentType(blob);
                    if (dbContentType != actualContentType)
                    {
                        errors.Add(String.Format("PoliticianKey: {0} Database: {1} Actual: {2}",
                                                 politicianKey,
                                                 dbContentType == null ? "<null>" : dbContentType,
                                                 actualContentType == null ? "<null>" : actualContentType));
                    }
                }
            }
        }