Example #1
0
        public MeasurementForm(Treatment treatment, SmileFile file, MainWindow m)
        {
            InitializeComponent();
            app       = System.Windows.Application.Current as App;
            Mantooth  = new List <MeasurementTeeth>();
            Autotooth = new List <MeasurementTeeth>();
            DB        = DentalSmileDBFactory.GetInstance();
            this.mw   = m;


            //TODO: DB.User = app.user.UserId;

            measurement = new Measurement();
            string treatment_id = treatment.Id;

            if (treatment_id == null)
            {
                treatment_id = treatment.RefId;
            }
            measurement.Treatment = treatment_id;
            measurement.Patient   = treatment.Patient.Id;
            measurement.Pfile     = file.Id;

            string measurement_id = checkPreviousData(file.Id);

            if (measurement_id != null)
            {
                LoadMeasurementGrid(measurement_id);
            }
        }
        public MeasurementForm(Treatment treatment, SmileFile file, MainWindow m)
        {
            InitializeComponent();
            app = System.Windows.Application.Current as App;
            Mantooth = new List<MeasurementTeeth>();
            Autotooth = new List<MeasurementTeeth>();
            DB = DentalSmileDBFactory.GetInstance();
            this.mw = m;
            
            
            //TODO: DB.User = app.user.UserId;

            measurement = new Measurement();
            string treatment_id = treatment.Id;
            if (treatment_id == null)
            {
                treatment_id = treatment.RefId;
            }
            measurement.Treatment = treatment_id;
            measurement.Patient = treatment.Patient.Id;
            measurement.Pfile = file.Id;

            string measurement_id = checkPreviousData(file.Id) ;
            if(measurement_id !=null)
            { LoadMeasurementGrid(measurement_id); }

        }
Example #3
0
//        public MainViewModel(IFileDialogService fds, HelixViewport3D hv, ModelVisual3D rootModel)
        public MainViewModel(IFileDialogService fds, HelixViewport3D hv, MainWindow window)
        {
            Expansion              = 1;
            FileDialogService      = fds;
            HelixView              = hv;
            FileOpenCommand        = new DelegateCommand(FileOpen);
            FileOpenRawCommand     = new DelegateCommand(FileOpenRaw);
            FileExportCommand      = new DelegateCommand(FileExport);
            FileExportRawCommand   = new DelegateCommand(FileExportRaw);
            FileExitCommand        = new DelegateCommand(FileExit);
            ViewZoomExtentsCommand = new DelegateCommand(ViewZoomExtents);
            EditCopyXamlCommand    = new DelegateCommand(CopyXaml);
            EditClearAreaCommand   = new DelegateCommand(ClearArea);
            FileExportStlCommand   = new DelegateCommand(StlFileExport);


            ApplicationTitle = "Dental.Smile - 3D Viewer";

            ModelToBaseMarker = new Dictionary <Model3D, BaseMarker>();
            OriginalMaterial  = new Dictionary <Model3D, Material>();

            //Elements = new List<VisualElement>();
            //foreach (var c in hv.Children) Elements.Add(new VisualElement(c));

            DB         = DentalSmileDBFactory.GetInstance();
            Treatment  = new Treatment();
            SmileFile  = new SmileFile();
            Patient    = new Patient();
            JawVisual  = new JawVisual3D(Patient);
            RootVisual = window.vmodel;
            app        = Application.Current as App;

            RootVisual.Children.Add(JawVisual);
            this.window = window;
        }
Example #4
0
        private void filesDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SmileFile f = filesDataGrid.SelectedItem as SmileFile;

            if (f != null)
            {
                navigateButton(f.Type);
            }
        }
Example #5
0
 private void btnContinueManipulation_Click(object sender, RoutedEventArgs e)
 {
     if (filesDataGrid.SelectedItem != null)
     {
         Treatment t    = treatmentsDataGrid.SelectedItem as Treatment;
         SmileFile file = filesDataGrid.SelectedItem as SmileFile;
         App.patient = t.Patient;
         MainWindow m = new MainWindow(t, file, true);
         m.Show();
         this.Close();
     }
 }
Example #6
0
 private void btnContinueManipulation_Click(object sender, RoutedEventArgs e)
 {
     if (HistoryFileListView.SelectedItem != null)
     {
         Treatment t    = HistoryListView.SelectedItem as Treatment;
         SmileFile file = HistoryFileListView.SelectedItem as SmileFile;
         App.patient = t.Patient;
         MainWindow m = new MainWindow(t, file, true);
         m.ShowDialog();
         //this.Close();
         InfoButton_Click(sender, e);
     }
 }
