コード例 #1
0
 public ListboxTeilnehmerSIViewModel(CRMTermine termin, SteinbachEntities db)
 {
     _selectedNames.CollectionChanged += (sender, e) => UpdateCollection(sender, e);
     this.db         = db;
     CurrentTermin   = termin;
     _AvailableNames = db.personen.ToList();
 }
コード例 #2
0
 public TerminedatenViewModel(SteinbachEntities db, CRMTermine termin)
 {
     //this.db = db;
     //LoadTermine(string.Empty);
     //TermineTerminVM = new TermineTerminViewModel();
     //TermineListeVM = new TermineListeViewModel();
     //TermineListeVM.onTerminChanged += new Action<int>(TermineListeVM_onTerminChanged);
     MessageBox.Show("Should not be called -Constructor TerminedatenViewModel");
 }
コード例 #3
0
        //public void RejectChanges()
        //{


        //    if (MessageBox.Show("Bearbeitung wirklich abbrechen ?", "Sicherheitsabfrage", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
        //    {
        //        db.Dispose();
        //        db = null;
        //        if (_RaiseEvents != null)
        //        {
        //            _RaiseEvents.Publish(new SelectUIEvent(true, SelectUIEvent.EnumActivateModule.Kunde));
        //            _RaiseEvents.Publish(new ConfigureUITermineDaten(0, "10"));
        //        }


        //    }


        //    //if (CommonTools.Tools.ManageChanges.isDirty(db))
        //    //{
        //    //    List<string> mod = CommonTools.Tools.ManageChanges.GetModifiedProperties(db);

        //    //    if (MessageBox.Show("Änderungen speichern ?", "Sicherheitsabfrage", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
        //    //    {
        //    //        db.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
        //    //        _RaiseEvents.Publish(new SelectUIEvent(true, SelectUIEvent.EnumActivateModule.Kunde));
        //    //        _RaiseEvents.Publish(new ConfigureUITermineDaten(0, "10"));
        //    //        _RaiseEvents.Publish(new TerminSavedEvent(CurrentTermin.id));
        //    //    }
        //    //    else
        //    //    {
        //    //        db.Dispose();
        //    //        db = null;
        //    //        _RaiseEvents.Publish(new SelectUIEvent(true, SelectUIEvent.EnumActivateModule.Kunde));
        //    //        _RaiseEvents.Publish(new ConfigureUITermineDaten(0, "10"));
        //    //    }
        //    //}

        //    //else
        //    //{
        //    //    db.Dispose();
        //    //    db = null;
        //    //    _RaiseEvents.Publish(new SelectUIEvent(true, SelectUIEvent.EnumActivateModule.Kunde));
        //    //    _RaiseEvents.Publish(new ConfigureUITermineDaten(0, "10"));
        //    //}


        //}

        //public void SaveChanges()
        //{

        //    db.SaveChanges();
        //    if (_RaiseEvents != null)
        //    {
        //        _RaiseEvents.Publish(new SelectUIEvent(true, SelectUIEvent.EnumActivateModule.Kunde));
        //        _RaiseEvents.Publish(new ConfigureUITermineDaten(0, "10"));
        //        _RaiseEvents.Publish(new TerminSavedEvent(CurrentTermin.id));
        //    }


        //}


        /// <summary>
        /// Beide Listboxen Teilnehmer füllen - Mehrfachauswahl deshalb kein Binding
        /// </summary>
        /// <param name="termin"></param>
        /// <param name="db"></param>
        private void PopulateListboxes(CRMTermine termin, SteinbachEntities db)
        {
            ListboxTeilnehmerSI     = new ListboxTeilnehmerSIViewModel(termin, db);
            ListboxTeilnehmerExtern = new ListboxTeilnehmerExternViewModel(termin, db);
            timer          = new DispatcherTimer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
            timer.Start();
        }
コード例 #4
0
        public void NewCompany()
        {
            CRMTermine t = new CRMTermine();

            db.AddToCRMTermine(t);

            _CurrentTermin = t;
            NotifyViewTerminChanged();
            LoadTermin();

        }
コード例 #5
0
        public TermineViewModel(SteinbachEntities db, CRMTermine termin)
        {
            TestContent             = "Constructor 1 Called:";
            this.db                 = db;
            CurrentTermin           = termin;
            ListboxTeilnehmerSI     = new ListboxTeilnehmerSIViewModel(termin, db);
            ListboxTeilnehmerExtern = new ListboxTeilnehmerExternViewModel(termin, db);

            this.db.SavingChanges += new EventHandler(db_SavingChanges);
            timer          = new DispatcherTimer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
            timer.Start();
        }
