コード例 #1
0
        public void OnAdd()
        {
            this.Validate();
            if (this.IsValid)
            {
                if (!isUpdate)
                {
                    int doctorId = DbContextHandler.Instance.GetDoctorIdByName(this.selectedType);

                    DbContextHandler.Instance.CreateReview(Description, Termin, doctorId);

                    Pregledi.Clear();
                    DbContextHandler.Instance.GetAllReviews().ForEach(pregled => Pregledi.Add(pregled));
                    Termin       = DateTime.Now;
                    Description  = "";
                    SelectedType = null;
                }
                else
                {
                    BtnContent = "Update";
                    MessageBox.Show("Update data!");

                    DbContextHandler.Instance.UpdateReview(SelectedItem.Pregled_Id, description, termin);

                    Pregledi.Clear();
                    DbContextHandler.Instance.GetAllReviews().ForEach(pregled => Pregledi.Add(pregled));

                    isUpdate     = false;
                    BtnContent   = "Add";
                    Termin       = DateTime.Now;
                    Description  = "";
                    SelectedType = null;
                }
            }
        }
コード例 #2
0
        public void OnAdd()
        {
            this.Validate();
            if (this.IsValid)
            {
                if (!isUpdate)
                {
                    int doctorId = DbContextHandler.Instance.GetDoctorIdByName(this.selectedType);

                    var      splits       = selectedDate.ToString().Split(' ');
                    var      selectedTerm = splits[0] + " " + SelectedType2;
                    DateTime datum        = DateTime.Parse(selectedTerm);
                    DbContextHandler.Instance.CreateReview(Description, datum, doctorId);

                    Pregledi.Clear();
                    DbContextHandler.Instance.GetAllReviews().ForEach(pregled => Pregledi.Add(pregled));

                    Description  = "";
                    SelectedType = null;
                }
                else
                {
                    BtnContent = "Update";
                    MessageBox.Show("Update data!");

                    //    DbContextHandler.Instance.UpdateReview(SelectedItem.Pregled_Id, description, selectedType2);

                    Pregledi.Clear();
                    DbContextHandler.Instance.GetAllReviews().ForEach(pregled => Pregledi.Add(pregled));

                    isUpdate   = false;
                    BtnContent = "Add";

                    Description  = "";
                    SelectedType = null;
                }
            }
        }