Example #7
0
        private void HistoryFileListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!ignoreSelection)
            {
                ignoreSelection = true;

                SmileFile selected = (SmileFile)((ListBox)sender).SelectedItem;

                if (selected != null)
                {
                    if (selected != null)
                    {
                        navigateButton(selected.Type);
                    }
                }

                ignoreSelection = false;
            }
        }
Example #8
0
        private void handleManipulationData(Treatment treatment, SmileFile file, bool duplicate)
        {
            DB  = DentalSmileDBFactory.GetInstance();
            app = Application.Current as App;
            if (App.patient == null)
            {
                App.patient = new Patient();
            }
            Patient = App.patient;

            if (treatment == null)
            {
                Treatment = new Treatment();
            }
            else
            {
                Treatment = treatment;
                if (duplicate)
                {
                    Treatment.Id = null;
                }
                Treatment.RefId = treatment.Id;
            }
            //if (file != null) SmileFile = file;

            if (file.Type == Smile.MANIPULATION)
            {
                //Load Jaw
                LoadJawFile(file.GetFile);
            }
            else if (file.Type == Smile.SCANNING)
            {
                //Load Raw
                LoadRawFile(file.GetFile);
            }

            SmileFile       = new SmileFile();
            SmileFile.RefId = file.Id;

            ViewZoomExtents();
        }
Example #9
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            //finish the treatment

            //and store the file to disk

            //and to table
            SmileFile file = new SmileFile();

            file.Id          = db.getSmileFileNewId(App.patient.Id);
            file.Type        = Smile.SCANNING;
            file.FileName    = "SCAN" + file.Id + ".obj";
            file.Screenshot  = "SCAN" + file.Id + ".png";
            file.Patient     = App.patient;
            file.Description = textBox1.Text.ToString();//"Describe about some thing by USER";

            if (db.InsertFileInfo(file))
            {
                db.insertTreatmentFiles(treatment, file);
            }
        }
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            //finish the treatment 

            //and store the file to disk 

            //and to table
            SmileFile file = new SmileFile();
            file.Id = db.getSmileFileNewId(App.patient.Id);
            file.Type = Smile.SCANNING;
            file.FileName = "SCAN"+file.Id+".obj";
            file.Screenshot = "SCAN" + file.Id + ".png";
            file.Patient = App.patient;
            file.Description = textBox1.Text.ToString();//"Describe about some thing by USER";

            if (db.InsertFileInfo(file))
            {
                db.insertTreatmentFiles(treatment, file);
            }

        }
Example #11
0
        /// <summary>
        /// Called for each item in the list. Return true if the item should be in
        /// the current result set, otherwise return false to exclude the item.
        /// </summary>
        protected override bool FilterCallback(object item)
        {
            SmileFile t = item as SmileFile;

            if (t == null)
            {
                return(false);
            }

            if (this.Filter.Matches(t.FileName) ||
                //this.Filter.Matches(t.Patient.FirstName) ||
                this.Filter.Matches(t.Screenshot) ||
                this.Filter.Matches(t.Type) ||
                this.Filter.Matches(t.Description) ||
                this.Filter.Matches(t.RefId) ||
                this.Filter.Matches(t.Id))
            {
                return(true);
            }

            return(false);
        }
Example #12
0
        private void btnStartManipulation_Click(object sender, RoutedEventArgs e)
        {
            if (HistoryFileListView.SelectedItem != null)
            {
                Treatment t    = HistoryListView.SelectedItem as Treatment;
                SmileFile file = HistoryFileListView.SelectedItem as SmileFile;

                App.patient = t.Patient;
                MainWindow m = null;
                if (t.Phase.Id.Equals(Smile.MANIPULATION))
                {
                    SmileFile reffile = DB.findSmileFileById(file.RefId);
                    m = new MainWindow(t, reffile, true);
                }
                else
                {
                    m = new MainWindow(t, file, true);
                }
                m.ShowDialog();
                //this.Close();
                InfoButton_Click(sender, e);
            }
        }
        public void UpdateFileInfo(SmileFile t)
        {
            string tableName = "pfile";
            string setColumns = "filename='" + t.FileName + "', description='" + t.Description + "', patient='" + t.Patient.Id + "', screenshot='" + t.Screenshot + "', type=" + t.Type + ", refid='" + t.RefId+ "', modified='" + DateTime.Now.ToString(Smile.LONG_DATE_FORMAT) + "', modifiedBy='" + User + "' ";
            string query = "UPDATE " + tableName + " SET " + setColumns + " WHERE id = '" + t.Id + "'";

            if (this.OpenConnection() == true)
            {
                IDbCommand cmd = getSqlCommand(query, connection);
                cmd.ExecuteNonQuery();
                this.CloseConnection();
            }
        }
