Example #1
0
        /// <summary>
        /// Open therapist window
        /// </summary>
        public void OpenAddTherapistWindow()
        {
            if (_group == null || _group.Length < 1 || _indiv == null | _indiv.Length < 1)
            {
                return;
            }

            var dialog = new Dialog.Dialog();

            dialog.Title        = "Add New Therapist";
            dialog.QuestionText = "Please give a name to the new therapist.";

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    string mKeySetName = dialog.ResponseText;
                    therapistListViewModel.AllTherapists.Add(Therapist.CreateTherapist(mKeySetName));
                    using (StreamWriter file = new StreamWriter(Path.Combine(Properties.Settings.Default.SaveLocation, _group, _indiv, "Therapists.json"), false))
                    {
                        Therapists mCollector = new Therapists();
                        mCollector.PrimaryTherapists = therapistListViewModel.AllTherapists;

                        file.WriteLine(JsonConvert.SerializeObject(mCollector));
                    }
                    MessageBox.Show("Successfully added: " + dialog.ResponseText);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }
Example #2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public TherapistRepository()
 {
     if (_mCollObj == null)
     {
         _mCollObj = new Therapists();
         _mCollObj.PrimaryTherapists = new ObservableCollection <Therapist>();
     }
 }
Example #3
0
        /// <summary>
        /// Build collection
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="indivName"></param>
        /// <returns></returns>
        public ObservableCollection <Therapist> GetCollectors(string groupName, string indivName)
        {
            var target = Properties.Settings.Default.SaveLocation + "\\" + groupName + "\\" + indivName + "\\PrimaryTherapists.json";

            if (File.Exists(@target))
            {
                _mCollObj = JsonConvert.DeserializeObject <Therapists>(target);
            }

            return(new ObservableCollection <Therapist>(_mCollObj.PrimaryTherapists));
        }
Example #4
0
        /// <summary>
        /// Parse JSON file if exists
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="indivName"></param>
        public void RefreshRepository(string groupName, string indivName)
        {
            var target = Properties.Settings.Default.SaveLocation + "\\" + groupName + "\\" + indivName + "\\Therapists.json";

            if (File.Exists(@target))
            {
                string     mInput = File.ReadAllText(@target);
                Therapists items  = JsonConvert.DeserializeObject <Therapists>(mInput);

                AllTherapists.Clear();

                foreach (Therapist item in items.PrimaryTherapists)
                {
                    AllTherapists.Add(item);
                }
            }
        }
Example #5
0
 public void AddTherapists(List <TherapistUser> therapists) => therapists.ForEach(t => Therapists.Add(t));
Example #6
0
 public void AddTherapist(Therapist therapist) => Therapists.Add(new TherapistUser()
 {
     Therapist = therapist, TherapistId = therapist.TherapistId, User = this, UserId = this.UserId
 });
        public static bool Register(Therapists1 t)
        {
            Therapists therapist = Therapists1.Todal(t);

            return(Dal.TherapistsDal.Register(therapist));
        }