예제 #1
0
 void reportDocument_ImageProcessing(object sender, ImageEventArgs e)
 {
     if (_clinic.Logo != null)
     {
         e.Image.Source = ImageDataConverter.BytesToBitmapImage(_clinic.Logo);
     }
 }
예제 #2
0
        public ClinicInfoManageViewModel()
        {
            if (App.Current != null)
            {
                _esClinicContext = App.Current.EsClinicContext;
            }

            LogoImg = new BitmapImage(new Uri("/ESClinic;component/Resources/Placeholder.jpg", UriKind.Relative));
            NotifyOfPropertyChange(() => LogoImg);

            var info = _esClinicContext.ClinicInfoes.FirstOrDefault();

            if (info != null)
            {
                _info         = info;
                ClinicName    = info.Name;
                ClinicAddress = info.Address;
                ClinicPhone   = info.Phone;
                if (info.Logo != null)
                {
                    LogoImg = ImageDataConverter.BytesToBitmapImage(info.Logo);
                    NotifyOfPropertyChange(() => LogoImg);
                }
            }
            else
            {
                _info = new ClinicInfo();
                _esClinicContext.ClinicInfoes.Add(_info);
                _esClinicContext.SaveChanges();
            }
        }
        public EndoscopyRecordViewModel(EndoscopyRecord esRecord)
        {
            DisplayName = "Xem kết quả nội soi";
            if (App.Current != null)
            {
                _esClinicContext = App.Current.EsClinicContext;
            }

            EsImages = new BindableCollection <BitmapImage>();
            var esImages =
                _esClinicContext.EndoscopyPhotoes.ToList().Where(e => e.EndoscopyRecordId == esRecord.EndoscopyRecordId);

            foreach (var image in esImages)
            {
                EsImages.Add(ImageDataConverter.BytesToBitmapImage(image.Photo));
            }

            var type = _esClinicContext.EndoscopyTypes.ToList()
                       .FirstOrDefault(e => e.EndoScopyTypeId == esRecord.EndoscopyTypeId);

            if (type != null)
            {
                ResultTitle = "Mục nội soi: " + type.Name;
            }
            NotifyOfPropertyChange(() => ResultTitle);

            Result = esRecord.Result;
            NotifyOfPropertyChange(() => Result);
        }
예제 #4
0
        public HomeViewModel()
        {
            _user = App.Current.User;

            var clinic = App.Current.EsClinicContext.ClinicInfoes.FirstOrDefault();

            if (clinic == null)
            {
                if (_user.ManagementAccessible)
                {
                    MessageBox.Show(InfoMessages.WRN_FILL_CLINIC_INFO);
                }
            }
            else
            {
                ClinicName    = clinic.Name;
                ClinicAddress = clinic.Address;
                ClinicPhone   = clinic.Phone;
                NotifyOfPropertyChange(() => ClinicName);
                NotifyOfPropertyChange(() => ClinicAddress);
                NotifyOfPropertyChange(() => ClinicPhone);
                if (clinic.Logo != null)
                {
                    LogoImage = ImageDataConverter.BytesToBitmapImage(clinic.Logo);
                    NotifyOfPropertyChange(() => LogoImage);
                }
            }
        }
예제 #5
0
 private void reportDocument_ImageProcessing(object sender, ImageEventArgs e)
 {
     if (e.Image.Name == "ClinicLogo")
     {
         if (_clinic.Logo != null)
         {
             e.Image.Source = ImageDataConverter.BytesToBitmapImage(_clinic.Logo);
         }
     }
     else
     {
         if (_count < _nPhoto)
         {
             e.Image.Source = ImageDataConverter.BytesToBitmapImage(_esRecord.EndoscopyPhotoes.ElementAt(_count).Photo);
         }
         else
         {
             e.Image.Visibility = Visibility.Collapsed;
         }
         _count++;
     }
 }