Example #14
0
        //INTEGRATION
        public MainViewModel(IFileDialogService fds, HelixViewport3D hv, Treatment treatment, SmileFile file, bool duplicate, MainWindow window)
        {
            Expansion          = 1;
            FileDialogService  = fds;
            HelixView          = hv;
            FileOpenCommand    = new DelegateCommand(FileOpen);
            FileOpenRawCommand = new DelegateCommand(FileOpenRaw);
            //FileExportCommand = new DelegateCommand(FileExport);
            FileExportCommand      = new DelegateCommand(ConfirmDirectFileExport);
            FileExportRawCommand   = new DelegateCommand(FileExportRaw);
            FileExitCommand        = new DelegateCommand(FileExit);
            ViewZoomExtentsCommand = new DelegateCommand(ViewZoomExtents);
            EditCopyXamlCommand    = new DelegateCommand(CopyXaml);
            EditClearAreaCommand   = new DelegateCommand(ClearArea);
            FileExportStlCommand   = new DelegateCommand(StlFileExport);


            ApplicationTitle = "Dental Smile - 3D Viewer";

            ModelToBaseMarker = new Dictionary <Model3D, BaseMarker>();
            OriginalMaterial  = new Dictionary <Model3D, Material>();

            //Elements = new List<VisualElement>();
            //foreach (var c in hv.Children) Elements.Add(new VisualElement(c));

            this.window = window;
            RootVisual  = window.vmodel;

            handleManipulationData(treatment, file, duplicate);

            //JawVisual = new JawVisual3D(Patient);
            //RootVisual.Children.Add(JawVisual);
        }
        internal bool insertTreatmentNotes(Treatment treatment, string resume, SmileFile file, string description)
        {
            if (this.OpenConnection() == true)
            {
                string tableName = "treatment_notes";
                string columns = "(treatment, notes, pfile, description, created, createdBy)";
                string values = "";
                values = "('" + treatment.Id + "','" + resume + "','" + (file == null ? null : file.Id) + "','" + description + "','" + DateTime.Now.ToString(Smile.LONG_DATE_FORMAT) + "','" + User + "')";
                string query = "INSERT INTO " + tableName + " " + columns + " values " + values + " ;";

                IDbCommand cmd = getSqlCommand(query, connection);
                cmd.ExecuteNonQuery();

                this.CloseConnection();

                return true;
            }
            return false;
        }
        public bool insertTreatmentFiles(Treatment treatment, SmileFile file)
        {
            string tableName = "treatment_pfile";
            string columns = "(treatment, pfile)";
            string values = "('" + treatment.Id + "','" + file.Id+ "')";
            string query = "INSERT INTO " + tableName + " " + columns + " values " + values + " ;";

            if (this.OpenConnection() == true)
            {
                IDbCommand cmd = getSqlCommand(query, connection);
                cmd.ExecuteNonQuery();
                this.CloseConnection();

                return true;
            }
            return false;
        }
        private void handleManipulationData(Treatment treatment, SmileFile file, bool duplicate)
        {
            DB = DentalSmileDBFactory.GetInstance();
            app = Application.Current as App;
            if (App.patient == null) App.patient = new Patient();
            Patient = App.patient;

            if (treatment == null)
            {
                Treatment = new Treatment();
            }
            else
            {
                Treatment = treatment;
                if (duplicate)
                {
                    Treatment.Id = null;
                }
                Treatment.RefId = treatment.Id;
            }
            //if (file != null) SmileFile = file;

            if (file.Type == Smile.MANIPULATION)
            {
                //Load Jaw
                LoadJawFile(file.GetFile);
            }
            else if (file.Type == Smile.SCANNING)
            {
                //Load Raw
                LoadRawFile(file.GetFile);
            }

            SmileFile = new SmileFile();
            SmileFile.RefId = file.Id;

            ViewZoomExtents();
        }
        //INTEGRATION
        public MainViewModel(IFileDialogService fds, HelixViewport3D hv, Treatment treatment, SmileFile file, bool duplicate, MainWindow window)
        {
            Expansion = 1;
            FileDialogService = fds;
            HelixView = hv;
            FileOpenCommand = new DelegateCommand(FileOpen);
            FileOpenRawCommand = new DelegateCommand(FileOpenRaw);
            //FileExportCommand = new DelegateCommand(FileExport);
            FileExportCommand = new DelegateCommand(ConfirmDirectFileExport);            
            FileExportRawCommand = new DelegateCommand(FileExportRaw);
            FileExitCommand = new DelegateCommand(FileExit);
            ViewZoomExtentsCommand = new DelegateCommand(ViewZoomExtents);
            EditCopyXamlCommand = new DelegateCommand(CopyXaml);
            EditClearAreaCommand = new DelegateCommand(ClearArea);
            FileExportStlCommand = new DelegateCommand(StlFileExport);            

            
            ApplicationTitle = "Dental Smile - 3D Viewer";

            ModelToBaseMarker = new Dictionary<Model3D, BaseMarker>();
            OriginalMaterial = new Dictionary<Model3D, Material>();

            //Elements = new List<VisualElement>();
            //foreach (var c in hv.Children) Elements.Add(new VisualElement(c));

            this.window = window;
            RootVisual = window.vmodel;
            
            handleManipulationData(treatment, file, duplicate);
            
            //JawVisual = new JawVisual3D(Patient);
            //RootVisual.Children.Add(JawVisual);
        }
