Пример #1
0
        private void SetHeadshotContentTypeButton_Click(object sender, EventArgs e)
        {
            List <string> errors = new List <string>();

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

            foreach (var row in table)
            {
                count++;
                string politicianKey = row.PoliticianKey;
                byte[] blob          =
                    PoliticiansImagesBlobs.GetHeadshotOriginalByPoliticianKey(politicianKey);
                if (blob != null)
                {
                    string contentType = Images.GetContentType(blob);
                    if (contentType == null)
                    {
                        errors.Add(politicianKey);
                    }
                    else
                    {
                        PoliticiansImagesData.UpdateHeadshotContentTypeByPoliticianKey(
                            contentType, politicianKey);
                    }
                }
            }
        }