Example #1
0
        private void SetTemplateContent(Templates templateItem)
        {
            switch (templateItem.Template_UserControlName)
            {
            case "TBeforeAfter":
                TBeforeAfter tBeforeAfter = new TBeforeAfter(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tBeforeAfter;
                break;

            case "TIn5s":
                TIn5s tIn5s = new TIn5s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tIn5s;
                break;

            case "TIn6s":
                TIn6s tIn6s = new TIn6s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tIn6s;
                break;

            case "TIn9s":
                TIn9s tIn9s = new TIn9s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tIn9s;
                break;

            case "TInOut9s":
                TInOut9s tInOut9s = new TInOut9s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tInOut9s;
                break;

            case "TInOut10s":
                TInOut10s tInOut10s = new TInOut10s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tInOut10s;
                break;

            case "TInOut11s":
                TInOut11s tInOut11s = new TInOut11s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tInOut11s;
                break;

            case "TXRay6s":
                TXRay6s tXRay6s = new TXRay6s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tXRay6s;
                break;

            case "TXRay19s":
                TXRay19s tXRay19s = new TXRay19s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tXRay19s;
                break;

            case "TPlasterModel5s":
                TPlasterModel5s tPlasterModel5s = new TPlasterModel5s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tPlasterModel5s;
                break;

            case "TFdi52s":
                TFdi52s tFdi52s = new TFdi52s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tFdi52s;
                break;

            case "TOthers1s":
                TOthers1s tOthers1s = new TOthers1s(Agencys, Patients, templateItem, SelectedDate);
                TemplateContent = tOthers1s;
                break;
            }

            ImportDateCollect  = new TableTemplates_Images().QueryAllTemplatesImagesImportDate(Patients, templateItem);
            SelectedImportDate = (from idc in ImportDateCollect
                                  where idc == selectedDate.ToString("yyyy/MM/dd")
                                  select idc).ToList().Count() > 0 ? selectedDate.ToString("yyyy/MM/dd") : null;
        }
        private void SetTemplateContent(Templates templateItem)
        {
            switch (templateItem.Template_UserControlName)
            {
            case "TBeforeAfter":
                //if (tBA == null)
                //{
                //    tBA = new TBeforeAfter(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tBA             = new TBeforeAfter(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tBA;
                break;

            case "TIn6s":
                //if (tI6 == null)
                //{
                //    tI6 = new TIn6s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tI6             = new TIn6s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tI6;
                break;

            case "TInOut9s":
                //if (tIO9 == null)
                //{
                //    tIO9 = new TInOut9s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tIO9            = new TInOut9s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tIO9;
                break;

            case "TInOut10s":
                //if (tIO10 == null)
                //{
                //    tIO10 = new TInOut10s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tIO10           = new TInOut10s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tIO10;
                break;

            case "TInOut11s":
                //if (tIO11 == null)
                //{
                //    tIO11 = new TInOut11s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tIO11           = new TInOut11s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tIO11;
                break;

            case "TXRay6s":
                //if (tXR6 == null)
                //{
                //    tXR6 = new TXRay6s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tXR6            = new TXRay6s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tXR6;
                break;

            case "TXRay19s":
                //if (tXR19 == null)
                //{
                //    tXR19 = new TXRay19s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tXR19           = new TXRay19s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tXR19;
                break;

            case "TPlasterModel5s":
                //if (tPM15 == null)
                //{
                //    tPM15 = new TPlasterModel5s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tPM15           = new TPlasterModel5s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tPM15;
                break;

            case "TFdi52s":
                //if (tF52 == null)
                //{
                //    tF52 = new TFdi52s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tF52            = new TFdi52s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tF52;
                break;

            case "TOthers1s":
                //if (tO1 == null)
                //{
                //    tO1 = new TOthers1s(Agencys, Patients, templateItem, TemplateImportDate);
                //}
                tO1             = new TOthers1s(Agencys, Patients, templateItem, TemplateImportDate);
                TemplateContent = tO1;
                break;
            }
            using (var dde = new DigiDentalEntities())
            {
                var queryImportDate = from ti in dde.TemplateImages
                                      where ti.Patient_ID == Patients.Patient_ID &&
                                      ti.Template_ID == TemplateItem.Template_ID
                                      group ti by ti.TemplateImage_ImportDate into tt
                                      select tt.Key.ToString();

                ImportDateCollect = queryImportDate.ToList();
                //ImportDateCollect = new ObservableCollection<string>(queryImportDate);
            }
        }