//        public MainViewModel(IFileDialogService fds, HelixViewport3D hv, ModelVisual3D rootModel)
        public MainViewModel(IFileDialogService fds, HelixViewport3D hv, MainWindow window)
        {
            Expansion = 1;
            FileDialogService = fds;
            HelixView = hv;
            FileOpenCommand = new DelegateCommand(FileOpen);
            FileOpenRawCommand = new DelegateCommand(FileOpenRaw);
            FileExportCommand = new DelegateCommand(FileExport);
            FileExportRawCommand = new DelegateCommand(FileExportRaw);
            FileExitCommand = new DelegateCommand(FileExit);
            ViewZoomExtentsCommand = new DelegateCommand(ViewZoomExtents);
            EditCopyXamlCommand = new DelegateCommand(CopyXaml);
            EditClearAreaCommand = new DelegateCommand(ClearArea);
            FileExportStlCommand = new DelegateCommand(StlFileExport);            


            ApplicationTitle = "Dental.Smile - 3D Viewer";

            ModelToBaseMarker = new Dictionary<Model3D, BaseMarker>();
            OriginalMaterial = new Dictionary<Model3D, Material>();

            //Elements = new List<VisualElement>();
            //foreach (var c in hv.Children) Elements.Add(new VisualElement(c));

            DB = DentalSmileDBFactory.GetInstance();
            Treatment = new Treatment();
            SmileFile = new SmileFile();
            Patient = new Patient();
            JawVisual = new JawVisual3D(Patient);
            RootVisual = window.vmodel;
            app = Application.Current as App;

            RootVisual.Children.Add(JawVisual);
            this.window = window;

        }
        private SmileFile toSmileFile(IDataReader dataReader, bool nested)
        {
            SmileFile p = new SmileFile();
            
            p.Id = GetStringSafe(dataReader, "id");
            p.FileName = GetStringSafe(dataReader, "filename");
            p.Description = GetStringSafe(dataReader, "description");
            p.Screenshot = GetStringSafe(dataReader, "screenshot");
            p.Type = dataReader.GetInt32(dataReader.GetOrdinal("type"));
            p.RefId = GetStringSafe(dataReader, "refid");
            p.Phase = findPhaseById(p.Type);

            if(nested) p.Patient = findPatientById(GetStringSafe(dataReader, "patient"));

            return p;
        }
        public bool InsertFileInfo(SmileFile t)
        {
            string tableName = "pfile";
            string columns = "(id, filename, description, patient, screenshot, type, refid, created,createdBy)";
            string values = "('" + t.Id + "','" + t.FileName + "','" + t.Description + "','" + t.Patient.Id + "','" + t.Screenshot + "'," + t.Type + ",'" + t.RefId+ "','" + DateTime.Now.ToString(Smile.LONG_DATE_FORMAT) + "','" + User + "')";
            string query = "INSERT INTO " + tableName + " " + columns + " values " + values + " ;";

            if (this.OpenConnection() == true)
            {
                IDbCommand cmd = getSqlCommand(query, connection);
                cmd.ExecuteNonQuery();
                this.CloseConnection();
                
                return true;
            }
            return false;
        }
        //INTEGRATION with Dashboard
        public MainWindow(Treatment treatment, SmileFile file, bool duplicate)
        {
            InitializeComponent();

            //app = Application.Current as App;

            if (App.patient == null)
            {
                MessageBox.Show("Select Patient First!");
                //show PatientForm
                this.Close();
                return;
            }
            if (file == null)
            {
                MessageBox.Show("Select Raw File !");
                //show File List
                this.Close();
                return;
            }

            vm = new MainViewModel(new FileDialogService(), view1, treatment, file, duplicate, this);
            DataContext = vm;

            loadTeethNumberToChart();

            Loaded += new RoutedEventHandler(OnLoaded);
            _propertyGrid.PropertyValueChanged += new Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventHandler(_propertyGrid_PropertyValueChanged);

            mForm = new Forms.MeasurementForm(treatment,file, this);
            navigateButton("integration");
        }