コード例 #6
0
        //   List<Firmen_Personen> _AvailableNames;



        public ListboxTeilnehmerExternViewModel(CRMTermine termin, SteinbachEntities db)
        {
            _selectedNames.CollectionChanged += (sender, e) => UpdateCollection(sender, e);
            this.db       = db;
            CurrentTermin = termin;
            if (termin != null && termin.id_firma != null && termin.id_firma != 0)
            {
                _AvailableNames = new ObservableCollection <Firmen_Personen>(db.Firmen_Personen.Where(f => f.id_Firma == termin.id_firma).ToList());
            }
            else
            {
                _AvailableNames = new ObservableCollection <Firmen_Personen>(db.Firmen_Personen.Where(f => f.id_Firma == 0).ToList());
            }
        }
コード例 #7
0
        public TermineViewModel()
        {
            TestContent = "Constructor 2 Called:";
            db          = new SteinbachEntities();
            CRMTermine termin = new CRMTermine();

            termin = db.CRMTermine.Where(t => t.id == 5).SingleOrDefault();
            ListboxTeilnehmerSI     = new ListboxTeilnehmerSIViewModel(termin, db);
            ListboxTeilnehmerExtern = new ListboxTeilnehmerExternViewModel(termin, db);

            // db.AddToCRMTermine(termin);
            CurrentTermin  = termin;
            timer          = new DispatcherTimer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
            timer.Start();
        }
コード例 #8
0
        public static CRMTermine  GetNewTermin(string type)
        {
            CRMTermine t    = new CRMTermine();
            int        hour = DateTime.Now.Hour + 1;
            DateTime   dt;

            if (hour >= 15)
            {
                dt = DateTime.Now.AddDays(1);

                t.TerminVon      = Tools.DateTools.GetDateWithCustomHour(dt, 07, 45, 0);
                t.TerminBis      = Tools.DateTools.GetDateWithCustomHour(dt, 08, 45, 0);
                t.ErinerungDatum = Tools.DateTools.GetDateWithCustomHour(dt, 07, 30, 0);
            }
            else
            {
                dt               = DateTime.Now;
                t.TerminVon      = Tools.DateTools.GetDateWithCustomHour(dt, hour, 0, 0);
                t.TerminBis      = Tools.DateTools.GetDateWithCustomHour(dt, hour, 30, 0);
                t.ErinerungDatum = Tools.DateTools.GetDateWithCustomHour(dt, hour - 1, 45, 0);
            }



            TimeSpan ts = new TimeSpan(0, 15, 0);

            t.ErinnerungTimespan = ts.Ticks;
            t.Angelegt           = DAL.Session.User.id;
            t.EmailSent          = 0;
            t.Erinnerung         = 0;
            t.AppointmentType    = type;
            t.Angelegt           = DAL.Session.User.id;



            if (type.ToLower() == "termin")
            {
                t.Betreff = "neuer Termin . . .";
            }
            else if (type.ToLower() == "aufgabe")
            {
                t.Betreff = "neue Aufgabe . . .";
            }

            return(t);
        }
コード例 #9
0
        void c1Scheduler1_AppointmentAdded(object sender, C1.WPF.Schedule.AppointmentActionEventArgs e)
        {
            var cd = e.Appointment.CustomData;

            if (cd == null)
            {
                CRMTermine t = new CRMTermine();
                t.TerminVon       = e.Appointment.Start;
                t.TerminBis       = e.Appointment.End;
                t.TerminDauer     = e.Appointment.Duration.Ticks;
                t.Betreff         = e.Appointment.Subject;
                t.Standort        = e.Appointment.Location;
                t.AppointmentType = "Termin";
                t.Details         = e.Appointment.Body;

                var r = e.Appointment.Reminder;
                db.AddToCRMTermine(t);
                db.SaveChanges();
            }
        }
コード例 #10
0
        void c1Scheduler1_AppointmentChanged(object sender, C1.WPF.Schedule.AppointmentActionEventArgs e)
        {
            var x  = e.Appointment;
            var cd = e.Appointment.CustomData;

            if (cd != string.Empty)
            {
                int        _id = int.Parse(cd);
                CRMTermine t   = db.CRMTermine.Where(a => a.id == _id).SingleOrDefault();
                t.TerminVon   = e.Appointment.Start;
                t.TerminBis   = e.Appointment.End;
                t.TerminDauer = e.Appointment.Duration.Ticks;
                string subj = e.Appointment.Subject;
                if (subj.Contains("=>"))
                {
                    subj = subj.Substring(0, subj.IndexOf("=>") - 1);
                }
                t.Betreff  = subj;
                t.Standort = e.Appointment.Location;

                db.SaveChanges();
            }
        }
コード例 #11
0
        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;
            }
        }
コード例 #12
0
 /// <summary>
 /// Von PopupViewModels genutzt im View First Modus
 /// </summary>
 /// <param name="termin">Gewähltes Terminobjekt </param>
 /// <param name="db">ObjectContext </param>
 public TermineTerminViewModel(CRMTermine termin, SteinbachEntities db)
 {
     CurrentTermin = termin;
     this.db       = db;
     PopulateListboxes(CurrentTermin, db);
 }