private void Init(EnumPopupType Type, object AddionalData)
        {
            db = new SteinbachEntities();
            switch (Type)
            {
            case EnumPopupType.Termin:
            {
                break;
            }

            case EnumPopupType.Scheduler:
            {
                if (AddionalData != null)
                {
                }
                else
                {
                    //CurrentObject = new SchedulerViewModel();
                }

                break;
            }

            case EnumPopupType.Email:
            {
                //CurrentObject = new MailViewerViewModel(id);

                break;
            }

            case EnumPopupType.Kundenbesuch:
            {
                if (AddionalData != null)
                {
                    var kb  = (Firmen_Kundenbesuch)AddionalData;
                    var buf = new KundenbesuchViewModel(kb);
                    buf.DoRejectChanges += () => onDoRejectChanges();
                    CurrentObject        = buf;
                }


                break;
            }

            case EnumPopupType.Events:
            {
                CurrentObject = new SI_EventsViewModel();

                break;
            }


            default:
                break;
            }
        }
 public StandardPopupViewModel(int id, EnumPopupType Type)
 {
     Init(id, Type, null);
 }
 public StandardPopupViewModel(EnumPopupType Type, object AddionalData)
 {
     Init(Type, AddionalData);
 }
        private void Init(int id, EnumPopupType Type, object AddionalData)
        {
            db = new SteinbachEntities();
            switch (Type)
            {
            case EnumPopupType.Termin:
            {
                CRMTermine termin = db.CRMTermine.Where(t => t.id == id).SingleOrDefault();
                CurrentObject = new TermineTerminViewModel(termin, db);

                break;
            }

            case EnumPopupType.Scheduler:
            {
                if (AddionalData != null)
                {
                    var tsp = (TransferTimespan)AddionalData;
                    CurrentObject = new SchedulerViewModel(tsp.VonDatum, tsp.BisDatum);
                }
                else
                {
                    CurrentObject = new SchedulerViewModel();
                }

                break;
            }

            case EnumPopupType.Email:
            {
                CurrentObject = new MailViewerViewModel(id);

                break;
            }

            case EnumPopupType.Kundenbesuch:
            {
                var buf = new KundenbesuchViewModel(id);
                buf.DoRejectChanges += () => onDoRejectChanges();
                CurrentObject        = buf;
                break;
            }

            case EnumPopupType.Events:
            {
                var buf = new SI_EventsViewModel();
                buf.DoRejectChanges += () => onDoRejectChanges();
                CurrentObject        = buf;

                break;
            }

            case EnumPopupType.SelectEvents:
            {
                var buf = new SI_MailingSelectionViewModel();
                buf.DoRejectChanges += () => onDoRejectChanges();
                CurrentObject        = buf;

                break;
            }


            default:
                break;
            }
        }