Esempio n. 1
0
        private void btnLoadImage_Click(object sender, EventArgs e)
        {
            if (_SelectedBuilding == null)
            {
                Controller.HandleError("Please select a building.", "Validation Error");
                return;
            }
            if (openImage.ShowDialog() == DialogResult.OK)
            {
                byte[] jpg = File.ReadAllBytes(openImage.FileName);

                var img = ImageUtils.MaxSizeImage(jpg, 350, 150);
                clientPortal.SaveBuildingImage(_SelectedBuilding.ID, img);
                LoadBuildingImage(_SelectedBuilding);
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                String newImage = (imgWeb != imgLocal1 && !String.IsNullOrEmpty(copyPic1) ? Path.GetFileName(copyPic2) : Path.GetFileName(webPic2));
                var    image    = File.ReadAllBytes(newImage);

                var result = _ClientPortal.SaveBuildingImage(building.ID, ImageUtils.ResizeBuildingImage(image));
                using (var mem = new MemoryStream(result))
                {
                    picImage.Image = Image.FromStream(mem);
                }
            }
            catch (Exception ex)
            {
                Controller.HandleError(ex);
            }
        }